Commit b10f6bd8 by Alan Mishchenko

Bug fix in sweep (which happens to be a rare bug in Abc_NodeMinimumBase) (additional fix).

parent 079a309a
...@@ -113,6 +113,7 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode ) ...@@ -113,6 +113,7 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
DdNode * bTemp, ** pbVars; DdNode * bTemp, ** pbVars;
Vec_Str_t * vSupport; Vec_Str_t * vSupport;
int i, nVars, j, iFanin, iFanin2, k = 0; int i, nVars, j, iFanin, iFanin2, k = 0;
int fDupFanins = 0;
assert( Abc_NtkIsBddLogic(pNode->pNtk) ); assert( Abc_NtkIsBddLogic(pNode->pNtk) );
assert( Abc_ObjIsNode(pNode) ); assert( Abc_ObjIsNode(pNode) );
...@@ -140,6 +141,7 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode ) ...@@ -140,6 +141,7 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
Vec_IntForEachEntryStop( &pNode->vFanins, iFanin2, j, k ) Vec_IntForEachEntryStop( &pNode->vFanins, iFanin2, j, k )
if ( iFanin == iFanin2 ) if ( iFanin == iFanin2 )
break; break;
fDupFanins |= (int)(j < k);
if ( j == k ) if ( j == k )
Vec_IntWriteEntry( &pNode->vFanins, k++, iFanin ); Vec_IntWriteEntry( &pNode->vFanins, k++, iFanin );
else if ( !Vec_IntRemove( &pFanin->vFanouts, pNode->Id ) ) else if ( !Vec_IntRemove( &pFanin->vFanouts, pNode->Id ) )
...@@ -153,6 +155,10 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode ) ...@@ -153,6 +155,10 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
Cudd_RecursiveDeref( dd, bTemp ); Cudd_RecursiveDeref( dd, bTemp );
Vec_StrFree( vSupport ); Vec_StrFree( vSupport );
ABC_FREE( pbVars ); ABC_FREE( pbVars );
// try again if node had duplicated fanins
if ( fDupFanins )
Abc_NodeMinimumBase( pNode );
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment