Skip to content

Commit 29c8d3e

Browse files
committed
Improvements to "lutcasdec".
1 parent 9bb736a commit 29c8d3e

File tree

3 files changed

+77
-35
lines changed

3 files changed

+77
-35
lines changed

src/base/abci/abc.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9171,12 +9171,12 @@ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv )
91719171
int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv )
91729172
{
91739173
extern Abc_Ntk_t * Abc_NtkLutCascadeGen( int nLutSize, int nStages, int nRails, int nShared, int fVerbose );
9174-
extern Abc_Ntk_t * Abc_NtkLutCascade2( Abc_Ntk_t * pNtk, int nLutSize, int nLuts, int nRails, int nIters, int nJRatio, int nZParam, int Seed, int fVerbose, int fVeryVerbose, char * pGuide );
9175-
extern void Abc_NtkLutCascadeFile( char * pFileName, int nVarNum, int nLutSize, int nLuts, int nRails, int nIters, int nJRatio, int nZParam, int Seed, int fVerbose, int fVeryVerbose, int fPrintMyu );
9174+
extern Abc_Ntk_t * Abc_NtkLutCascadeOne( Abc_Ntk_t * pNtk, int nLutSize, int nLuts, int nRails, int nIters, int nJRatio, int nZParam, int fXRail, int Seed, int fVerbose, int fVeryVerbose, char * pGuide );
9175+
extern void Abc_NtkLutCascadeFile( char * pFileName, int nVarNum, int nLutSize, int nLuts, int nRails, int nIters, int nJRatio, int nZParam, int Seed, int fVerbose, int fVeryVerbose, int fPrintMyu, int fPrintLev, int fXRail );
91769176
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; char * pGuide = NULL, * pFileName = NULL;
9177-
int c, nVarNum = -1, nLutSize = 6, nStages = 8, nRails = 1, nShared = 2, Seed = 0, nIters = 1, nJRatio = 0, nZParam = 0, fGen = 0, fPrintMyu = 0, fVerbose = 0, fVeryVerbose = 0;
9177+
int c, nVarNum = -1, nLutSize = 6, nStages = 8, nRails = 1, nShared = 2, Seed = 0, nIters = 1, nJRatio = 0, nZParam = 0, fGen = 0, fPrintMyu = 0, fPrintLev = 0, fXRail = 0, fVerbose = 0, fVeryVerbose = 0;
91789178
Extra_UtilGetoptReset();
9179-
while ( ( c = Extra_UtilGetopt( argc, argv, "KMRSCIJZNFgmvwh" ) ) != EOF )
9179+
while ( ( c = Extra_UtilGetopt( argc, argv, "KMRSCIJZNFgmlxvwh" ) ) != EOF )
91809180
{
91819181
switch ( c )
91829182
{
@@ -9292,6 +9292,12 @@ int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv )
92929292
case 'm':
92939293
fPrintMyu ^= 1;
92949294
break;
9295+
case 'l':
9296+
fPrintLev ^= 1;
9297+
break;
9298+
case 'x':
9299+
fXRail ^= 1;
9300+
break;
92959301
case 'v':
92969302
fVerbose ^= 1;
92979303
break;
@@ -9311,7 +9317,7 @@ int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv )
93119317
Abc_Print( -1, "The number of variables should be given on the command line using switch \"-N <num>\".\n" );
93129318
return 1;
93139319
}
9314-
Abc_NtkLutCascadeFile( pFileName, nVarNum, nLutSize, nStages, nRails, nIters, nJRatio, nZParam, Seed, fVerbose, fVeryVerbose, fPrintMyu );
9320+
Abc_NtkLutCascadeFile( pFileName, nVarNum, nLutSize, nStages, nRails, nIters, nJRatio, nZParam, Seed, fVerbose, fVeryVerbose, fPrintMyu, fPrintLev, fXRail );
93159321
return 0;
93169322
}
93179323
if ( fGen )
@@ -9348,7 +9354,7 @@ int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv )
93489354
}
93499355
if ( argc == globalUtilOptind + 1 )
93509356
pGuide = argv[globalUtilOptind];
9351-
pNtkRes = Abc_NtkLutCascade2( pNtk, nLutSize, nStages, nRails, nIters, nJRatio, nZParam, Seed, fVerbose, fVeryVerbose, pGuide );
9357+
pNtkRes = Abc_NtkLutCascadeOne( pNtk, nLutSize, nStages, nRails, nIters, nJRatio, nZParam, fXRail, Seed, fVerbose, fVeryVerbose, pGuide );
93529358
if ( pNtkRes == NULL )
93539359
{
93549360
Abc_Print( -1, "LUT cascade mapping failed.\n" );
@@ -9358,7 +9364,7 @@ int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv )
93589364
return 0;
93599365

