diff options
Diffstat (limited to 'src/aig')
-rw-r--r-- | src/aig/gia/gia.h | 2 | ||||
-rw-r--r-- | src/aig/gia/giaDup.c | 26 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index 3fdbf4b5..84c22f03 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -826,7 +826,7 @@ extern Gia_Man_t * Gia_ManDupDfsCone( Gia_Man_t * p, Gia_Obj_t * pObj ); extern Gia_Man_t * Gia_ManDupDfsLitArray( Gia_Man_t * p, Vec_Int_t * vLits ); extern Gia_Man_t * Gia_ManDupNormalize( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupUnnomalize( Gia_Man_t * p ); -extern Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fDualOut ); +extern Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fDualOut, int OutValue ); extern Gia_Man_t * Gia_ManDupOntop( Gia_Man_t * p, Gia_Man_t * p2 ); extern Gia_Man_t * Gia_ManDupWithNewPo( Gia_Man_t * p1, Gia_Man_t * p2 ); extern Gia_Man_t * Gia_ManDupDfsCiMap( Gia_Man_t * p, int * pCi2Lit, Vec_Int_t * vLits ); diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c index b5fcae45..0df414ab 100644 --- a/src/aig/gia/giaDup.c +++ b/src/aig/gia/giaDup.c @@ -1175,7 +1175,27 @@ Vec_Int_t * Gia_ManDupTrimmedNonZero( Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ -Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fDualOut ) +int Gia_ManPoIsToRemove( Gia_Man_t * p, Gia_Obj_t * pObj, int Value ) +{ + assert( Gia_ObjIsCo(pObj) ); + if ( Value == -1 ) + return Gia_ObjIsConst0(Gia_ObjFanin0(pObj)); + assert( Value == 0 || Value == 1 ); + return Value == Gia_ObjFaninC0(pObj); +} + +/**Function************************************************************* + + Synopsis [Duplicates AIG in the DFS order while putting CIs first.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fDualOut, int OutValue ) { Vec_Int_t * vNonZero = NULL; Gia_Man_t * pNew, * pTemp; @@ -1231,12 +1251,12 @@ Gia_Man_t * Gia_ManDupTrimmed( Gia_Man_t * p, int fTrimCis, int fTrimCos, int fD { // check if there are POs to be added Gia_ManForEachPo( p, pObj, i ) - if ( !fTrimCos || !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) ) + if ( !fTrimCos || !Gia_ManPoIsToRemove(p, pObj, OutValue) ) break; if ( i == Gia_ManPoNum(p) ) // there is no POs - add dummy PO Gia_ManAppendCo( pNew, 0 ); Gia_ManForEachCo( p, pObj, i ) - if ( !fTrimCos || !Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) || Gia_ObjIsRi(p, pObj) ) + if ( !fTrimCos || !Gia_ManPoIsToRemove(p, pObj, OutValue) || Gia_ObjIsRi(p, pObj) ) Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); } |