diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-06 12:07:04 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-06 12:07:04 -0700 |
commit | faf3bf34af25297baeb454597c7d92aa75778961 (patch) | |
tree | eb6cc83b5669b43aba0fbcb04d8d9f61a570ed47 /src/bool/kit | |
parent | 9c502b70f392e2a797f5105c916d558f6108748b (diff) | |
download | abc-faf3bf34af25297baeb454597c7d92aa75778961.tar.gz abc-faf3bf34af25297baeb454597c7d92aa75778961.tar.bz2 abc-faf3bf34af25297baeb454597c7d92aa75778961.zip |
Improvement in SOP balancing.
Diffstat (limited to 'src/bool/kit')
-rw-r--r-- | src/bool/kit/kit.h | 1 | ||||
-rw-r--r-- | src/bool/kit/kitIsop.c | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/bool/kit/kit.h b/src/bool/kit/kit.h index 614f2fd5..8517fcc7 100644 --- a/src/bool/kit/kit.h +++ b/src/bool/kit/kit.h @@ -51,6 +51,7 @@ ABC_NAMESPACE_HEADER_START typedef struct Kit_Sop_t_ Kit_Sop_t; struct Kit_Sop_t_ { + int nLits; // the number of literals int nCubes; // the number of cubes unsigned * pCubes; // the storage for cubes }; diff --git a/src/bool/kit/kitIsop.c b/src/bool/kit/kitIsop.c index 68d526ed..2ff7d6f7 100644 --- a/src/bool/kit/kitIsop.c +++ b/src/bool/kit/kitIsop.c @@ -87,7 +87,7 @@ int Kit_TruthIsop( unsigned * puTruth, int nVars, Vec_Int_t * vMemory, int fTryB if ( pcRes2->nCubes >= 0 ) { assert( Kit_TruthIsEqual( puTruth, pResult, nVars ) ); - if ( pcRes->nCubes > pcRes2->nCubes ) + if ( pcRes->nCubes > pcRes2->nCubes || (pcRes->nCubes == pcRes2->nCubes && pcRes->nLits > pcRes2->nLits) ) { RetValue = 1; pcRes = pcRes2; @@ -157,6 +157,7 @@ unsigned * Kit_TruthIsop_rec( unsigned * puOn, unsigned * puOnDc, int nVars, Kit // check for constants if ( Kit_TruthIsConst0( puOn, nVars ) ) { + pcRes->nLits = 0; pcRes->nCubes = 0; pcRes->pCubes = NULL; Kit_TruthClear( pTemp, nVars ); @@ -164,6 +165,7 @@ unsigned * Kit_TruthIsop_rec( unsigned * puOn, unsigned * puOnDc, int nVars, Kit } if ( Kit_TruthIsConst1( puOnDc, nVars ) ) { + pcRes->nLits = 0; pcRes->nCubes = 1; pcRes->pCubes = Vec_IntFetch( vStore, 1 ); if ( pcRes->pCubes == NULL ) @@ -222,6 +224,7 @@ unsigned * Kit_TruthIsop_rec( unsigned * puOn, unsigned * puOnDc, int nVars, Kit return NULL; } // create the resulting cover + pcRes->nLits = pcRes0->nLits + pcRes1->nLits + pcRes2->nLits + pcRes0->nCubes + pcRes1->nCubes; pcRes->nCubes = pcRes0->nCubes + pcRes1->nCubes + pcRes2->nCubes; pcRes->pCubes = Vec_IntFetch( vStore, pcRes->nCubes ); if ( pcRes->pCubes == NULL ) @@ -273,12 +276,14 @@ unsigned Kit_TruthIsop5_rec( unsigned uOn, unsigned uOnDc, int nVars, Kit_Sop_t assert( (uOn & ~uOnDc) == 0 ); if ( uOn == 0 ) { + pcRes->nLits = 0; pcRes->nCubes = 0; pcRes->pCubes = NULL; return 0; } if ( uOnDc == 0xFFFFFFFF ) { + pcRes->nLits = 0; pcRes->nCubes = 1; pcRes->pCubes = Vec_IntFetch( vStore, 1 ); if ( pcRes->pCubes == NULL ) @@ -323,6 +328,7 @@ unsigned Kit_TruthIsop5_rec( unsigned uOn, unsigned uOnDc, int nVars, Kit_Sop_t return 0; } // create the resulting cover + pcRes->nLits = pcRes0->nLits + pcRes1->nLits + pcRes2->nLits + pcRes0->nCubes + pcRes1->nCubes; pcRes->nCubes = pcRes0->nCubes + pcRes1->nCubes + pcRes2->nCubes; pcRes->pCubes = Vec_IntFetch( vStore, pcRes->nCubes ); if ( pcRes->pCubes == NULL ) |