93609366
usage:
9361-
Abc_Print( -2, "usage: lutcasdec [-KMRCSIJZN <num>] [-F <file>] [-gmvwh]\n" );
9367+
Abc_Print( -2, "usage: lutcasdec [-KMRCSIJZN <num>] [-F <file>] [-gmlxvwh]\n" );
93629368
Abc_Print( -2, "\t decomposes the primary output functions into LUT cascades\n" );
93639369
Abc_Print( -2, "\t-K <num> : the number of LUT inputs [default = %d]\n", nLutSize );
93649370
Abc_Print( -2, "\t-M <num> : the maximum delay (the number of stages) [default = %d]\n", nStages );
@@ -9372,6 +9378,8 @@ int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv )
93729378
Abc_Print( -2, "\t-F <file>: a text file with truth tables in hexadecimal listed one per line\n");
93739379
Abc_Print( -2, "\t-g : toggle generating random cascade with these parameters [default = %s]\n", fGen? "yes": "no" );
93749380
Abc_Print( -2, "\t-m : toggle printing column multiplicity statistics [default = %s]\n", fPrintMyu? "yes": "no" );
9381+
Abc_Print( -2, "\t-l : toggle printing level counting statistics [default = %s]\n", fPrintLev? "yes": "no" );
9382+
Abc_Print( -2, "\t-x : toggle using extended cascade decomposition [default = %s]\n", fXRail? "yes": "no" );
93759383
Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" );
93769384
Abc_Print( -2, "\t-w : toggle additional verbose printout [default = %s]\n", fVeryVerbose? "yes": "no" );
93779385
Abc_Print( -2, "\t-h : print the command usage\n");

src/base/abci/abcCas.c

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -656,22 +656,18 @@ void Abc_LutCascadeDerive( word * p, int nVars, int nBVars, int Myu, word * pRem
656656
}
657657

