summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2018-09-07 19:40:38 +0300
committerAlan Mishchenko <alanmi@berkeley.edu>2018-09-07 19:40:38 +0300
commit8638b13e72bddb031ae1c7954653d30479e06c1f (patch)
tree87305c940da53380830774f12f3210c8d990fbee
parent197c65be0b8275deb1508b7bde08fce2216d5064 (diff)
downloadabc-8638b13e72bddb031ae1c7954653d30479e06c1f.tar.gz
abc-8638b13e72bddb031ae1c7954653d30479e06c1f.tar.bz2
abc-8638b13e72bddb031ae1c7954653d30479e06c1f.zip
Expriments with functions (bug fixes).
-rw-r--r--src/base/abci/abc.c11
-rw-r--r--src/misc/extra/extraUtilMaj.c2
-rw-r--r--src/opt/dau/dauCanon.c7
-rw-r--r--src/opt/dau/dauNpn.c28
4 files changed, 35 insertions, 13 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 67d361ac..95aef8ad 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -23027,6 +23027,17 @@ int Abc_CommandFunEnum( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
+ if ( nVars < 2 || nVars > 6 )
+ {
+ Abc_Print( -1, "The number of inputs should be 2 <= N <= 6.\n" );
+ goto usage;
+ }
+ if ( nInputs < nVars || nInputs > 6 )
+ {
+ Abc_Print( -1, "The intermediate support size should be N <= S <= 6.\n" );
+ goto usage;
+ }
+
Dau_FunctionEnum( nInputs, nVars, fVerbose );
return 0;
diff --git a/src/misc/extra/extraUtilMaj.c b/src/misc/extra/extraUtilMaj.c
index 3787593d..8bdb0818 100644
--- a/src/misc/extra/extraUtilMaj.c
+++ b/src/misc/extra/extraUtilMaj.c
@@ -370,7 +370,7 @@ int Gem_Enumerate( int nVars, int fDump, int fVerbose )
if ( Gem_FuncReduce( p, f, i, j ) )
return Gem_ManFree( p );
}
- printf( "Finished (functions = %10d) ", v, p->nObjs );
+ printf( "Finished (functions = %10d) ", p->nObjs );
Abc_PrintTime( 0, "Time", Abc_Clock() - clk );
if ( fDump ) Vec_MemDumpTruthTables( p->vTtMem, "enum", nVars );
Gem_ManFree( p );
diff --git a/src/opt/dau/dauCanon.c b/src/opt/dau/dauCanon.c
index 918c7ce1..0c93cc85 100644
--- a/src/opt/dau/dauCanon.c
+++ b/src/opt/dau/dauCanon.c
@@ -1230,6 +1230,13 @@ unsigned Abc_TtCanonicizeHie( Abc_TtHieMan_t * p, word * pTruthInit, int nVars,
int i, k;
assert( nVars <= 16 );
+ // handle constant
+ if ( nVars == 0 )
+ {
+ Abc_TtClear( pTruthInit, nWords );
+ return 0;
+ }
+
Abc_TtCopy( pTruth, pTruthInit, nWords, 0 );
for ( i = 0; i < nVars; i++ )
diff --git a/src/opt/dau/dauNpn.c b/src/opt/dau/dauNpn.c
index 72edc728..7850a9a1 100644
--- a/src/opt/dau/dauNpn.c
+++ b/src/opt/dau/dauNpn.c
@@ -467,15 +467,16 @@ int Dau_CountFuncs( Vec_Int_t * vNodSup, int iStart, int iStop, int nVars )
Count += ((Entry & 0xF) <= nVars);
return Count;
}
-int Dau_PrintStats( int nNodes, int nInputs, int nVars, Vec_Int_t * vNodSup, int iStart, int iStop, abctime clk )
+int Dau_PrintStats( int nNodes, int nInputs, int nVars, Vec_Int_t * vNodSup, int iStart, int iStop, word nSteps, abctime clk )
{
int nNew;
- printf("Nodes = %2d. ", nNodes );
- printf("New%d = %10d. ", nInputs, iStop-iStart );
- printf("Total%d = %10d. ", nInputs, iStop );
- printf("New%d = %10d. ", nVars, nNew = Dau_CountFuncs(vNodSup, iStart, iStop, nVars) );
- printf("Total%d = %10d. ", nVars, Dau_CountFuncs(vNodSup, 0, iStop, nVars) );
- Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
+ printf("N =%2d | ", nNodes );
+ printf("C =%12.0f ", (double)(iword)nSteps );
+ printf("New%d =%10d ", nInputs, iStop-iStart );
+ printf("All%d =%10d | ", nInputs, iStop );
+ printf("New%d =%8d ", nVars, nNew = Dau_CountFuncs(vNodSup, iStart, iStop, nVars) );
+ printf("All%d =%8d ", nVars, Dau_CountFuncs(vNodSup, 0, iStop, nVars) );
+ Abc_PrintTime( 1, "T", Abc_Clock() - clk );
fflush(stdout);
return nNew;
}
@@ -483,13 +484,13 @@ int Dau_InsertFunction( Abc_TtHieMan_t * pMan, word * pCur, int nNodes, int nInp
{
char Perm[16] = {0};
int nVarsNew = Abc_TtMinBase( pCur, NULL, nVars, nInputs );
- unsigned Phase = nVarsNew ? Abc_TtCanonicizeHie( pMan, pCur, nVarsNew, Perm, 1 ) : 0;
+ unsigned Phase = Abc_TtCanonicizeHie( pMan, pCur, nVarsNew, Perm, 1 );
int nEntries = Vec_MemEntryNum(vTtMem);
int Entry = Vec_MemHashInsert( vTtMem, pCur );
if ( nEntries == Vec_MemEntryNum(vTtMem) ) // found in the table - not new
return 0;
Phase = 0;
- nEntries = 0;
+ Entry = 0;
// this is a new class
Vec_IntPush( vNodSup, (nNodes << 16) | nVarsNew );
assert( Vec_MemEntryNum(vTtMem) == Vec_IntSize(vNodSup) );
@@ -498,7 +499,7 @@ int Dau_InsertFunction( Abc_TtHieMan_t * pMan, word * pCur, int nNodes, int nInp
void Dau_FunctionEnum( int nInputs, int nVars, int fVerbose )
{
abctime clk = Abc_Clock();
- int nWords = Abc_TtWordNum(nInputs);
+ int nWords = Abc_TtWordNum(nInputs); word nSteps = 0;
Abc_TtHieMan_t * pMan = Abc_TtHieManStart( nInputs, 5 );
Vec_Mem_t * vTtMem = Vec_MemAlloc( nWords, 16 );
Vec_Int_t * vNodSup = Vec_IntAlloc( 1 << 16 );
@@ -514,7 +515,7 @@ void Dau_FunctionEnum( int nInputs, int nVars, int fVerbose )
Abc_TtNot( Truth, nWords );
Vec_MemHashInsert( vTtMem, Truth );
Vec_IntPush( vNodSup, 1 ); // nodes=0, supp=1
- Dau_PrintStats( 0, nInputs, nVars, vNodSup, 0, 2, clk );
+ Dau_PrintStats( 0, nInputs, nVars, vNodSup, 0, 2, nSteps, clk );
// numerate other functions based on how many nodes they have
for ( n = 1; n < 32; n++ )
{
@@ -554,6 +555,7 @@ void Dau_FunctionEnum( int nInputs, int nVars, int fVerbose )
Dau_InsertFunction( pMan, &tCur, n, nInputs, nSupp+1, vTtMem, vNodSup );
}
}
+ nSteps += 3;
}
for ( g = 0; g < 2; g++ )
{
@@ -582,6 +584,7 @@ void Dau_FunctionEnum( int nInputs, int nVars, int fVerbose )
tCur = (tGate & Cof1) | (~tGate & Cof0);
Dau_InsertFunction( pMan, &tCur, n, nInputs, nSupp, vTtMem, vNodSup );
}
+ nSteps += 5;
}
}
for ( g = 0; g < 2; g++ )
@@ -626,13 +629,14 @@ void Dau_FunctionEnum( int nInputs, int nVars, int fVerbose )
tCur = (tGate & Cof1) | (~tGate & Cof0);
Dau_InsertFunction( pMan, &tCur, n, nInputs, nSupp, vTtMem, vNodSup );
}
+ nSteps += 9;
}
}
}
}
iStart = iStop;
iStop = Vec_IntSize(vNodSup);
- nNew = Dau_PrintStats( n, nInputs, nVars, vNodSup, iStart, iStop, clk );
+ nNew = Dau_PrintStats( n, nInputs, nVars, vNodSup, iStart, iStop, nSteps, clk );
if ( nNew == 0 )
break;
}