// compute the sizes of leaf-DAGs Gia_ManForEachAnd( p, pObj, i ) { if ( pObj->fMark0 == 0 ) continue; pObj->fMark0 = 0; nCountAll++; nStored = Gia_ManSatPartCreate( p, pObj, Storage ); nWords2 += nStored; assert( nStored < 500 ); pStart = (int *)Aig_MmFlexEntryFetch( pMan->pMem, sizeof(int) * nStored ); memcpy( pStart, Storage, sizeof(int) * nStored ); nLeaves = nNodes = 0; nLevels = 1+Gia_ManSatPartCount( p, pObj, &nLeaves, &nNodes ); nWords += nLeaves + nNodes; if ( nNodes <= 2*GIA_LIMIT ) nCount[nNodes]++; else nCount[2*GIA_LIMIT+1]++; // if ( nNodes > 10 && i % 100 == 0 ) // if ( nNodes > 5 ) if ( 0 ) { Gia_ManSatPartCountClauses( p, pObj, &Num0, &Num1 ); printf( "%8d : And = %3d. Lev = %2d. Clauses = %3d. (%3d + %3d).\n", i, nNodes, nLevels, Num0+Num1, Num0, Num1 ); Gia_ManSatPartPrint( p, pObj, 0 ); printf( "\n" ); } pObj->fMark0 = 1; }
/**Function************************************************************* Synopsis [Creates the new timing box.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Aig_TManCreateBox( Aig_TMan_t * p, int * pPis, int nPis, int * pPos, int nPos, float * pPiTimes, float * pPoTimes ) { Aig_TBox_t * pBox; int i; pBox = (Aig_TBox_t *)Aig_MmFlexEntryFetch( p->pMemObj, sizeof(Aig_TBox_t) + sizeof(int) * (nPis+nPos) ); memset( pBox, 0, sizeof(Aig_TBox_t) ); pBox->iBox = Vec_PtrSize( p->vBoxes ); Vec_PtrPush( p->vBoxes, pBox ); pBox->nInputs = nPis; pBox->nOutputs = nPos; for ( i = 0; i < nPis; i++ ) { assert( pPis[i] < p->nPis ); pBox->Inouts[i] = pPis[i]; Aig_TManSetPiArrival( p, pPis[i], pPiTimes[i] ); p->pPis[pPis[i]].iObj2Box = pBox->iBox; } for ( i = 0; i < nPos; i++ ) { assert( pPos[i] < p->nPos ); pBox->Inouts[nPis+i] = pPos[i]; Aig_TManSetPoRequired( p, pPos[i], pPoTimes[i] ); p->pPos[pPos[i]].iObj2Box = pBox->iBox; } }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Duplicates the cut using new memory manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Amap_Cut_t * Amap_ManDupCut( Amap_Man_t * p, Amap_Cut_t * pCut ) { Amap_Cut_t * pNew; int nBytes = sizeof(Amap_Cut_t) + sizeof(int) * pCut->nFans; pNew = (Amap_Cut_t *)Aig_MmFlexEntryFetch( p->pMemCutBest, nBytes ); memcpy( pNew, pCut, nBytes ); return pNew; }
/**Function************************************************************* Synopsis [Reallocates the object.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ static Nwk_Obj_t * Nwk_ManReallocNode( Nwk_Obj_t * pObj ) { Nwk_Obj_t ** pFanioOld = pObj->pFanio; assert( Nwk_ObjReallocIsNeeded(pObj) ); pObj->pFanio = (Nwk_Obj_t **)Aig_MmFlexEntryFetch( pObj->pMan->pMemObjs, 2 * pObj->nFanioAlloc * sizeof(Nwk_Obj_t *) ); memmove( pObj->pFanio, pFanioOld, pObj->nFanioAlloc * sizeof(Nwk_Obj_t *) ); pObj->nFanioAlloc *= 2; pObj->pMan->nRealloced++; return NULL; }
/**Function************************************************************* Synopsis [Allocates memory for the net.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ char * Ntl_ModelCreateNetName( Ntl_Mod_t * p, const char * pName, int Num ) { char * pResult; char Buffer[1000]; assert( strlen(pName) < 900 ); do { sprintf( Buffer, "%s%d", pName, Num++ ); } while ( Ntl_ModelFindNet( p, Buffer ) != NULL ); pResult = (char *)Aig_MmFlexEntryFetch( p->pMan->pMemObjs, strlen(Buffer) + 1 ); strcpy( pResult, Buffer ); return pResult; }
/**Function************************************************************* Synopsis [Allocates memory for the net.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Ntl_Net_t * Ntl_ModelCreateNet( Ntl_Mod_t * p, const char * pName ) { Ntl_Net_t * pNet; int nSize = sizeof(Ntl_Net_t) + strlen(pName) + 1; nSize = (nSize / sizeof(char*) + ((nSize % sizeof(char*)) > 0)) * sizeof(char*); // added by Saurabh on Sep 3, 2009 pNet = (Ntl_Net_t *)Aig_MmFlexEntryFetch( p->pMan->pMemObjs, nSize ); memset( pNet, 0, sizeof(Ntl_Net_t) ); strcpy( pNet->pName, pName ); pNet->NetId = Vec_PtrSize( p->vNets ); Vec_PtrPush( p->vNets, pNet ); return pNet; }