diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-24 19:29:42 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-24 19:29:42 -0800 |
commit | 6ed334d41baf90f73b2c3278853ce4b08c8fb08e (patch) | |
tree | 226fd3e24899e26305c1aa37656b4b2c262eddc8 /src/misc | |
parent | 8feac565092020a23a5789a530d94a2168e6ddcd (diff) | |
download | abc-6ed334d41baf90f73b2c3278853ce4b08c8fb08e.tar.gz abc-6ed334d41baf90f73b2c3278853ce4b08c8fb08e.tar.bz2 abc-6ed334d41baf90f73b2c3278853ce4b08c8fb08e.zip |
Improvements to handling boxes and flops.
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/tim/tim.h | 4 | ||||
-rw-r--r-- | src/misc/tim/timBox.c | 32 | ||||
-rw-r--r-- | src/misc/tim/timMan.c | 22 |
3 files changed, 47 insertions, 11 deletions
diff --git a/src/misc/tim/tim.h b/src/misc/tim/tim.h index df69ae36..04ef6706 100644 --- a/src/misc/tim/tim.h +++ b/src/misc/tim/tim.h @@ -114,7 +114,9 @@ extern void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, i extern int Tim_ManBoxForCi( Tim_Man_t * p, int iCo ); extern int Tim_ManBoxForCo( Tim_Man_t * p, int iCi ); extern int Tim_ManBoxInputFirst( Tim_Man_t * p, int iBox ); +extern int Tim_ManBoxInputLast( Tim_Man_t * p, int iBox ); extern int Tim_ManBoxOutputFirst( Tim_Man_t * p, int iBox ); +extern int Tim_ManBoxOutputLast( Tim_Man_t * p, int iBox ); extern int Tim_ManBoxInputNum( Tim_Man_t * p, int iBox ); extern int Tim_ManBoxOutputNum( Tim_Man_t * p, int iBox ); extern int Tim_ManBoxDelayTableId( Tim_Man_t * p, int iBox ); @@ -130,7 +132,7 @@ extern Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly ); extern Tim_Man_t * Tim_ManStart( int nCis, int nCos ); extern Tim_Man_t * Tim_ManDup( Tim_Man_t * p, int fUnitDelay ); extern Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres ); -extern Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft ); +extern Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft, int nTermsDiff ); extern Vec_Int_t * Tim_ManAlignTwo( Tim_Man_t * pSpec, Tim_Man_t * pImpl ); extern void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * vOutReqs ); extern float * Tim_ManGetArrTimes( Tim_Man_t * p ); diff --git a/src/misc/tim/timBox.c b/src/misc/tim/timBox.c index bff7b39c..a1526673 100644 --- a/src/misc/tim/timBox.c +++ b/src/misc/tim/timBox.c @@ -126,6 +126,22 @@ int Tim_ManBoxInputFirst( Tim_Man_t * p, int iBox ) /**Function************************************************************* + Synopsis [Returns the last input of the box.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Tim_ManBoxInputLast( Tim_Man_t * p, int iBox ) +{ + return Tim_ManBox(p, iBox)->Inouts[0] + Tim_ManBoxInputNum(p, iBox) - 1; +} + +/**Function************************************************************* + Synopsis [Returns the first output of the box.] Description [] @@ -142,6 +158,22 @@ int Tim_ManBoxOutputFirst( Tim_Man_t * p, int iBox ) /**Function************************************************************* + Synopsis [Returns the last output of the box.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Tim_ManBoxOutputLast( Tim_Man_t * p, int iBox ) +{ + return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs] + Tim_ManBoxOutputNum(p, iBox) - 1; +} + +/**Function************************************************************* + Synopsis [Returns the number of box inputs.] Description [] diff --git a/src/misc/tim/timMan.c b/src/misc/tim/timMan.c index f6b97fe6..27dd8bdb 100644 --- a/src/misc/tim/timMan.c +++ b/src/misc/tim/timMan.c @@ -248,25 +248,27 @@ Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres ) SeeAlso [] ***********************************************************************/ -Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft ) +Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft, int nTermsDiff ) { Tim_Man_t * pNew; Tim_Box_t * pBox; Tim_Obj_t * pObj; float * pDelayTable, * pDelayTableNew; int i, k, iBox, nNewCis, nNewCos, nInputs, nOutputs; + int nNewPiNum = Tim_ManPiNum(p) - nTermsDiff; + int nNewPoNum = Tim_ManPoNum(p) - nTermsDiff; assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(p) ); // count the number of CIs and COs in the trimmed manager - nNewCis = Tim_ManPiNum(p); - nNewCos = Tim_ManPoNum(p); + nNewCis = nNewPiNum; + nNewCos = nNewPoNum; Vec_IntForEachEntry( vBoxesLeft, iBox, i ) { pBox = Tim_ManBox( p, iBox ); nNewCis += pBox->nOutputs; nNewCos += pBox->nInputs; } - assert( nNewCis <= Tim_ManCiNum(p) ); - assert( nNewCos <= Tim_ManCoNum(p) ); + assert( nNewCis <= Tim_ManCiNum(p) - nTermsDiff ); + assert( nNewCos <= Tim_ManCoNum(p) - nTermsDiff ); // clear traversal IDs Tim_ManForEachCi( p, pObj, i ) pObj->TravId = 0; @@ -275,10 +277,10 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft ) // create new manager pNew = Tim_ManStart( nNewCis, nNewCos ); // copy box connectivity information - memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * Tim_ManPiNum(p) ); - memcpy( pNew->pCos + nNewCos - Tim_ManPoNum(p), + memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * nNewPiNum ); + memcpy( pNew->pCos + nNewCos - nNewPoNum, p->pCos + Tim_ManCoNum(p) - Tim_ManPoNum(p), - sizeof(Tim_Obj_t) * Tim_ManPoNum(p) ); + sizeof(Tim_Obj_t) * nNewPoNum ); // duplicate delay tables if ( Tim_ManDelayTableNum(p) > 0 ) { @@ -304,7 +306,7 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft ) // duplicate boxes if ( Tim_ManBoxNum(p) > 0 ) { - int curPi = Tim_ManPiNum(p); + int curPi = nNewPiNum; int curPo = 0; pNew->vBoxes = Vec_PtrAlloc( Tim_ManBoxNum(p) ); Vec_IntForEachEntry( vBoxesLeft, iBox, i ) @@ -315,7 +317,7 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft ) curPi += pBox->nOutputs; curPo += pBox->nInputs; } - curPo += Tim_ManPoNum(p); + curPo += nNewPoNum; assert( curPi == Tim_ManCiNum(pNew) ); assert( curPo == Tim_ManCoNum(pNew) ); } |