diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/gia/gia.h | 6 | ||||
-rw-r--r-- | src/aig/gia/giaAiger.c | 6 | ||||
-rw-r--r-- | src/aig/gia/giaFadds.c | 16 | ||||
-rw-r--r-- | src/aig/gia/giaTim.c | 489 | ||||
-rw-r--r-- | src/aig/gia/giaUtil.c | 25 | ||||
-rw-r--r-- | src/base/abci/abc.c | 21 | ||||
-rw-r--r-- | src/base/wlc/wlc.h | 5 | ||||
-rw-r--r-- | src/base/wlc/wlcBlast.c | 116 | ||||
-rw-r--r-- | src/base/wlc/wlcCom.c | 20 | ||||
-rw-r--r-- | src/base/wlc/wlcNtk.c | 24 | ||||
-rw-r--r-- | src/base/wlc/wlcReadVer.c | 2 | ||||
-rw-r--r-- | src/misc/tim/timMan.c | 18 |
12 files changed, 496 insertions, 252 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index c89969c4..ff33b598 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -1345,14 +1345,15 @@ extern float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, extern Vec_Int_t * Gia_ManComputeSwitchProbs( Gia_Man_t * pGia, int nFrames, int nPref, int fProbOne ); extern Vec_Flt_t * Gia_ManPrintOutputProb( Gia_Man_t * p ); /*=== giaTim.c ===========================================================*/ +extern int Gia_ManIsNormalized( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p ); -extern Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * vBoxPres ); extern int Gia_ManLevelWithBoxes( Gia_Man_t * p ); extern int Gia_ManLutLevelWithBoxes( Gia_Man_t * p ); -extern int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit ); extern void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres ); extern Gia_Man_t * Gia_ManUpdateExtraAig( void * pTime, Gia_Man_t * pAig, Vec_Int_t * vBoxPres ); +extern Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * vBoxPres ); +extern int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit, char * pFileSpec ); /*=== giaTruth.c ===========================================================*/ extern word Gia_ObjComputeTruthTable6Lut( Gia_Man_t * p, int iObj, Vec_Wrd_t * vTemp ); extern word Gia_ObjComputeTruthTable6( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vSupp, Vec_Wrd_t * vTruths ); @@ -1396,7 +1397,6 @@ extern void Gia_ManCreateValueRefs( Gia_Man_t * p ); extern void Gia_ManCreateRefs( Gia_Man_t * p ); extern int * Gia_ManCreateMuxRefs( Gia_Man_t * p ); extern int Gia_ManCrossCut( Gia_Man_t * p, int fReverse ); -extern int Gia_ManIsNormalized( Gia_Man_t * p ); extern Vec_Int_t * Gia_ManCollectPoIds( Gia_Man_t * p ); extern int Gia_ObjIsMuxType( Gia_Obj_t * pNode ); extern int Gia_ObjRecognizeExor( Gia_Obj_t * pObj, Gia_Obj_t ** ppFan0, Gia_Obj_t ** ppFan1 ); diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c index cbcaf856..14bd1221 100644 --- a/src/aig/gia/giaAiger.c +++ b/src/aig/gia/giaAiger.c @@ -742,9 +742,8 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS { // Tim_ManPrint( (Tim_Man_t *)pNew->pManTime ); if ( Abc_FrameReadLibBox() == NULL ) - printf( "Cannot create TIM manager because box library is not available.\n" ); - else - Tim_ManCreate( (Tim_Man_t *)pNew->pManTime, Abc_FrameReadLibBox(), pNew->vInArrs, pNew->vOutReqs ); + printf( "Warning: Creating unit-delay box delay tables because box library is not available.\n" ); + Tim_ManCreate( (Tim_Man_t *)pNew->pManTime, Abc_FrameReadLibBox(), pNew->vInArrs, pNew->vOutReqs ); } Vec_FltFreeP( &pNew->vInArrs ); Vec_FltFreeP( &pNew->vOutReqs ); @@ -1016,7 +1015,6 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int int i, nBufferSize, Pos; unsigned char * pBuffer; unsigned uLit0, uLit1, uLit; -// assert( Gia_ManIsNormalized(pInit) ); assert( pInit->nXors == 0 && pInit->nMuxes == 0 ); if ( Gia_ManCoNum(pInit) == 0 ) diff --git a/src/aig/gia/giaFadds.c b/src/aig/gia/giaFadds.c index 499a9e8f..4e913687 100644 --- a/src/aig/gia/giaFadds.c +++ b/src/aig/gia/giaFadds.c @@ -538,7 +538,7 @@ Tim_Man_t * Gia_ManGenerateTim( int nPis, int nPos, int nBoxes, int nIns, int nO curPo = 0; for ( i = 0; i < nBoxes; i++ ) { - Tim_ManCreateBox( pMan, curPo, nIns, curPi, nOuts, 0 ); + Tim_ManCreateBox( pMan, curPo, nIns, curPi, nOuts, -1 ); curPi += nOuts; curPo += nIns; } @@ -697,12 +697,12 @@ Gia_Man_t * Gia_ManDupWithFaddBoxes( Gia_Man_t * p, int nFaddMin, int fVerbose ) Gia_ManDupWithFaddBoxes_rec( pNew, p, Gia_ObjFanin0(pObj), vFadds, vMap, vChains, vMap2Chain, vTruths ); Gia_ManForEachCo( p, pObj, i ) Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); -// Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); + Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); if ( Gia_ManRegNum(p) ) { if ( fVerbose ) printf( "Warning: Sequential design is coverted into combinational one by adding white boxes.\n" ); - Gia_ManSetRegNum( pNew, 0 ); + pNew->nRegs = 0; } assert( !Gia_ManHasDangling(pNew) ); @@ -712,10 +712,6 @@ Gia_Man_t * Gia_ManDupWithFaddBoxes( Gia_Man_t * p, int nFaddMin, int fVerbose ) Vec_WecFree( vChains ); Vec_IntFree( vMap2Chain ); Vec_IntFree( vTruths ); - - // normalize - pNew = Gia_ManDupNormalize( pTemp = pNew ); - Gia_ManStop( pTemp ); // other information nBoxes = (Gia_ManCiNum(pNew) - Gia_ManCiNum(p)) / 2; @@ -723,6 +719,12 @@ Gia_Man_t * Gia_ManDupWithFaddBoxes( Gia_Man_t * p, int nFaddMin, int fVerbose ) pNew->pManTime = Gia_ManGenerateTim( Gia_ManCiNum(p), Gia_ManCoNum(p), nBoxes, 3, 2 ); pNew->pAigExtra = Gia_ManGenerateExtraAig( nBoxes, 3, 2 ); + // normalize + pNew = Gia_ManDupNormalize( pTemp = pNew ); + pNew->pManTime = pTemp->pManTime; pTemp->pManTime = NULL; + pNew->pAigExtra = pTemp->pAigExtra; pTemp->pAigExtra = NULL; + Gia_ManStop( pTemp ); + //pNew = Gia_ManDupCollapse( pTemp = pNew, pNew->pAigExtra, NULL ); //Gia_ManStop( pTemp ); diff --git a/src/aig/gia/giaTim.c b/src/aig/gia/giaTim.c index 12c379c0..e8d1c078 100644 --- a/src/aig/gia/giaTim.c +++ b/src/aig/gia/giaTim.c @@ -35,6 +35,31 @@ ABC_NAMESPACE_IMPL_START /**Function************************************************************* + Synopsis [Makes sure the manager is normalized.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Gia_ManIsNormalized( Gia_Man_t * p ) +{ + int i, nOffset; + nOffset = 1; + for ( i = 0; i < Gia_ManCiNum(p); i++ ) + if ( !Gia_ObjIsCi( Gia_ManObj(p, nOffset+i) ) ) + return 0; + nOffset = 1 + Gia_ManCiNum(p) + Gia_ManAndNum(p); + for ( i = 0; i < Gia_ManCoNum(p); i++ ) + if ( !Gia_ObjIsCo( Gia_ManObj(p, nOffset+i) ) ) + return 0; + return 1; +} + +/**Function************************************************************* + Synopsis [Duplicates AIG in the DFS order while putting CIs first.] Description [] @@ -54,8 +79,31 @@ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ) pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pSpec = Abc_UtilStrsav( p->pSpec ); Gia_ManConst0(p)->Value = 0; - Gia_ManForEachCi( p, pObj, i ) - pObj->Value = Gia_ManAppendCi(pNew); + if ( Gia_ManRegNum(p) == 0 || p->pManTime == NULL || Tim_ManBoxNum((Tim_Man_t *)p->pManTime) == 0 ) + { + Gia_ManForEachCi( p, pObj, i ) + pObj->Value = Gia_ManAppendCi(pNew); + } + else + { + // current CI order: PIs + FOs + NewCIs + // desired reorder: PIs + NewCIs + FOs + int nCIs = Tim_ManPiNum( (Tim_Man_t *)p->pManTime ); + int nAll = Tim_ManCiNum( (Tim_Man_t *)p->pManTime ); + int nPis = nCIs - Gia_ManRegNum(p); + assert( nAll == Gia_ManCiNum(p) ); + assert( nPis > 0 ); + // copy PIs first + for ( i = 0; i < nPis; i++ ) + Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); + // copy new CIs second + for ( i = nCIs; i < nAll; i++ ) + Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); + // copy flops last + for ( i = nCIs - Gia_ManRegNum(p); i < nCIs; i++ ) + Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); + printf( "Warning: Scrambling CI order in the AIG with boxes.\n" ); + } Gia_ManForEachAnd( p, pObj, i ) pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); Gia_ManForEachCo( p, pObj, i ) @@ -69,6 +117,61 @@ Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ) /**Function************************************************************* + Synopsis [Reorders flops for sequential AIGs with boxes.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Gia_Man_t * Gia_ManDupReorderInputs( Gia_Man_t * p ) +{ + Gia_Man_t * pNew; + Gia_Obj_t * pObj; + int i, nCIs, nAll, nPis; + // sanity checks + assert( Gia_ManIsNormalized(p) ); + assert( Gia_ManRegNum(p) > 0 && p->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t *)p->pManTime) > 0 ); + Gia_ManFillValue( p ); + pNew = Gia_ManStart( Gia_ManObjNum(p) ); + pNew->pName = Abc_UtilStrsav( p->pName ); + pNew->pSpec = Abc_UtilStrsav( p->pSpec ); + Gia_ManConst0(p)->Value = 0; + // change input order + // desired reorder: PIs + NewCIs + FOs + // current CI order: PIs + FOs + NewCIs + nCIs = Tim_ManPiNum( (Tim_Man_t *)p->pManTime ); + nAll = Tim_ManCiNum( (Tim_Man_t *)p->pManTime ); + nPis = nCIs - Gia_ManRegNum(p); + assert( nAll == Gia_ManCiNum(p) ); + assert( nPis > 0 ); + // copy PIs first + for ( i = 0; i < nPis; i++ ) + Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); + // copy flops second + for ( i = nAll - Gia_ManRegNum(p); i < nAll; i++ ) + Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); + // copy new CIs last + for ( i = nPis; i < nAll - Gia_ManRegNum(p); i++ ) + Gia_ManCi(p, i)->Value = Gia_ManAppendCi(pNew); + printf( "Warning: Unscrambling CI order in the AIG with boxes.\n" ); + // other things + Gia_ManForEachAnd( p, pObj, i ) + pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + Gia_ManForEachCo( p, pObj, i ) + pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); + Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); + pNew->nConstrs = p->nConstrs; + assert( Gia_ManIsNormalized(pNew) ); + Gia_ManDupRemapEquiv( pNew, p ); + return pNew; +} + + +/**Function************************************************************* + Synopsis [Find the ordering of AIG objects.] Description [] @@ -262,130 +365,6 @@ void Gia_ManCleanupRemap( Gia_Man_t * p, Gia_Man_t * pGia ) /**Function************************************************************* - Synopsis [Computes AIG with boxes.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void Gia_ManDupCollapse_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Man_t * pNew ) -{ - if ( Gia_ObjIsTravIdCurrent(p, pObj) ) - return; - Gia_ObjSetTravIdCurrent(p, pObj); - assert( Gia_ObjIsAnd(pObj) ); - if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) ) - Gia_ManDupCollapse_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)), pNew ); - Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); - Gia_ManDupCollapse_rec( p, Gia_ObjFanin1(pObj), pNew ); -// assert( !~pObj->Value ); - pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); - if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) ) - pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value); -} -Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * vBoxPres ) -{ - Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime; - Gia_Man_t * pNew, * pTemp; - Gia_Obj_t * pObj, * pObjBox; - int i, k, curCi, curCo; - //assert( Gia_ManRegNum(p) == 0 ); - assert( Gia_ManCiNum(p) == Tim_ManPiNum(pManTime) + Gia_ManCoNum(pBoxes) ); - pNew = Gia_ManStart( Gia_ManObjNum(p) ); - pNew->pName = Abc_UtilStrsav( p->pName ); - pNew->pSpec = Abc_UtilStrsav( p->pSpec ); - if ( Gia_ManHasChoices(p) ) - pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) ); - Gia_ManHashAlloc( pNew ); - // copy const and real PIs - Gia_ManFillValue( p ); - Gia_ManConst0(p)->Value = 0; - Gia_ManIncrementTravId( p ); - Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) ); - for ( i = 0; i < Tim_ManPiNum(pManTime); i++ ) - { - pObj = Gia_ManCi( p, i ); - pObj->Value = Gia_ManAppendCi(pNew); - Gia_ObjSetTravIdCurrent( p, pObj ); - } - // create logic for each box - curCi = Tim_ManPiNum(pManTime); - curCo = 0; - for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ ) - { - // clean boxes - Gia_ManIncrementTravId( pBoxes ); - Gia_ObjSetTravIdCurrent( pBoxes, Gia_ManConst0(pBoxes) ); - Gia_ManConst0(pBoxes)->Value = 0; - // add internal nodes - if ( Tim_ManBoxIsBlack(pManTime, i) ) - { - int fSkip = (vBoxPres != NULL && !Vec_IntEntry(vBoxPres, i)); - for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ ) - { - pObj = Gia_ManCo( p, curCo + k ); - Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); - pObj->Value = fSkip ? -1 : Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); - } - for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ ) - { - pObj = Gia_ManCi( p, curCi + k ); - pObj->Value = fSkip ? 0 : Gia_ManAppendCi(pNew); - Gia_ObjSetTravIdCurrent( p, pObj ); - } - } - else - { - for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ ) - { - // build logic - pObj = Gia_ManCo( p, curCo + k ); - Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); - // transfer to the PI - pObjBox = Gia_ManCi( pBoxes, k ); - pObjBox->Value = Gia_ObjFanin0Copy(pObj); - Gia_ObjSetTravIdCurrent( pBoxes, pObjBox ); - } - for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ ) - { - // build logic - pObjBox = Gia_ManCo( pBoxes, curCi - Tim_ManPiNum(pManTime) + k ); - Gia_ManDupCollapse_rec( pBoxes, Gia_ObjFanin0(pObjBox), pNew ); - // transfer to the PI - pObj = Gia_ManCi( p, curCi + k ); - pObj->Value = Gia_ObjFanin0Copy(pObjBox); - Gia_ObjSetTravIdCurrent( p, pObj ); - } - } - curCo += Tim_ManBoxInputNum(pManTime, i); - curCi += Tim_ManBoxOutputNum(pManTime, i); - } - // add remaining nodes - for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ ) - { - pObj = Gia_ManCo( p, i ); - Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); - pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); - } - curCo += Tim_ManPoNum(pManTime); - // verify counts - assert( curCi == Gia_ManCiNum(p) ); - assert( curCo == Gia_ManCoNum(p) ); - Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); - Gia_ManHashStop( pNew ); - pNew = Gia_ManCleanup( pTemp = pNew ); - Gia_ManCleanupRemap( p, pTemp ); - Gia_ManStop( pTemp ); - assert( Tim_ManPoNum(pManTime) == Gia_ManCoNum(pNew) ); - assert( Tim_ManPiNum(pManTime) == Gia_ManCiNum(pNew) ); - return pNew; -} - -/**Function************************************************************* - Synopsis [Computes level with boxes.] Description [] @@ -590,6 +569,207 @@ int Gia_ManLutLevelWithBoxes( Gia_Man_t * p ) /**Function************************************************************* + Synopsis [Update hierarchy/timing manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres ) +{ + Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime; + assert( pManTime != NULL ); + assert( Tim_ManBoxNum(pManTime) == Vec_IntSize(vBoxPres) ); + return Tim_ManTrim( pManTime, vBoxPres ); +} + +/**Function************************************************************* + + Synopsis [Update AIG of the holes.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Gia_Man_t * Gia_ManUpdateExtraAig( void * pTime, Gia_Man_t * p, Vec_Int_t * vBoxPres ) +{ + Gia_Man_t * pNew = NULL; + Tim_Man_t * pManTime = (Tim_Man_t *)pTime; + Vec_Int_t * vOutPres = Vec_IntAlloc( 100 ); + int i, k, curPo = 0; + assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) ); + assert( Gia_ManCoNum(p) == Tim_ManCiNum(pManTime) - Tim_ManPiNum(pManTime) ); + for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ ) + { + for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ ) + Vec_IntPush( vOutPres, Vec_IntEntry(vBoxPres, i) ); + curPo += Tim_ManBoxOutputNum(pManTime, i); + } + assert( curPo == Gia_ManCoNum(p) ); +// if ( Vec_IntSize(vOutPres) > 0 ) + pNew = Gia_ManDupOutputVec( p, vOutPres ); + Vec_IntFree( vOutPres ); + return pNew; +} + +/**Function************************************************************* + + Synopsis [Computes AIG with boxes.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Gia_ManDupCollapse_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Man_t * pNew ) +{ + if ( Gia_ObjIsTravIdCurrent(p, pObj) ) + return; + Gia_ObjSetTravIdCurrent(p, pObj); + assert( Gia_ObjIsAnd(pObj) ); + if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) ) + Gia_ManDupCollapse_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)), pNew ); + Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); + Gia_ManDupCollapse_rec( p, Gia_ObjFanin1(pObj), pNew ); +// assert( !~pObj->Value ); + pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) ) + pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value); +} +Gia_Man_t * Gia_ManDupCollapseInt( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * vBoxPres ) +{ + Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime; + Gia_Man_t * pNew, * pTemp; + Gia_Obj_t * pObj, * pObjBox; + int i, k, curCi, curCo; + assert( Gia_ManRegNum(p) == 0 ); + assert( Gia_ManCiNum(p) == Tim_ManPiNum(pManTime) + Gia_ManCoNum(pBoxes) ); + pNew = Gia_ManStart( Gia_ManObjNum(p) ); + pNew->pName = Abc_UtilStrsav( p->pName ); + pNew->pSpec = Abc_UtilStrsav( p->pSpec ); + if ( Gia_ManHasChoices(p) ) + pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) ); + Gia_ManHashAlloc( pNew ); + // copy const and real PIs + Gia_ManFillValue( p ); + Gia_ManConst0(p)->Value = 0; + Gia_ManIncrementTravId( p ); + Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) ); + for ( i = 0; i < Tim_ManPiNum(pManTime); i++ ) + { + pObj = Gia_ManCi( p, i ); + pObj->Value = Gia_ManAppendCi(pNew); + Gia_ObjSetTravIdCurrent( p, pObj ); + } + // create logic for each box + curCi = Tim_ManPiNum(pManTime); + curCo = 0; + for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ ) + { + // clean boxes + Gia_ManIncrementTravId( pBoxes ); + Gia_ObjSetTravIdCurrent( pBoxes, Gia_ManConst0(pBoxes) ); + Gia_ManConst0(pBoxes)->Value = 0; + // add internal nodes + if ( Tim_ManBoxIsBlack(pManTime, i) ) + { + int fSkip = (vBoxPres != NULL && !Vec_IntEntry(vBoxPres, i)); + for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ ) + { + pObj = Gia_ManCo( p, curCo + k ); + Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); + pObj->Value = fSkip ? -1 : Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); + } + for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ ) + { + pObj = Gia_ManCi( p, curCi + k ); + pObj->Value = fSkip ? 0 : Gia_ManAppendCi(pNew); + Gia_ObjSetTravIdCurrent( p, pObj ); + } + } + else + { + for ( k = 0; k < Tim_ManBoxInputNum(pManTime, i); k++ ) + { + // build logic + pObj = Gia_ManCo( p, curCo + k ); + Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); + // transfer to the PI + pObjBox = Gia_ManCi( pBoxes, k ); + pObjBox->Value = Gia_ObjFanin0Copy(pObj); + Gia_ObjSetTravIdCurrent( pBoxes, pObjBox ); + } + for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ ) + { + // build logic + pObjBox = Gia_ManCo( pBoxes, curCi - Tim_ManPiNum(pManTime) + k ); + Gia_ManDupCollapse_rec( pBoxes, Gia_ObjFanin0(pObjBox), pNew ); + // transfer to the PI + pObj = Gia_ManCi( p, curCi + k ); + pObj->Value = Gia_ObjFanin0Copy(pObjBox); + Gia_ObjSetTravIdCurrent( p, pObj ); + } + } + curCo += Tim_ManBoxInputNum(pManTime, i); + curCi += Tim_ManBoxOutputNum(pManTime, i); + } + // add remaining nodes + for ( i = Tim_ManCoNum(pManTime) - Tim_ManPoNum(pManTime); i < Tim_ManCoNum(pManTime); i++ ) + { + pObj = Gia_ManCo( p, i ); + Gia_ManDupCollapse_rec( p, Gia_ObjFanin0(pObj), pNew ); + pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); + } + curCo += Tim_ManPoNum(pManTime); + // verify counts + assert( curCi == Gia_ManCiNum(p) ); + assert( curCo == Gia_ManCoNum(p) ); + Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); + Gia_ManHashStop( pNew ); + pNew = Gia_ManCleanup( pTemp = pNew ); + Gia_ManCleanupRemap( p, pTemp ); + Gia_ManStop( pTemp ); + assert( Tim_ManPoNum(pManTime) == Gia_ManCoNum(pNew) ); + assert( Tim_ManPiNum(pManTime) == Gia_ManCiNum(pNew) ); + return pNew; +} +Gia_Man_t * Gia_ManDupCollapse( Gia_Man_t * p, Gia_Man_t * pBoxes, Vec_Int_t * vBoxPres ) +{ + Gia_Man_t * pRes, * pTemp; + int nFlops = Gia_ManRegNum(p); + if ( Gia_ManRegNum(p) == 0 || p->pManTime == NULL || Tim_ManBoxNum((Tim_Man_t *)p->pManTime) == 0 ) + { + p->nRegs = 0; + pRes = Gia_ManDupCollapseInt( p, pBoxes, vBoxPres ); + Gia_ManSetRegNum( p, nFlops ); + } + else + { + pTemp = Gia_ManDupReorderInputs( p ); + pTemp->nRegs = 0; + + pTemp->pManTime = p->pManTime; p->pManTime = NULL; + pTemp->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; + pRes = Gia_ManDupCollapseInt( pTemp, pBoxes, vBoxPres ); + p->pManTime = pTemp->pManTime; pTemp->pManTime = NULL; + p->pAigExtra = pTemp->pAigExtra; pTemp->pAigExtra = NULL; + + Gia_ManStop( pTemp ); + } + Gia_ManSetRegNum( pRes, nFlops ); + return pRes; +} + +/**Function************************************************************* + Synopsis [Verify XAIG against its spec.] Description [] @@ -599,13 +779,13 @@ int Gia_ManLutLevelWithBoxes( Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ -int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit ) +int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit, char * pFileSpec ) { int fVerbose = 1; int Status = -1; Gia_Man_t * pSpec, * pGia0, * pGia1, * pMiter; Vec_Int_t * vBoxPres = NULL; - if ( pGia->pSpec == NULL ) + if ( pFileSpec == NULL && pGia->pSpec == NULL ) { printf( "Spec file is not given. Use standard flow.\n" ); return Status; @@ -621,7 +801,7 @@ int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit ) return Status; } // read original AIG - pSpec = Gia_AigerRead( pGia->pSpec, 0, 0 ); + pSpec = Gia_AigerRead( pFileSpec ? pFileSpec : pGia->pSpec, 0, 0 ); if ( pSpec->pManTime == NULL ) { printf( "Spec has no tim manager. Use standard flow.\n" ); @@ -677,57 +857,6 @@ int Gia_ManVerifyWithBoxes( Gia_Man_t * pGia, void * pParsInit ) return Status; } -/**Function************************************************************* - - Synopsis [Update hierarchy/timing manager.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void * Gia_ManUpdateTimMan( Gia_Man_t * p, Vec_Int_t * vBoxPres ) -{ - Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime; - assert( pManTime != NULL ); - assert( Tim_ManBoxNum(pManTime) == Vec_IntSize(vBoxPres) ); - return Tim_ManTrim( pManTime, vBoxPres ); -} - -/**Function************************************************************* - - Synopsis [Update AIG of the holes.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Gia_Man_t * Gia_ManUpdateExtraAig( void * pTime, Gia_Man_t * p, Vec_Int_t * vBoxPres ) -{ - Gia_Man_t * pNew = NULL; - Tim_Man_t * pManTime = (Tim_Man_t *)pTime; - Vec_Int_t * vOutPres = Vec_IntAlloc( 100 ); - int i, k, curPo = 0; - assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(pManTime) ); - assert( Gia_ManCoNum(p) == Tim_ManCiNum(pManTime) - Tim_ManPiNum(pManTime) ); - for ( i = 0; i < Tim_ManBoxNum(pManTime); i++ ) - { - for ( k = 0; k < Tim_ManBoxOutputNum(pManTime, i); k++ ) - Vec_IntPush( vOutPres, Vec_IntEntry(vBoxPres, i) ); - curPo += Tim_ManBoxOutputNum(pManTime, i); - } - assert( curPo == Gia_ManCoNum(p) ); -// if ( Vec_IntSize(vOutPres) > 0 ) - pNew = Gia_ManDupOutputVec( p, vOutPres ); - Vec_IntFree( vOutPres ); - return pNew; -} - //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c index 7983f107..13685eca 100644 --- a/src/aig/gia/giaUtil.c +++ b/src/aig/gia/giaUtil.c @@ -842,31 +842,6 @@ int Gia_ManCrossCut( Gia_Man_t * p, int fReverse ) return nCutMax; } -/**Function************************************************************* - - Synopsis [Makes sure the manager is normalized.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Gia_ManIsNormalized( Gia_Man_t * p ) -{ - int i, nOffset; - nOffset = 1; - for ( i = 0; i < Gia_ManCiNum(p); i++ ) - if ( !Gia_ObjIsCi( Gia_ManObj(p, nOffset+i) ) ) - return 0; - nOffset = 1 + Gia_ManCiNum(p) + Gia_ManAndNum(p); - for ( i = 0; i < Gia_ManCoNum(p); i++ ) - if ( !Gia_ObjIsCo( Gia_ManObj(p, nOffset+i) ) ) - return 0; - return 1; -} - /**Function************************************************************* diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 7d457187..051c1aae 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -26474,11 +26474,7 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) } else if ( fCollapse && pAbc->pGia->pAigExtra ) { - Gia_Man_t * pNew = Gia_ManDupUnnormalize( pAbc->pGia ); - pNew->pManTime = pAbc->pGia->pManTime; - pTemp = Gia_ManDupCollapse( pNew, pAbc->pGia->pAigExtra, NULL ); - pNew->pManTime = NULL; - Gia_ManStop( pNew ); + pTemp = Gia_ManDupCollapse( pAbc->pGia, pAbc->pGia->pAigExtra, NULL ); if ( !Abc_FrameReadFlag("silentmode") ) printf( "Collapsed AIG with boxes and logic of the boxes.\n" ); } @@ -26494,7 +26490,8 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_FrameReadFlag("silentmode") ) printf( "Rehashed the current AIG.\n" ); } - Gia_ManTransferTiming( pTemp, pAbc->pGia ); + if ( !(fCollapse && pAbc->pGia->pAigExtra) ) + Gia_ManTransferTiming( pTemp, pAbc->pGia ); Abc_FrameUpdateGia( pAbc, pTemp ); return 0; @@ -30662,6 +30659,7 @@ usage: ***********************************************************************/ int Abc_CommandAbc9Verify( Abc_Frame_t * pAbc, int argc, char ** argv ) { + char * pFileSpec = NULL; Cec_ParCec_t ParsCec, * pPars = &ParsCec; int c; Cec_ManCecSetDefaultParams( pPars ); @@ -30701,16 +30699,23 @@ int Abc_CommandAbc9Verify( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - Gia_ManVerifyWithBoxes( pAbc->pGia, pPars ); + if ( argc == globalUtilOptind + 1 ) + { + pFileSpec = argv[globalUtilOptind]; + Extra_FileNameCorrectPath( pFileSpec ); + printf( "Taking spec from file \"%s\".\n", pFileSpec ); + } + Gia_ManVerifyWithBoxes( pAbc->pGia, pPars, pFileSpec ); return 0; usage: - Abc_Print( -2, "usage: &verify [-CT num] [-vh]\n" ); + Abc_Print( -2, "usage: &verify [-CT num] [-vh] <file>\n" ); Abc_Print( -2, "\t performs verification of combinational design\n" ); Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes":"no"); Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : optional file name with the spec [default = not used\n" ); return 1; } diff --git a/src/base/wlc/wlc.h b/src/base/wlc/wlc.h index a485873c..26e1c3d5 100644 --- a/src/base/wlc/wlc.h +++ b/src/base/wlc/wlc.h @@ -204,6 +204,8 @@ static inline Wlc_Obj_t * Wlc_ObjFoToFi( Wlc_Ntk_t * p, Wlc_Obj_t * pObj ) #define Wlc_NtkForEachObj( p, pObj, i ) \ for ( i = 1; (i < Wlc_NtkObjNumMax(p)) && (((pObj) = Wlc_NtkObj(p, i)), 1); i++ ) +#define Wlc_NtkForEachObjVec( vVec, p, pObj, i ) \ + for ( i = 0; (i < Vec_IntSize(vVec)) && (((pObj) = Wlc_NtkObj(p, Vec_IntEntry(vVec, i))), 1); i++ ) #define Wlc_NtkForEachPi( p, pPi, i ) \ for ( i = 0; (i < Wlc_NtkPiNum(p)) && (((pPi) = Wlc_NtkPi(p, i)), 1); i++ ) #define Wlc_NtkForEachPo( p, pPo, i ) \ @@ -226,7 +228,7 @@ static inline Wlc_Obj_t * Wlc_ObjFoToFi( Wlc_Ntk_t * p, Wlc_Obj_t * pObj ) //////////////////////////////////////////////////////////////////////// /*=== wlcBlast.c ========================================================*/ -extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p ); +extern Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds ); /*=== wlcNtk.c ========================================================*/ extern Wlc_Ntk_t * Wlc_NtkAlloc( char * pName, int nObjsAlloc ); extern int Wlc_ObjAlloc( Wlc_Ntk_t * p, int Type, int Signed, int End, int Beg ); @@ -240,6 +242,7 @@ extern void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type ); extern void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fVerbose ); extern Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p ); extern void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p ); +extern Vec_Int_t * Wlc_NtkCollectMultipliers( Wlc_Ntk_t * p ); /*=== wlcReadWord.c ========================================================*/ extern Wlc_Ntk_t * Wlc_ReadVer( char * pFileName ); /*=== wlcWriteWord.c ========================================================*/ diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c index 94d04760..bf9ff8a3 100644 --- a/src/base/wlc/wlcBlast.c +++ b/src/base/wlc/wlcBlast.c @@ -19,6 +19,7 @@ ***********************************************************************/ #include "wlc.h" +#include "misc/tim/tim.h" ABC_NAMESPACE_IMPL_START @@ -377,32 +378,64 @@ void Wlc_BlastTable( Gia_Man_t * pNew, word * pTable, int * pFans, int nFans, in SeeAlso [] ***********************************************************************/ -Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p ) +Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Vec_Int_t * vBoxIds ) { int fVerbose = 0; - Gia_Man_t * pTemp, * pNew; + Tim_Man_t * pManTime = NULL; + Gia_Man_t * pTemp, * pNew, * pExtra = NULL; Wlc_Obj_t * pObj, * pPrev = NULL; Vec_Int_t * vBits, * vTemp0, * vTemp1, * vTemp2, * vRes; int nBits = Wlc_NtkPrepareBits( p ); int nRange, nRange0, nRange1, nRange2; - int i, k, b, iFanin, iLit, * pFans0, * pFans1, * pFans2; - int nFFins = 0, nFFouts = 0; + int i, k, b, iFanin, iLit, nAndPrev, * pFans0, * pFans1, * pFans2; + int nFFins = 0, nFFouts = 0, curPi = 0, curPo = 0; + int nBitCis = 0, nBitCos = 0; vBits = Vec_IntAlloc( nBits ); vTemp0 = Vec_IntAlloc( 1000 ); vTemp1 = Vec_IntAlloc( 1000 ); vTemp2 = Vec_IntAlloc( 1000 ); vRes = Vec_IntAlloc( 1000 ); + // clean AND-gate counters + memset( p->nAnds, 0, sizeof(int) * WLC_OBJ_NUMBER ); // create AIG manager pNew = Gia_ManStart( 5 * Wlc_NtkObjNum(p) + 1000 ); pNew->pName = Abc_UtilStrsav( p->pName ); Gia_ManHashAlloc( pNew ); - // clean AND-gate counters - memset( p->nAnds, 0, sizeof(int) * WLC_OBJ_NUMBER ); - // create primary inputs + // prepare for AIG with boxes + if ( vBoxIds ) + { + int nNewCis = 0, nNewCos = 0; + Wlc_NtkForEachObj( p, pObj, i ) + pObj->Mark = 0; + // count bit-width of regular CIs/COs + Wlc_NtkForEachCi( p, pObj, i ) + nBitCis += Wlc_ObjRange( pObj ); + Wlc_NtkForEachCo( p, pObj, i ) + nBitCos += Wlc_ObjRange( pObj ); + // count bit-width of additional CIs/COs due to selected multipliers + assert( Vec_IntSize(vBoxIds) > 0 ); + Wlc_NtkForEachObjVec( vBoxIds, p, pObj, i ) + { + // currently works only for multipliers + assert( pObj->Type == WLC_OBJ_ARI_MULTI ); + nNewCis += Wlc_ObjRange( pObj ); + nNewCos += Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) ); + nNewCos += Wlc_ObjRange( Wlc_ObjFanin1(p, pObj) ); + pObj->Mark = 1; + } + // create hierarchy manager + pManTime = Tim_ManStart( nBitCis + nNewCis, nBitCos + nNewCos ); + curPi = nBitCis; + curPo = 0; + // create AIG manager for logic of the boxes + pExtra = Gia_ManStart( Wlc_NtkObjNum(p) ); + Gia_ManHashAlloc( pExtra ); + } + // blast in the topological order Wlc_NtkForEachObj( p, pObj, i ) { // char * pName = Wlc_ObjName(p, i); - int nAndPrev = Gia_ManAndNum(pNew); + nAndPrev = Gia_ManAndNum(pNew); nRange = Wlc_ObjRange( pObj ); nRange0 = Wlc_ObjFaninNum(pObj) > 0 ? Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) ) : -1; nRange1 = Wlc_ObjFaninNum(pObj) > 1 ? Wlc_ObjRange( Wlc_ObjFanin1(p, pObj) ) : -1; @@ -412,7 +445,52 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p ) pFans2 = Wlc_ObjFaninNum(pObj) > 2 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId2(pObj)) ) : NULL; Vec_IntClear( vRes ); assert( nRange > 0 ); - if ( Wlc_ObjIsCi(pObj) ) + if ( vBoxIds && pObj->Mark ) + { + pObj->Mark = 0; + + // create new box + Tim_ManCreateBox( pManTime, curPo, nRange0 + nRange1, curPi, nRange, -1 ); + curPi += nRange; + curPo += nRange0 + nRange1; + + // create combinational outputs in the normal manager + for ( k = 0; k < nRange0; k++ ) + Gia_ManAppendCo( pNew, pFans0[k] ); + for ( k = 0; k < nRange1; k++ ) + Gia_ManAppendCo( pNew, pFans1[k] ); + + // make sure there is enough primary inputs in the manager + for ( k = Gia_ManPiNum(pExtra); k < nRange0 + nRange1; k++ ) + Gia_ManAppendCi( pExtra ); + // create combinational inputs + Vec_IntClear( vTemp0 ); + for ( k = 0; k < nRange0; k++ ) + Vec_IntPush( vTemp0, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, k)) ); + Vec_IntClear( vTemp1 ); + for ( k = 0; k < nRange1; k++ ) + Vec_IntPush( vTemp1, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange0+k)) ); + // get new fanin arrays + pFans0 = Vec_IntArray( vTemp0 ); + pFans1 = Vec_IntArray( vTemp1 ); + // bit-blast the multiplier in the external manager + { + int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) ); + int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed && Wlc_ObjFanin1(p, pObj)->Signed ); + int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed && Wlc_ObjFanin1(p, pObj)->Signed ); + Wlc_BlastMultiplier( pExtra, pArg0, pArg1, nRange, vTemp2, vRes ); + Vec_IntShrink( vRes, nRange ); + } + // create outputs in the external manager + for ( k = 0; k < nRange; k++ ) + Gia_ManAppendCo( pExtra, Vec_IntEntry(vRes, k) ); + + // create combinational inputs in the normal manager + Vec_IntClear( vRes ); + for ( k = 0; k < nRange; k++ ) + Vec_IntPush( vRes, Gia_ManAppendCi(pNew) ); + } + else if ( Wlc_ObjIsCi(pObj) ) { for ( k = 0; k < nRange; k++ ) Vec_IntPush( vRes, Gia_ManAppendCi(pNew) ); @@ -664,9 +742,27 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p ) // set the number of registers assert( nFFins == nFFouts ); Gia_ManSetRegNum( pNew, nFFins ); - // finalize and cleanup + // finalize AIG pNew = Gia_ManCleanup( pTemp = pNew ); Gia_ManStop( pTemp ); + // finalize AIG with boxes + if ( vBoxIds ) + { + curPo += nBitCos; + assert( curPi == Tim_ManCiNum(pManTime) ); + assert( curPo == Tim_ManCoNum(pManTime) ); + // normalize AIG + pNew = Gia_ManDupNormalize( pTemp = pNew ); + Gia_ManStop( pTemp ); + // finalize the extra AIG + pExtra = Gia_ManCleanup( pTemp = pExtra ); + Gia_ManStop( pTemp ); + assert( Gia_ManPoNum(pExtra) == Gia_ManPiNum(pNew) - nBitCis ); + // attach + pNew->pAigExtra = pExtra; + pNew->pManTime = pManTime; + //Tim_ManPrint( pManTime ); + } return pNew; } diff --git a/src/base/wlc/wlcCom.c b/src/base/wlc/wlcCom.c index 0a8b90e0..5c786838 100644 --- a/src/base/wlc/wlcCom.c +++ b/src/base/wlc/wlcCom.c @@ -269,13 +269,17 @@ usage: int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) { Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc); + Vec_Int_t * vBoxIds = NULL; Gia_Man_t * pNew = NULL; - int c, fVerbose = 0; + int c, fMulti = 0, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "mvh" ) ) != EOF ) { switch ( c ) { + case 'm': + fMulti ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -290,8 +294,15 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( 1, "Abc_CommandBlast(): There is no current design.\n" ); return 0; } + if ( fMulti ) + { + vBoxIds = Wlc_NtkCollectMultipliers( pNtk ); + if ( vBoxIds == NULL ) + Abc_Print( 1, "Warning: There is no multipliers in the design.\n" ); + } // transform - pNew = Wlc_NtkBitBlast( pNtk ); + pNew = Wlc_NtkBitBlast( pNtk, vBoxIds ); + Vec_IntFreeP( &vBoxIds ); if ( pNew == NULL ) { Abc_Print( 1, "Abc_CommandBlast(): Bit-blasting has failed.\n" ); @@ -300,8 +311,9 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_FrameUpdateGia( pAbc, pNew ); return 0; usage: - Abc_Print( -2, "usage: %%blast [-vh]\n" ); + Abc_Print( -2, "usage: %%blast [-mvh]\n" ); Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" ); + Abc_Print( -2, "\t-m : toggle creating boxes for all multipliers in the design [default = %s]\n", fMulti? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; diff --git a/src/base/wlc/wlcNtk.c b/src/base/wlc/wlcNtk.c index 55448c11..9f779a2e 100644 --- a/src/base/wlc/wlcNtk.c +++ b/src/base/wlc/wlcNtk.c @@ -473,6 +473,30 @@ void Wlc_NtkTransferNames( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p ) pNew->vTables = p->vTables; p->vTables = NULL; } +/**Function************************************************************* + + Synopsis [Collect IDs of the multipliers.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Int_t * Wlc_NtkCollectMultipliers( Wlc_Ntk_t * p ) +{ + Wlc_Obj_t * pObj; int i; + Vec_Int_t * vBoxIds = Vec_IntAlloc( 100 ); + Wlc_NtkForEachObj( p, pObj, i ) + if ( pObj->Type == WLC_OBJ_ARI_MULTI ) + Vec_IntPush( vBoxIds, i ); + if ( Vec_IntSize( vBoxIds ) > 0 ) + return vBoxIds; + Vec_IntFree( vBoxIds ); + return NULL; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/base/wlc/wlcReadVer.c b/src/base/wlc/wlcReadVer.c index ac3cfaee..6000549f 100644 --- a/src/base/wlc/wlcReadVer.c +++ b/src/base/wlc/wlcReadVer.c @@ -1118,7 +1118,7 @@ void Io_ReadWordTest( char * pFileName ) return; Wlc_WriteVer( pNtk, "test.v" ); - pNew = Wlc_NtkBitBlast( pNtk ); + pNew = Wlc_NtkBitBlast( pNtk, NULL ); Gia_AigerWrite( pNew, "test.aig", 0, 0 ); Gia_ManStop( pNew ); diff --git a/src/misc/tim/timMan.c b/src/misc/tim/timMan.c index 93c69146..c3caf4dc 100644 --- a/src/misc/tim/timMan.c +++ b/src/misc/tim/timMan.c @@ -316,7 +316,7 @@ void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * float * pTable; int i, k; assert( p->vDelayTables == NULL ); - p->vDelayTables = Vec_PtrStart( Vec_PtrSize(pLibBox->vBoxes) ); + p->vDelayTables = pLibBox ? Vec_PtrStart( Vec_PtrSize(pLibBox->vBoxes) ) : Vec_PtrAlloc( 100 ); if ( p->vBoxes ) Tim_ManForEachBox( p, pBox, i ) { @@ -445,10 +445,10 @@ void Tim_ManPrint( Tim_Man_t * p ) if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq ) break; if ( i == Tim_ManCiNum(p) ) - printf( "All PIs : arr = %5.3f req = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); + printf( "All PIs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); else Tim_ManForEachPi( p, pObj, i ) - printf( "PI%5d : arr = %5.3f req = %5.3f\n", i, pObj->timeArr, pObj->timeReq ); + printf( "PI%5d : arrival = %5.3f required = %5.3f\n", i, pObj->timeArr, pObj->timeReq ); // print CO info pPrev = p->pCos; @@ -456,12 +456,12 @@ void Tim_ManPrint( Tim_Man_t * p ) if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq ) break; if ( i == Tim_ManCoNum(p) ) - printf( "All POs : arr = %5.3f req = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); + printf( "All POs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); else { int k = 0; Tim_ManForEachPo( p, pObj, i ) - printf( "PO%5d : arr = %5.3f req = %5.3f\n", k++, pObj->timeArr, pObj->timeReq ); + printf( "PO%5d : arrival = %5.3f required = %5.3f\n", k++, pObj->timeArr, pObj->timeReq ); } // print box info @@ -479,10 +479,10 @@ void Tim_ManPrint( Tim_Man_t * p ) if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq ) break; if ( k == Tim_ManBoxInputNum(p, pBox->iBox) ) - printf( "Box inputs : arr = %5.3f req = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); + printf( "Box inputs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); else Tim_ManBoxForEachInput( p, pBox, pObj, k ) - printf( "box-in%4d : arr = %5.3f req = %5.3f\n", k, pObj->timeArr, pObj->timeReq ); + printf( "box-in%4d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq ); // print box outputs pPrev = Tim_ManBoxOutput( p, pBox, 0 ); @@ -490,10 +490,10 @@ void Tim_ManPrint( Tim_Man_t * p ) if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq ) break; if ( k == Tim_ManBoxOutputNum(p, pBox->iBox) ) - printf( "Box outputs : arr = %5.3f req = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); + printf( "Box outputs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq ); else Tim_ManBoxForEachOutput( p, pBox, pObj, k ) - printf( "box-out%3d : arr = %5.3f req = %5.3f\n", k, pObj->timeArr, pObj->timeReq ); + printf( "box-out%3d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq ); if ( i > 2 ) break; |