Commit ea0f22de by Alan Mishchenko

Bug fix in &mfs.

parent 110bac43
...@@ -76,7 +76,7 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve ...@@ -76,7 +76,7 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve
{ {
if ( Truth == 0 || ~Truth == 0 ) if ( Truth == 0 || ~Truth == 0 )
{ {
//assert( nVars == 0 ); assert( nVars == 0 );
Vec_StrPush( vCnf, (char)(Truth == 0) ); Vec_StrPush( vCnf, (char)(Truth == 0) );
Vec_StrPush( vCnf, (char)-1 ); Vec_StrPush( vCnf, (char)-1 );
return 1; return 1;
...@@ -92,6 +92,7 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve ...@@ -92,6 +92,7 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve
{ {
Vec_StrPush( vCnf, (char)1 ); Vec_StrPush( vCnf, (char)1 );
Vec_StrPush( vCnf, (char)-1 ); Vec_StrPush( vCnf, (char)-1 );
assert( 0 );
return 1; return 1;
} }
// const1 // const1
...@@ -102,6 +103,7 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve ...@@ -102,6 +103,7 @@ int Sfm_TruthToCnf( word Truth, word * pTruth, int nVars, Vec_Int_t * vCover, Ve
{ {
Vec_StrPush( vCnf, (char)0 ); Vec_StrPush( vCnf, (char)0 );
Vec_StrPush( vCnf, (char)-1 ); Vec_StrPush( vCnf, (char)-1 );
assert( 0 );
return 1; return 1;
} }
} }
...@@ -196,6 +198,7 @@ void Sfm_TranslateCnf( Vec_Wec_t * vRes, Vec_Str_t * vCnf, Vec_Int_t * vFaninMap ...@@ -196,6 +198,7 @@ void Sfm_TranslateCnf( Vec_Wec_t * vRes, Vec_Str_t * vCnf, Vec_Int_t * vFaninMap
Vec_Int_t * vClause; Vec_Int_t * vClause;
signed char Entry; signed char Entry;
int i, Lit; int i, Lit;
assert( Vec_StrEntry(vCnf, 1) != -1 || Vec_IntSize(vFaninMap) == 1 );
Vec_WecClear( vRes ); Vec_WecClear( vRes );
vClause = Vec_WecPushLevel( vRes ); vClause = Vec_WecPushLevel( vRes );
Vec_StrForEachEntry( vCnf, Entry, i ) Vec_StrForEachEntry( vCnf, Entry, i )
......
...@@ -218,7 +218,9 @@ finish: ...@@ -218,7 +218,9 @@ finish:
Sfm_NtkUpdate( p, iNode, f, (iVar == -1 ? iVar : Vec_IntEntry(p->vDivs, iVar)), uTruth, p->pTruth ); Sfm_NtkUpdate( p, iNode, f, (iVar == -1 ? iVar : Vec_IntEntry(p->vDivs, iVar)), uTruth, p->pTruth );
// the number of fanins cannot increase // the number of fanins cannot increase
assert( nFanins >= Sfm_ObjFaninNum(p, iNode) ); assert( nFanins >= Sfm_ObjFaninNum(p, iNode) );
//printf( "Modifying node %d with %d fanins (resulting in %d fanins).\n", iNode, nFanins, Sfm_ObjFaninNum(p, iNode) ); //printf( "Modifying node %d with %d fanins (resulting in %d fanins). ", iNode, nFanins, Sfm_ObjFaninNum(p, iNode) );
//Abc_TtPrintHexRev( stdout, p->pTruth, Sfm_ObjFaninNum(p, iNode) );
//printf( "\n" );
return 1; return 1;
} }
...@@ -386,8 +388,8 @@ int Sfm_NtkPerform( Sfm_Ntk_t * p, Sfm_Par_t * pPars ) ...@@ -386,8 +388,8 @@ int Sfm_NtkPerform( Sfm_Ntk_t * p, Sfm_Par_t * pPars )
continue; continue;
if ( p->pPars->nDepthMax && Sfm_ObjLevel(p, i) > p->pPars->nDepthMax ) if ( p->pPars->nDepthMax && Sfm_ObjLevel(p, i) > p->pPars->nDepthMax )
continue; continue;
if ( Sfm_ObjFaninNum(p, i) < 2 ) //if ( Sfm_ObjFaninNum(p, i) < 2 )
continue; // continue;
if ( Sfm_ObjFaninNum(p, i) > SFM_SUPP_MAX ) if ( Sfm_ObjFaninNum(p, i) > SFM_SUPP_MAX )
{ {
CounterLarge++; CounterLarge++;
......
...@@ -322,7 +322,7 @@ void Sfm_NtkUpdateLevelR_rec( Sfm_Ntk_t * p, int iNode ) ...@@ -322,7 +322,7 @@ void Sfm_NtkUpdateLevelR_rec( Sfm_Ntk_t * p, int iNode )
void Sfm_NtkUpdate( Sfm_Ntk_t * p, int iNode, int f, int iFaninNew, word uTruth, word * pTruth ) void Sfm_NtkUpdate( Sfm_Ntk_t * p, int iNode, int f, int iFaninNew, word uTruth, word * pTruth )
{ {
int iFanin = Sfm_ObjFanin( p, iNode, f ); int iFanin = Sfm_ObjFanin( p, iNode, f );
int nWords = Abc_Truth6WordNum( Sfm_ObjFaninNum(p, iNode) ); int nWords = Abc_Truth6WordNum( Sfm_ObjFaninNum(p, iNode) - (int)(iFaninNew == -1) );
assert( Sfm_ObjIsNode(p, iNode) ); assert( Sfm_ObjIsNode(p, iNode) );
assert( iFanin != iFaninNew ); assert( iFanin != iFaninNew );
assert( Sfm_ObjFaninNum(p, iNode) <= SFM_FANIN_MAX ); assert( Sfm_ObjFaninNum(p, iNode) <= SFM_FANIN_MAX );
......
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