658658
// performs decomposition of one stage
659-
static inline int Abc_LutCascadeDecStage( char * pGuide, int Iter, Vec_Wrd_t * vFuncs[3], Vec_Int_t * vVarIDs, int nRVars, int nRails, int nLutSize, int nJRatio, int nZParam, int fVerbose, Vec_Wrd_t * vCas, int * pMyu )
659+
static inline int Abc_LutCascadeDecStage( word Guide0, char * pGuide, int Iter, Vec_Wrd_t * vFuncs[3], Vec_Int_t * vVarIDs, int nRVars, int nRails, int nLutSize, int nJRatio, int nZParam, int fVerbose, Vec_Wrd_t * vCas, int * pMyu )
660660
{
661-
extern word Abc_TtFindBVarsSVars( word * p, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nJRatio );
662-
extern word Abc_TtFindBVarsSVars2( word * p, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nJRatio );
661+
//extern word Abc_TtFindBVarsSVars( word * p, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nJRatio );
662+
//extern word Abc_TtFindBVarsSVars2( word * p, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nJRatio );
663663
assert( Vec_IntSize(vVarIDs) > nLutSize );
664664
assert( Vec_IntSize(vVarIDs) <= 24 );
665-
//word Guide = pGuide ? 0 : Abc_TtFindBVarsSVars( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu, nJRatio );
666-
word Guide = pGuide ? 0 : Abc_TtFindBVarsSVars2( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu, nZParam );
667-
// if ( nZParam )
668-
// Guide = pGuide ? 0 : Abc_TtFindBVarsSVars2( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu, nZParam );
669-
// else
670-
// Guide = pGuide ? 0 : Abc_TtFindBVarsSVars( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu, nJRatio );
665+
//word Guide = pGuide ? 0 : Abc_TtFindBVarsSVars2( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu, nZParam );
666+
word Guide = pGuide ? 0 : Guide0;
671667
if ( !pGuide && !Guide ) {
672668
if ( fVerbose )
673669
printf( "The function is not decomposable with %d rails.\n", nRails );
674-
Vec_IntClear( vVarIDs );
670+
//Vec_IntClear( vVarIDs );
675671
return -1;
676672
}
677673
int m, Myu = pGuide ? 1 << nRails : (Guide >> 48) & 0xFF;
@@ -722,22 +718,48 @@ static inline int Abc_LutCascadeDecStage( char * pGuide, int Iter, Vec_Wrd_t * v
722718
Vec_IntShrink( vVarIDs, nFVars+nSVars+nEVars );
723719
return nEVars;
724720
}
725-
word * Abc_LutCascadeDec( char * pGuide, word * pTruth, int nVarsOrig, Vec_Int_t * vVarIDs, int nRails, int nLutSize, int nStages, int nJRatio, int nZParam, int fVerbose, int * pnStages, int * pMyu )
721+
word * Abc_LutCascadeDec( char * pGuide, word * pTruth, int nVarsOrig, Vec_Int_t * vVarIDs, int nRails, int nLutSize, int nStages, int nJRatio, int nZParam, int fXRail, int fVerbose, int * pnStages, int * pMyu )
726722
{
723+
extern Vec_Wrd_t * Abc_TtFindBVarsSVars2( word * pTruth, int nVars, int nCVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nMyuIncrease );
727724
word * pRes = NULL; int i, nRVars = 0, nVars = Vec_IntSize(vVarIDs);
728725
Vec_Wrd_t * vFuncs[3] = { Vec_WrdStart(Abc_TtWordNum(nVars)), Vec_WrdAlloc(0), Vec_WrdAlloc(0) };
729726
Abc_TtCopy( Vec_WrdArray(vFuncs[0]), pTruth, Abc_TtWordNum(nVars), 0 );
730727
Vec_Wrd_t * vCas = Vec_WrdAlloc( 100 ); Vec_WrdPush( vCas, nVarsOrig );
731728
if ( pnStages ) *pnStages = 0;
732729
for ( i = 0; Vec_IntSize(vVarIDs) > nLutSize; i++ ) {
733-
nRVars = Abc_LutCascadeDecStage( pGuide, i, vFuncs, vVarIDs, nRVars, nRails, nLutSize, nJRatio, nZParam, fVerbose, vCas, i ? NULL : pMyu );
730+
int nRVarsOld = nRVars;
731+
Vec_Wrd_t * vGuides = Abc_TtFindBVarsSVars2( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu, nZParam );
732+
if ( vGuides ) {
733+
word Guide0 = Vec_WrdEntry(vGuides, 0);
734+
Vec_WrdFree( vGuides );
735+
nRVars = Abc_LutCascadeDecStage( Guide0, pGuide, i, vFuncs, vVarIDs, nRVars, nRails, nLutSize, nJRatio, nZParam, fVerbose, vCas, i ? NULL : pMyu );
736+
}
737+
else
738+
nRVars = -1;
734739
if ( i+2 > nStages ) {
735740
if ( fVerbose )
736741
printf( "The length of the cascade (%d) exceeds the max allowed number of stages (%d).\n", i+2, nStages );
737742
nRVars = -1;
738743
}
739-
if ( nRVars == -1 )
744+
if ( nRVars == -1 && Vec_IntSize(vVarIDs) > nLutSize-1 && fXRail ) {
745+
Vec_Wrd_t * vGuides = Abc_TtFindBVarsSVars2( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVarsOld, nRails+1, nLutSize-1, fVerbose, pMyu, nZParam );
746+
if ( vGuides ) {
747+
word Guide0 = Vec_WrdEntry(vGuides, 0);
748+
Vec_WrdFree( vGuides );
749+
nRVars = Abc_LutCascadeDecStage( Guide0, pGuide, i, vFuncs, vVarIDs, nRVarsOld, nRails+1, nLutSize-1, nJRatio, nZParam, fVerbose, vCas, NULL );
750+
}
751+
else
752+
nRVars = -1;
753+
if ( i+2 > nStages ) {
754+
if ( fVerbose )
755+
printf( "The length of the cascade (%d) exceeds the max allowed number of stages (%d).\n", i+2, nStages );
756+
nRVars = -1;
757+
}
758+
}
759+
if ( nRVars == -1 ) {
760+
Vec_IntClear( vVarIDs );
740761
break;
762+
}
741763
}
742764
if ( nRVars != -1 && Vec_IntSize(vVarIDs) > 0 ) {
743765
Abc_LutCascadeGenOne( vCas, Vec_IntSize(vVarIDs), Vec_IntArray(vVarIDs), Vec_WrdEntry(vCas, 0), Vec_WrdArray(vFuncs[0]) );
@@ -842,7 +864,7 @@ Abc_Ntk_t * Abc_NtkLutCascade( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int
842864
Gia_ManStop( pGia );
843865
return pNew;
844866
}
845-
Abc_Ntk_t * Abc_NtkLutCascade2( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int nRails, int nIters, int nJRatio, int nZParam, int Seed, int fVerbose, int fVeryVerbose, char * pGuide )
867+
Abc_Ntk_t * Abc_NtkLutCascadeOne( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int nRails, int nIters, int nJRatio, int nZParam, int fXRail, int Seed, int fVerbose, int fVeryVerbose, char * pGuide )
846868
{
847869
extern Gia_Man_t * Abc_NtkStrashToGia( Abc_Ntk_t * pNtk );
848870
int i, nWords = Abc_TtWordNum(Abc_NtkCiNum(pNtk));
@@ -870,7 +892,7 @@ Abc_Ntk_t * Abc_NtkLutCascade2( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int
870892
printf( ".\n" );
871893
}
872894

873-
word * pLuts = Abc_LutCascadeDec( pGuide, pTruth1, Abc_NtkCiNum(pNtk), vVarIDs, nRails, nLutSize, nStages, Iter >= nIters ? 1 : 0, nZParam, fVeryVerbose, NULL, NULL );
895+
word * pLuts = Abc_LutCascadeDec( pGuide, pTruth1, Abc_NtkCiNum(pNtk), vVarIDs, nRails, nLutSize, nStages, Iter >= nIters ? 1 : 0, nZParam, fXRail, fVeryVerbose, NULL, NULL );
874896
pNew = pLuts ? Abc_NtkLutCascadeFromLuts( pLuts, Abc_NtkCiNum(pNtk), pNtk, nLutSize, fVerbose ) : NULL;
875897
Vec_IntFree( vVarIDs );
876898

@@ -1383,7 +1405,7 @@ Vec_Wrd_t * Abc_NtkLutCasReadTruths( char * pFileName, int nVarsOrig )
13831405
SeeAlso []
13841406
13851407
***********************************************************************/
1386-
void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int nStages, int nRails, int nIters, int nJRatio, int nZParam, int Seed, int fVerbose, int fVeryVerbose, int fPrintMyu )
1408+
void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int nStages, int nRails, int nIters, int nJRatio, int nZParam, int Seed, int fVerbose, int fVeryVerbose, int fPrintMyu, int fPrintLev, int fXRail )
13871409
{
13881410
abctime clkStart = Abc_Clock();
13891411
int i, Sum = 0, nStageCount = 0, MyuMin = 0, nTotalLuts = 0, nWords = Abc_TtWordNum(nVarsOrig);
@@ -1431,7 +1453,7 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14311453
printf( "Decomposing %d-var function into %d-rail cascade of %d-LUTs.\n", nVars, nRails, nLutSize );
14321454
}
14331455

1434-
word * pLuts = Abc_LutCascadeDec( NULL, pTruth, nVarsOrig, vVarIDs, nRails, nLutSize, nStages, (int)(Iter >= nIters), nZParam, fVeryVerbose, &nStageCount, &MyuMin );
1456+
word * pLuts = Abc_LutCascadeDec( NULL, pTruth, nVarsOrig, vVarIDs, nRails, nLutSize, nStages, (int)(Iter >= nIters), nZParam, fXRail, fVeryVerbose, &nStageCount, &MyuMin );
14351457
Vec_IntFree( vVarIDs );
14361458
if ( MyuMin < 50 ) MyuStats[MyuMin]++, IterReal++;
14371459
if ( pLuts == NULL ) {
@@ -1473,7 +1495,7 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14731495
if ( MyuStats[i] )
14741496
printf( " %2d Myu : Function count = %8d (%6.2f %%)\n", i, MyuStats[i], 100.0*MyuStats[i]/nFuncs/IterReal );
14751497
}
1476-
if ( nRails > 1 ) {
1498+
if ( fPrintLev ) {
14771499
printf( "Level count statistics for %d-rail LUT cascade:\n", nRails );
14781500
for ( i = 0; i < 50; i++ )
14791501
if ( StageStats[i] )

src/misc/util/utilBSet.c

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ int Abc_SharedEvalBest( Abc_BSEval_t * p, word * pTruth, int nVars, int nCVars,
897897
int nBSWords = Abc_Truth6WordNum( nVars - nFVars ), CVarMask = nCVars ? Abc_InfoMask(nCVars) << (nVars - nCVars - nFVars) : 0;
898898
int MyuCur, Myu = Abc_TtGetCMInt( pTruth, nVars, nFVars, p->vCounts, p->vTable, p->vStore, p->vUsed, pPat );
899899
int nRailsCur = Abc_Base2Log( Myu ); Vec_Int_t * vLevel;
900-
assert( Myu == MyuMin && nRailsCur > nRails );
900+
assert( Myu == MyuMin && nRailsCur >= nRails );
901901
int i, k, iSet, iStart, nSharedMax = nVars - nFVars - nRails, nRailsMin = 100;
902902
Vec_WecForEachLevelStartStop( p->vSets, vLevel, i, 1, nSharedMax ) {
903903
Vec_IntForEachEntryDouble( vLevel, iSet, iStart, k ) {
@@ -1018,7 +1018,7 @@ word Abc_BSEvalEncode( int * pPermBest, int nVars, int nLutSize, int Shared, int
10181018
mSVars |= (word)1 << (nVars-nLutSize+v);
10191019
return ((word)MyuMin << 48) | (mSVars << 24) | mBVars;
10201020
}
1021-
word Abc_TtFindBVarsSVars2( word * pTruth, int nVars, int nCVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nMyuIncrease )
1021+
Vec_Wrd_t * Abc_TtFindBVarsSVars2( word * pTruth, int nVars, int nCVars, int nRails, int nLutSize, int fVerbose, int * pMyu, int nMyuIncrease )
10221022
{
10231023
Abc_BSEval_t * p = Abc_BSEvalAlloc();
10241024
int nFVars = nVars-nLutSize;
@@ -1043,7 +1043,7 @@ word Abc_TtFindBVarsSVars2( word * pTruth, int nVars, int nCVars, int nRails, in
10431043
word * pCopy = ABC_ALLOC( word, nWords );
10441044
Abc_TtCopy( pCopy, pTruth, nWords, 0 );
10451045

1046-
word Result = 0;
1046+
Vec_Wrd_t * vRes = Vec_WrdAlloc( 10 );
10471047
int i, k, Var0, Var1, Pla2Var[32], Var2Pla[32];
10481048
for ( i = 0; i < nVars; i++ )
10491049
Pla2Var[i] = Var2Pla[i] = i;
@@ -1071,20 +1071,29 @@ word Abc_TtFindBVarsSVars2( word * pTruth, int nVars, int nCVars, int nRails, in
10711071
int Shared = 0, nSetSize = 0;
10721072
if ( MyuThis > 2 ) {
10731073
int SharedThis = 0, nSetSizeThis = 0;
1074-
int nRailsMin = Abc_SharedEvalBest( p, pCopy, nVars, nCVars, nFVars, MyuThis, nRails, 0, &SharedThis, &nSetSizeThis, p->pPat );
1074+
int nRailsMin = 100;
1075+
for ( int r = 1; r <= nRails && nRailsMin > r; r++ ) {
1076+
int nRailsMinNew = Abc_SharedEvalBest( p, pCopy, nVars, nCVars, nFVars, MyuThis, r, 0, &SharedThis, &nSetSizeThis, p->pPat );
1077+
if ( nRailsMinNew < 100 )
1078+
nRailsMin = nRailsMinNew;
1079+
}
10751080
if ( fVerbose )
10761081
printf( " RailsMyu = %3d. RailsMin = %3d. Shared = %2d. SetSize = %d.", Abc_Base2Log(MyuThis), nRailsMin, SharedThis, nSetSizeThis );
10771082
if ( nRailsMin <= nRails ) {
1078-
assert( Abc_Base2Log(MyuThis) >= nRailsMin );
10791083
MyuThis = 1 << nRailsMin;
10801084
Shared = SharedThis;
10811085
nSetSize = nSetSizeThis;
10821086
}
10831087
}
1084-
if ( MyuBest > MyuThis || (MyuBest == MyuThis && nSetSizeBest > nSetSize) ) {
1088+
if ( MyuBest > MyuThis || (MyuBest == MyuThis && nSetSizeBest >= nSetSize) ) {
1089+
int fSave = MyuBest == MyuThis && nSetSizeBest == nSetSize;
10851090
MyuBest = MyuThis;
10861091
nSetSizeBest = nSetSize;
1087-
Result = Abc_BSEvalEncode( Pla2Var, nVars, p->nBVars, Shared, MyuBest, nSetSize );
1092+
word Result = Abc_BSEvalEncode( Pla2Var, nVars, p->nBVars, Shared, MyuBest, nSetSize );
1093+
if ( fSave )
1094+
Vec_WrdPush( vRes, Result );
1095+
else
1096+
Vec_WrdFill( vRes, 1, Result );
10881097
if ( fVerbose )
10891098
printf( " <== best" );
10901099
}
@@ -1117,11 +1126,14 @@ word Abc_TtFindBVarsSVars2( word * pTruth, int nVars, int nCVars, int nRails, in
11171126
}
11181127
if ( !Abc_TtEqual(pCopy, pTruth, nWords) )
11191128
printf( "Internal truth table check failed.\n" );
1129+
//printf( "%d ", Count );
11201130

11211131
Abc_BSEvalFree(p);
1122-
if ( MyuBest > (1 << nRails) )
1123-
return 0;
1124-
return Result;
1132+
if ( MyuBest > (1 << nRails) ) {
1133+
Vec_WrdFree(vRes);
1134+
return NULL;
1135+
}
1136+
return vRes;
11251137
}
11261138

11271139
////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)