/**Function************************************************************* Synopsis [Allocates the name manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Nm_Man_t * Nm_ManCreate( int nSize ) { Nm_Man_t * p; // allocate the table p = ALLOC( Nm_Man_t, 1 ); memset( p, 0, sizeof(Nm_Man_t) ); // set the parameters p->nSizeFactor = 2; // determined the limit on the grow of data before the table resizes p->nGrowthFactor = 3; // determined how much the table grows after resizing // allocate and clean the bins p->nBins = Cudd_PrimeNm(nSize); p->pBinsI2N = ALLOC( Nm_Entry_t *, p->nBins ); p->pBinsN2I = ALLOC( Nm_Entry_t *, p->nBins ); memset( p->pBinsI2N, 0, sizeof(Nm_Entry_t *) * p->nBins ); memset( p->pBinsN2I, 0, sizeof(Nm_Entry_t *) * p->nBins ); // start the memory manager p->pMem = Extra_MmFlexStart(); return p; }
/**Function************************************************************* Synopsis [Creates a new manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ ABC_Manager ABC_InitManager() { ABC_Manager_t * mng; Abc_Start(); mng = ALLOC( ABC_Manager_t, 1 ); memset( mng, 0, sizeof(ABC_Manager_t) ); mng->pNtk = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_SOP, 1 ); mng->pNtk->pName = Extra_UtilStrsav("csat_network"); mng->tName2Node = stmm_init_table(strcmp, stmm_strhash); mng->tNode2Name = stmm_init_table(stmm_ptrcmp, stmm_ptrhash); mng->pMmNames = Extra_MmFlexStart(); mng->vNodes = Vec_PtrAlloc( 100 ); mng->vValues = Vec_IntAlloc( 100 ); mng->mode = 0; // set "resource-aware integration" as the default mode // set default parameters for CEC Prove_ParamsSetDefault( &mng->Params ); // set infinite resource limit for the final mitering // mng->Params.nMiteringLimitLast = ABC_INFINITY; return mng; }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Allocates the name manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Nm_Man_t * Nm_ManCreate( int nSize ) { Nm_Man_t * p; // allocate the table p = ABC_ALLOC( Nm_Man_t, 1 ); memset( p, 0, sizeof(Nm_Man_t) ); // set the parameters p->nSizeFactor = 2; // determined the limit on the grow of data before the table resizes p->nGrowthFactor = 3; // determined how much the table grows after resizing // allocate and clean the bins p->nBins = Cudd_PrimeNm(nSize); p->pBinsI2N = ABC_ALLOC( Nm_Entry_t *, p->nBins ); p->pBinsN2I = ABC_ALLOC( Nm_Entry_t *, p->nBins ); memset( p->pBinsI2N, 0, sizeof(Nm_Entry_t *) * p->nBins ); memset( p->pBinsN2I, 0, sizeof(Nm_Entry_t *) * p->nBins ); // start the memory manager p->pMem = Extra_MmFlexStart(); return p; }
/**Function************************************************************* Synopsis [Creates a new Ntk.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Abc_Ntk_t * Abc_NtkAlloc( Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan ) { Abc_Ntk_t * pNtk; pNtk = ALLOC( Abc_Ntk_t, 1 ); memset( pNtk, 0, sizeof(Abc_Ntk_t) ); pNtk->ntkType = Type; pNtk->ntkFunc = Func; // start the object storage pNtk->vObjs = Vec_PtrAlloc( 100 ); pNtk->vAsserts = Vec_PtrAlloc( 100 ); pNtk->vPios = Vec_PtrAlloc( 100 ); pNtk->vPis = Vec_PtrAlloc( 100 ); pNtk->vPos = Vec_PtrAlloc( 100 ); pNtk->vCis = Vec_PtrAlloc( 100 ); pNtk->vCos = Vec_PtrAlloc( 100 ); pNtk->vBoxes = Vec_PtrAlloc( 100 ); // start the memory managers pNtk->pMmObj = fUseMemMan? Extra_MmFixedStart( sizeof(Abc_Obj_t) ) : NULL; pNtk->pMmStep = fUseMemMan? Extra_MmStepStart( ABC_NUM_STEPS ) : NULL; // get ready to assign the first Obj ID pNtk->nTravIds = 1; // start the functionality manager if ( Abc_NtkIsStrash(pNtk) ) pNtk->pManFunc = Abc_AigAlloc( pNtk ); else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) ) pNtk->pManFunc = Extra_MmFlexStart(); else if ( Abc_NtkHasBdd(pNtk) ) pNtk->pManFunc = Cudd_Init( 20, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); else if ( Abc_NtkHasAig(pNtk) ) pNtk->pManFunc = Hop_ManStart(); else if ( Abc_NtkHasMapping(pNtk) ) pNtk->pManFunc = Abc_FrameReadLibGen(); else if ( !Abc_NtkHasBlackbox(pNtk) ) assert( 0 ); // name manager pNtk->pManName = Nm_ManCreate( 200 ); // attribute manager pNtk->vAttrs = Vec_PtrStart( VEC_ATTR_TOTAL_NUM ); return pNtk; }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Reads in the supergate library and prepares it for use.] Description [The supergates library comes in a .super file. This file contains descriptions of supergates along with some relevant information. This procedure reads the supergate file, canonicizes the supergates, and constructs an additional lookup table, which can be used to map truth tables of the cuts into the pair (phase, supergate). The phase indicates how the current truth table should be phase assigned to match the canonical form of the supergate. The resulting phase is the bitwise EXOR of the phase needed to canonicize the supergate and the phase needed to transform the truth table into its canonical form.] SideEffects [] SeeAlso [] ***********************************************************************/ Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int fAlgorithm, int fVerbose ) { Map_SuperLib_t * p; clock_t clk; // start the supergate library p = ABC_ALLOC( Map_SuperLib_t, 1 ); memset( p, 0, sizeof(Map_SuperLib_t) ); p->pName = pFileName; p->fVerbose = fVerbose; p->mmSupers = Extra_MmFixedStart( sizeof(Map_Super_t) ); p->mmEntries = Extra_MmFixedStart( sizeof(Map_HashEntry_t) ); p->mmForms = Extra_MmFlexStart(); Map_MappingSetupTruthTables( p->uTruths ); // start the hash table p->tTableC = Map_SuperTableCreate( p ); p->tTable = Map_SuperTableCreate( p ); // read the supergate library from file clk = clock(); if ( fAlgorithm ) { if ( !Map_LibraryReadTree( p, pFileName, pExcludeFile ) ) { Map_SuperLibFree( p ); return NULL; } } else { if ( pExcludeFile != 0 ) { Map_SuperLibFree( p ); printf ("Error: Exclude file support not present for old format. Stop.\n"); return NULL; } if ( !Map_LibraryRead( p, pFileName ) ) { Map_SuperLibFree( p ); return NULL; } } assert( p->nVarsMax > 0 ); // report the stats if ( fVerbose ) { printf( "Loaded %d unique %d-input supergates from \"%s\". ", p->nSupersReal, p->nVarsMax, pFileName ); ABC_PRT( "Time", clock() - clk ); } // assign the interver parameters p->pGateInv = Mio_LibraryReadInv( p->pGenlib ); p->tDelayInv.Rise = Mio_LibraryReadDelayInvRise( p->pGenlib ); p->tDelayInv.Fall = Mio_LibraryReadDelayInvFall( p->pGenlib ); p->tDelayInv.Worst = MAP_MAX( p->tDelayInv.Rise, p->tDelayInv.Fall ); p->AreaInv = Mio_LibraryReadAreaInv( p->pGenlib ); p->AreaBuf = Mio_LibraryReadAreaBuf( p->pGenlib ); // assign the interver supergate p->pSuperInv = (Map_Super_t *)Extra_MmFixedEntryFetch( p->mmSupers ); memset( p->pSuperInv, 0, sizeof(Map_Super_t) ); p->pSuperInv->Num = -1; p->pSuperInv->nGates = 1; p->pSuperInv->nFanins = 1; p->pSuperInv->nFanLimit = 10; p->pSuperInv->pFanins[0] = p->ppSupers[0]; p->pSuperInv->pRoot = p->pGateInv; p->pSuperInv->Area = p->AreaInv; p->pSuperInv->tDelayMax = p->tDelayInv; p->pSuperInv->tDelaysR[0].Rise = MAP_NO_VAR; p->pSuperInv->tDelaysR[0].Fall = p->tDelayInv.Rise; p->pSuperInv->tDelaysF[0].Rise = p->tDelayInv.Fall; p->pSuperInv->tDelaysF[0].Fall = MAP_NO_VAR; return p; }