summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2021-11-27 17:12:08 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2021-11-27 17:12:08 -0800
commitb10f6bd89929f20c882a4c17c6101e57dd541853 (patch)
treefccc6523eb27670f21eea002b30f00036dfb1686 /src/base
parent079a309a0d0bbe89eccfb64cdae55d1db73ca03a (diff)
downloadabc-b10f6bd89929f20c882a4c17c6101e57dd541853.tar.gz
abc-b10f6bd89929f20c882a4c17c6101e57dd541853.tar.bz2
abc-b10f6bd89929f20c882a4c17c6101e57dd541853.zip
Bug fix in sweep (which happens to be a rare bug in Abc_NodeMinimumBase) (additional fix).
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abc/abcMinBase.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/base/abc/abcMinBase.c b/src/base/abc/abcMinBase.c
index 3f441e99..991f65a4 100644
--- a/src/base/abc/abcMinBase.c
+++ b/src/base/abc/abcMinBase.c
@@ -113,6 +113,7 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
DdNode * bTemp, ** pbVars;
Vec_Str_t * vSupport;
int i, nVars, j, iFanin, iFanin2, k = 0;
+ int fDupFanins = 0;
assert( Abc_NtkIsBddLogic(pNode->pNtk) );
assert( Abc_ObjIsNode(pNode) );
@@ -140,6 +141,7 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
Vec_IntForEachEntryStop( &pNode->vFanins, iFanin2, j, k )
if ( iFanin == iFanin2 )
break;
+ fDupFanins |= (int)(j < k);
if ( j == k )
Vec_IntWriteEntry( &pNode->vFanins, k++, iFanin );
else if ( !Vec_IntRemove( &pFanin->vFanouts, pNode->Id ) )
@@ -153,6 +155,10 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
Cudd_RecursiveDeref( dd, bTemp );
Vec_StrFree( vSupport );
ABC_FREE( pbVars );
+
+ // try again if node had duplicated fanins
+ if ( fDupFanins )
+ Abc_NodeMinimumBase( pNode );
return 1;
}