diff options
author | alanminko <37236958+alanminko@users.noreply.github.com> | 2021-11-10 09:48:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 09:48:58 -0800 |
commit | 9b245d9f6910c048e9bbcf95ee5dee46f2f24f2c (patch) | |
tree | 258be6a79c46eee64387f3071a3bcbc166ea39aa | |
parent | 079a309a0d0bbe89eccfb64cdae55d1db73ca03a (diff) | |
parent | 348c74e0a63b54d3341c48a4ce71cee50e7bd41c (diff) | |
download | abc-9b245d9f6910c048e9bbcf95ee5dee46f2f24f2c.tar.gz abc-9b245d9f6910c048e9bbcf95ee5dee46f2f24f2c.tar.bz2 abc-9b245d9f6910c048e9bbcf95ee5dee46f2f24f2c.zip |
Merge pull request #139 from antmicro/fix-unconnected-couts-upstream
Consider unconnected carry-out ports
-rw-r--r-- | src/aig/gia/giaSweep.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/aig/gia/giaSweep.c b/src/aig/gia/giaSweep.c index 1d66caee..8a7fcbd0 100644 --- a/src/aig/gia/giaSweep.c +++ b/src/aig/gia/giaSweep.c @@ -388,6 +388,14 @@ Vec_Int_t * Gia_ManComputeCarryOuts( Gia_Man_t * p ) Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime; int i, iLast, iBox, nBoxes = Tim_ManBoxNum( pManTime ); Vec_Int_t * vCarryOuts = Vec_IntAlloc( nBoxes ); + + // Create and populate reference count (and free later) only if not already + // done. + int createRefs = (p->pRefs == NULL); + if (createRefs) { + Gia_ManCreateRefs( p ); + } + for ( i = 0; i < nBoxes; i++ ) { iLast = Tim_ManBoxInputLast( pManTime, i ); @@ -398,9 +406,24 @@ Vec_Int_t * Gia_ManComputeCarryOuts( Gia_Man_t * p ) if ( iBox == -1 ) continue; assert( Gia_ObjIsCi(pObj) ); - if ( Gia_ObjCioId(pObj) == Tim_ManBoxOutputLast(pManTime, iBox) ) + if ( Gia_ObjCioId(pObj) == Tim_ManBoxOutputLast(pManTime, iBox) ) { Vec_IntPush( vCarryOuts, Gia_ObjId(p, pObj) ); + + // We have identified a carry connection. Check if the carry out + // of the destination box is unconnected. If so then add it to + // the carry list as well. + iLast = Tim_ManBoxOutputLast(pManTime, i); + pObj = Gia_ManCi(p, iLast); + if ( Gia_ObjRefNum(p, pObj) == 0 ) { + Vec_IntPush( vCarryOuts, Gia_ObjId(p, pObj) ); + } + } + } + + if (createRefs) { + ABC_FREE( p->pRefs ); } + return vCarryOuts; } |