diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-06-18 13:56:46 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-06-18 13:56:46 -0700 |
commit | a7339fdb9978d82516d79d81aa10296205cc28d6 (patch) | |
tree | f46b30bcde0949e59617ee1aa6fc7c6f3bd77027 | |
parent | 91f06107bfaa79e7526774e09ecdc5c9f0d489f8 (diff) | |
download | abc-a7339fdb9978d82516d79d81aa10296205cc28d6.tar.gz abc-a7339fdb9978d82516d79d81aa10296205cc28d6.tar.bz2 abc-a7339fdb9978d82516d79d81aa10296205cc28d6.zip |
Fix constant propagation after 'if'.
-rw-r--r-- | src/base/abc/abcUtil.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c index 20b18c4f..892dfee7 100644 --- a/src/base/abc/abcUtil.c +++ b/src/base/abc/abcUtil.c @@ -964,6 +964,20 @@ int Abc_NtkLogicMakeSimpleCos( Abc_Ntk_t * pNtk, int fDuplicate ) assert( Abc_NtkIsLogic(pNtk) ); LevelMax = Abc_NtkLevel(pNtk); + // fix constant drivers + Abc_NtkForEachCo( pNtk, pNode, i ) + { + pDriver = Abc_ObjFanin0(pNode); + if ( !Abc_NodeIsConst(pDriver) ) + continue; + pDriverNew = (Abc_ObjFaninC0(pNode) == Abc_NodeIsConst0(pDriver)) ? Abc_NtkCreateNodeConst1(pNtk) : Abc_NtkCreateNodeConst0(pNtk); + if ( Abc_ObjFaninC0(pNode) ) + Abc_ObjXorFaninC( pNode, 0 ); + Abc_ObjPatchFanin( pNode, pDriver, pDriverNew ); + if ( Abc_ObjFanoutNum(pDriver) == 0 ) + Abc_NtkDeleteObj( pDriver ); + } + // collect drivers pointed by complemented edges vDrivers = Vec_PtrAlloc( 100 ); Abc_NtkIncrementTravId( pNtk ); |