コード例 #1
0
ファイル: amapLiberty.c プロジェクト: ultracold273/abc_glift
/**Function*************************************************************

  Synopsis    [Returns cell's function.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
int Amap_LibertyCellIsFlop( Amap_Tree_t * p, Amap_Item_t * pCell )
{
    Amap_Item_t * pAttr;
    Amap_ItemForEachChild( p, pCell, pAttr )
        if ( !Amap_LibertyCompare(p, pAttr->Key, "ff") ||
             !Amap_LibertyCompare(p, pAttr->Key, "latch") )
            return 1;
    return 0;
}
コード例 #2
0
ファイル: amapLiberty.c プロジェクト: ultracold273/abc_glift
/**Function*************************************************************

  Synopsis    [Returns pin's function.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Item_t * Amap_LibertyPinFunction( Amap_Tree_t * p, Amap_Item_t * pPin )
{
    Amap_Item_t * pFunc;
    Amap_ItemForEachChild( p, pPin, pFunc )
        if ( !Amap_LibertyCompare(p, pFunc->Key, "function") )
            return pFunc;
    return NULL;
}
コード例 #3
0
ファイル: amapLiberty.c プロジェクト: ultracold273/abc_glift
/**Function*************************************************************

  Synopsis    [Returns cell's area.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Item_t * Amap_LibertyCellArea( Amap_Tree_t * p, Amap_Item_t * pCell )
{
    Amap_Item_t * pArea;
    Amap_ItemForEachChild( p, pCell, pArea )
    {
        if ( Amap_LibertyCompare(p, pArea->Key, "area") )
            continue;
        return pArea;
    }
    return NULL;
}
コード例 #4
0
ファイル: amapLiberty.c プロジェクト: ultracold273/abc_glift
/**Function*************************************************************

  Synopsis    [Returns cell's function.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Item_t * Amap_LibertyCellOutput( Amap_Tree_t * p, Amap_Item_t * pCell )
{
    Amap_Item_t * pPin;
    Amap_ItemForEachChild( p, pCell, pPin )
    {
        if ( Amap_LibertyCompare(p, pPin->Key, "pin") )
            continue;
        if ( Amap_LibertyPinFunction(p, pPin) )
            return pPin;
    }
    return NULL;
}
コード例 #5
0
ファイル: amapLiberty.c プロジェクト: ultracold273/abc_glift
/**Function*************************************************************

  Synopsis    [Count cell's output pins (pins with a logic function).]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
int Amap_LibertyCellCountOutputs( Amap_Tree_t * p, Amap_Item_t * pCell )
{
    Amap_Item_t * pPin;
    int Counter = 0;
    Amap_ItemForEachChild( p, pCell, pPin )
    {
        if ( Amap_LibertyCompare(p, pPin->Key, "pin") )
            continue;
        if ( Amap_LibertyPinFunction(p, pPin) )
            Counter++;
    }
    return Counter;
}
コード例 #6
0
ファイル: amapLiberty.c プロジェクト: Shubhankar007/ECEN-699
Vec_Ptr_t * Amap_LibertyCellOutputs( Amap_Tree_t * p, Amap_Item_t * pCell )
{
    Amap_Item_t * pPin;
    Vec_Ptr_t * vOutPins;
    vOutPins = Vec_PtrAlloc( 2 );
    Amap_ItemForEachChild( p, pCell, pPin )
    {
        if ( Amap_LibertyCompare(p, pPin->Key, "pin") )
            continue;
        if ( Amap_LibertyPinFunction(p, pPin) )
            Vec_PtrPush( vOutPins, pPin );
    }
    return vOutPins;
}
コード例 #7
0
ファイル: amapLiberty.c プロジェクト: ultracold273/abc_glift
/**Function*************************************************************

  Synopsis    [Prints parse tree in Genlib format.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
{
    FILE * pFile;
    Amap_Item_t * pCell, * pArea, * pFunc, * pPin, * pOutput;
    char * pForm;
    int Counter;
    if ( pFileName == NULL )
        pFile = stdout;
    else
    {
        pFile = fopen( pFileName, "w" );
        if ( pFile == NULL )
        {
            printf( "Amap_LibertyPrintGenlib(): The output file is unavailable (absent or open).\n" );
            return 0;
        }
    }
    fprintf( pFile, "# This Genlib file was generated by ABC on %s\n", Amap_LibertyTimeStamp() );
    fprintf( pFile, "# The standard cell library \"%s\" is from Liberty file \"%s\"\n", Amap_LibertyGetString(p, Amap_LibertyRoot(p)->Head), p->pFileName );
    fprintf( pFile, "# (To find out more about Genlib format, google for \"sis_paper.ps\")\n" );

    fprintf( pFile, "GATE  " );
    fprintf( pFile, "%16s  ", "_const0_" );
    fprintf( pFile, "%f  ",   0.0 );
    fprintf( pFile, "%s=",    "z" );
    fprintf( pFile, "%s;\n",  "CONST0" );

    fprintf( pFile, "GATE  " );
    fprintf( pFile, "%16s  ", "_const1_" );
    fprintf( pFile, "%f  ",   0.0 );
    fprintf( pFile, "%s=",    "z" );
    fprintf( pFile, "%s;\n",  "CONST1" );

    Amap_ItemForEachChild( p, Amap_LibertyRoot(p), pCell )
    {
/*
    if ( strcmp(Amap_LibertyGetString(p, pCell->Head), "HA1SVTX1") == 0 )
    {
        int s = 0;
    }
*/
        if ( Amap_LibertyCompare(p, pCell->Key, "cell") )
            continue;
        if ( Amap_LibertyCellIsFlop(p, pCell) )
        {
            if ( fVerbose )
                printf( "Amap_LibertyPrintGenlib() skipped sequential cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
            continue;
        }
        Counter = Amap_LibertyCellCountOutputs( p, pCell );
        if ( Counter == 0 )
        {
            if ( fVerbose )
                printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" without logic function.\n", Amap_LibertyGetString(p, pCell->Head) );
            continue;
        }
        if ( Counter > 1 )
        {
            if ( fVerbose )
                printf( "Amap_LibertyPrintGenlib() skipped multi-output cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
            continue;
        }
        pArea = Amap_LibertyCellArea( p, pCell );
        if ( pArea == NULL )
        {
            if ( fVerbose )
                printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with unspecified area.\n", Amap_LibertyGetString(p, pCell->Head) );
            continue;
        }
        pOutput = Amap_LibertyCellOutput( p, pCell );
        pFunc   = Amap_LibertyPinFunction( p, pOutput );
        pForm   = Amap_LibertyGetStringFormula( p, pFunc->Head );
        if ( !strcmp(pForm, "0") || !strcmp(pForm, "1") )
        {
            if ( fVerbose )
                printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with constant formula \"%s\".\n", Amap_LibertyGetString(p, pCell->Head), pForm );
            continue;
        }

        fprintf( pFile, "GATE  " );
        fprintf( pFile, "%16s  ", Amap_LibertyGetString(p, pCell->Head) );
        fprintf( pFile, "%f  ",   atof(Amap_LibertyGetString(p, pArea->Head)) );
        fprintf( pFile, "%s=",    Amap_LibertyGetString(p, pOutput->Head) );
        fprintf( pFile, "%s;\n",  Amap_LibertyGetStringFormula(p, pFunc->Head) );

        Amap_ItemForEachChild( p, pCell, pPin )
            if ( pPin != pOutput && !Amap_LibertyCompare(p, pPin->Key, "pin") )
                fprintf( pFile, "    PIN  %13s  UNKNOWN  1  999  1.00  0.00  1.00  0.00\n", Amap_LibertyGetString(p, pPin->Head) );
    }
    if ( pFile != stdout )
        fclose( pFile );
    return 1;
}