/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Mpm_ManStop( Mpm_Man_t * p ) { if ( p->pPars->fUseTruth && p->pPars->fVeryVerbose ) { char * pFileName = "truths.txt"; FILE * pFile = fopen( pFileName, "wb" ); Vec_MemDump( pFile, p->vTtMem ); fclose( pFile ); printf( "Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n", Vec_MemEntryNum(p->vTtMem), p->nLutSize, pFileName, (16.0 * p->nTruWords + 1.0) * Vec_MemEntryNum(p->vTtMem) / (1 << 20) ); } if ( p->pPars->fUseDsd && p->pPars->fVerbose ) Mpm_ManPrintDsdStats( p ); if ( p->vTtMem ) { Vec_MemHashFree( p->vTtMem ); Vec_MemFree( p->vTtMem ); } if ( p->pHash ) { Vec_WrdFree( p->vPerm6 ); Vec_IntFree( p->vMap2Perm ); Vec_IntFree( p->vConfgRes ); Vec_IntFree( p->pHash->vData ); Hsh_IntManStop( p->pHash ); } Vec_WecFreeP( &p->vNpnConfigs ); Vec_PtrFree( p->vTemp ); Mmr_StepStop( p->pManCuts ); ABC_FREE( p->vFreeUnits.pArray ); // mapping attributes ABC_FREE( p->vCutBests.pArray ); ABC_FREE( p->vCutLists.pArray ); ABC_FREE( p->vMigRefs.pArray ); ABC_FREE( p->vMapRefs.pArray ); ABC_FREE( p->vEstRefs.pArray ); ABC_FREE( p->vRequireds.pArray ); ABC_FREE( p->vTimes.pArray ); ABC_FREE( p->vAreas.pArray ); ABC_FREE( p->vEdges.pArray ); ABC_FREE( p ); }
static void Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p ) { int i, j, k, n; int version = Vec_StrGetI( vOut, pPos ); assert( version == 5 || version == ABC_SCL_CUR_VERSION ); // wrong version of the file // Read non-composite fields: p->pName = Vec_StrGetS(vOut, pPos); p->default_wire_load = Vec_StrGetS(vOut, pPos); p->default_wire_load_sel = Vec_StrGetS(vOut, pPos); p->default_max_out_slew = Vec_StrGetF(vOut, pPos); p->unit_time = Vec_StrGetI(vOut, pPos); p->unit_cap_fst = Vec_StrGetF(vOut, pPos); p->unit_cap_snd = Vec_StrGetI(vOut, pPos); // Read 'wire_load' vector: for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) { SC_WireLoad * pWL = Abc_SclWireLoadAlloc(); Vec_PtrPush( p->vWireLoads, pWL ); pWL->pName = Vec_StrGetS(vOut, pPos); pWL->res = Vec_StrGetF(vOut, pPos); pWL->cap = Vec_StrGetF(vOut, pPos); for ( j = Vec_StrGetI(vOut, pPos); j != 0; j-- ) { Vec_IntPush( pWL->vFanout, Vec_StrGetI(vOut, pPos) ); Vec_FltPush( pWL->vLen, Vec_StrGetF(vOut, pPos) ); } } // Read 'wire_load_sel' vector: for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) { SC_WireLoadSel * pWLS = Abc_SclWireLoadSelAlloc(); Vec_PtrPush( p->vWireLoadSels, pWLS ); pWLS->pName = Vec_StrGetS(vOut, pPos); for ( j = Vec_StrGetI(vOut, pPos); j != 0; j-- ) { Vec_FltPush( pWLS->vAreaFrom, Vec_StrGetF(vOut, pPos) ); Vec_FltPush( pWLS->vAreaTo, Vec_StrGetF(vOut, pPos) ); Vec_PtrPush( pWLS->vWireLoadModel, Vec_StrGetS(vOut, pPos) ); } } for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) { SC_Cell * pCell = Abc_SclCellAlloc(); pCell->Id = SC_LibCellNum(p); Vec_PtrPush( p->vCells, pCell ); pCell->pName = Vec_StrGetS(vOut, pPos); pCell->area = Vec_StrGetF(vOut, pPos); pCell->drive_strength = Vec_StrGetI(vOut, pPos); pCell->n_inputs = Vec_StrGetI(vOut, pPos); pCell->n_outputs = Vec_StrGetI(vOut, pPos); /* printf( "%s\n", pCell->pName ); if ( !strcmp( "XOR3_X4M_A9TL", pCell->pName ) ) { int s = 0; } */ for ( j = 0; j < pCell->n_inputs; j++ ) { SC_Pin * pPin = Abc_SclPinAlloc(); Vec_PtrPush( pCell->vPins, pPin ); pPin->dir = sc_dir_Input; pPin->pName = Vec_StrGetS(vOut, pPos); pPin->rise_cap = Vec_StrGetF(vOut, pPos); pPin->fall_cap = Vec_StrGetF(vOut, pPos); } for ( j = 0; j < pCell->n_outputs; j++ ) { SC_Pin * pPin = Abc_SclPinAlloc(); Vec_PtrPush( pCell->vPins, pPin ); pPin->dir = sc_dir_Output; pPin->pName = Vec_StrGetS(vOut, pPos); pPin->max_out_cap = Vec_StrGetF(vOut, pPos); pPin->max_out_slew = Vec_StrGetF(vOut, pPos); k = Vec_StrGetI(vOut, pPos); assert( k == pCell->n_inputs ); // read function if ( version == 5 ) { // formula is not given assert( Vec_WrdSize(pPin->vFunc) == 0 ); Vec_WrdGrow( pPin->vFunc, Abc_Truth6WordNum(pCell->n_inputs) ); for ( k = 0; k < Vec_WrdCap(pPin->vFunc); k++ ) Vec_WrdPush( pPin->vFunc, Vec_StrGetW(vOut, pPos) ); } else { // (possibly empty) formula is always given assert( version == ABC_SCL_CUR_VERSION ); assert( pPin->func_text == NULL ); pPin->func_text = Vec_StrGetS(vOut, pPos); if ( pPin->func_text[0] == 0 ) { // formula is not given - read truth table ABC_FREE( pPin->func_text ); assert( Vec_WrdSize(pPin->vFunc) == 0 ); Vec_WrdGrow( pPin->vFunc, Abc_Truth6WordNum(pCell->n_inputs) ); for ( k = 0; k < Vec_WrdCap(pPin->vFunc); k++ ) Vec_WrdPush( pPin->vFunc, Vec_StrGetW(vOut, pPos) ); } else { // formula is given - derive truth table SC_Pin * pPin2; Vec_Ptr_t * vNames; // collect input names vNames = Vec_PtrAlloc( pCell->n_inputs ); SC_CellForEachPinIn( pCell, pPin2, n ) Vec_PtrPush( vNames, pPin2->pName ); // derive truth table assert( Vec_WrdSize(pPin->vFunc) == 0 ); Vec_WrdFree( pPin->vFunc ); pPin->vFunc = Mio_ParseFormulaTruth( pPin->func_text, (char **)Vec_PtrArray(vNames), pCell->n_inputs ); Vec_PtrFree( vNames ); // skip truth table assert( Vec_WrdSize(pPin->vFunc) == Abc_Truth6WordNum(pCell->n_inputs) ); for ( k = 0; k < Vec_WrdSize(pPin->vFunc); k++ ) { word Value = Vec_StrGetW(vOut, pPos); assert( Value == Vec_WrdEntry(pPin->vFunc, k) ); } } } // Read 'rtiming': (pin-to-pin timing tables for this particular output) for ( k = 0; k < pCell->n_inputs; k++ ) { SC_Timings * pRTime = Abc_SclTimingsAlloc(); Vec_PtrPush( pPin->vRTimings, pRTime ); pRTime->pName = Vec_StrGetS(vOut, pPos); n = Vec_StrGetI(vOut, pPos); assert( n <= 1 ); if ( n == 1 ) { SC_Timing * pTime = Abc_SclTimingAlloc(); Vec_PtrPush( pRTime->vTimings, pTime ); pTime->tsense = (SC_TSense)Vec_StrGetI(vOut, pPos); Abc_SclReadSurface( vOut, pPos, pTime->pCellRise ); Abc_SclReadSurface( vOut, pPos, pTime->pCellFall ); Abc_SclReadSurface( vOut, pPos, pTime->pRiseTrans ); Abc_SclReadSurface( vOut, pPos, pTime->pFallTrans ); } else assert( Vec_PtrSize(pRTime->vTimings) == 0 ); } } } }