diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2016-02-26 18:20:57 +0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2016-02-26 18:20:57 +0800 |
commit | cf702af6f165b4623e7e5e009deedefda88a15e2 (patch) | |
tree | 6852a895331abf91f61f1743a8d7373c64d5b424 /src/base | |
parent | 5a47990043d7d5b17187122e25e1d068bc450dff (diff) | |
download | abc-cf702af6f165b4623e7e5e009deedefda88a15e2.tar.gz abc-cf702af6f165b4623e7e5e009deedefda88a15e2.tar.bz2 abc-cf702af6f165b4623e7e5e009deedefda88a15e2.zip |
New hierarchical TT NPN matching.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abci/abc.c | 1 | ||||
-rw-r--r-- | src/base/abci/abcNpn.c | 28 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index afd2bcfe..7db89a44 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -6159,6 +6159,7 @@ usage: Abc_Print( -2, "\t 4: Jake's hybrid semi-canonical form (high-effort)\n" ); Abc_Print( -2, "\t 5: new fast hybrid semi-canonical form\n" ); Abc_Print( -2, "\t 6: new phase canonical form\n" ); + Abc_Print( -2, "\t 7: new hierarchical matching\n" ); Abc_Print( -2, "\t-N <num> : the number of support variables (binary files only) [default = unused]\n" ); Abc_Print( -2, "\t-d : toggle dumping resulting functions into a file [default = %s]\n", fDumpRes? "yes": "no" ); Abc_Print( -2, "\t-b : toggle dumping in binary format [default = %s]\n", fBinary? "yes": "no" ); diff --git a/src/base/abci/abcNpn.c b/src/base/abci/abcNpn.c index 87a00651..e667a074 100644 --- a/src/base/abci/abcNpn.c +++ b/src/base/abci/abcNpn.c @@ -181,7 +181,7 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose ) char pCanonPerm[16]; unsigned uCanonPhase=0; abctime clk = Abc_Clock(); - int i; + int i, nClasses = -1; char * pAlgoName = NULL; if ( NpnType == 0 ) @@ -198,6 +198,8 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose ) pAlgoName = "new hybrid fast "; else if ( NpnType == 6 ) pAlgoName = "new phase flipping "; + else if ( NpnType == 7 ) + pAlgoName = "new hier. matching "; assert( p->nVars <= 16 ); if ( pAlgoName ) @@ -289,9 +291,29 @@ void Abc_TruthNpnPerform( Abc_TtStore_t * p, int NpnType, int fVerbose ) Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(NULL, uCanonPhase, p->nVars), printf( "\n" ); } } + else if ( NpnType == 7 ) + { + extern unsigned Abc_TtCanonicizeHie( Abc_TtMan_t * p, word * pTruth, int nVars, char * pCanonPerm ); + extern Abc_TtMan_t * Abc_TtManStart( int nVars ); + extern void Abc_TtManStop( Abc_TtMan_t * p ); + extern int Abc_TtManNumClasses( Abc_TtMan_t * p ); + + Abc_TtMan_t * pMan = Abc_TtManStart( p->nVars ); + for ( i = 0; i < p->nFuncs; i++ ) + { + if ( fVerbose ) + printf( "%7d : ", i ); + uCanonPhase = Abc_TtCanonicizeHie( pMan, p->pFuncs[i], p->nVars, pCanonPerm ); + if ( fVerbose ) +// Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(NULL, uCanonPhase, p->nVars), printf( "\n" ); + printf( "\n" ); + } + nClasses = Abc_TtManNumClasses( pMan ); + Abc_TtManStop( pMan ); + } else assert( 0 ); clk = Abc_Clock() - clk; - printf( "Classes =%9d ", Abc_TruthNpnCountUnique(p) ); + printf( "Classes =%9d ", nClasses == -1 ? Abc_TruthNpnCountUnique(p) : nClasses ); Abc_PrintTime( 1, "Time", clk ); } @@ -352,7 +374,7 @@ int Abc_NpnTest( char * pFileName, int NpnType, int nVarNum, int fDumpRes, int f { if ( fVerbose ) printf( "Using truth tables from file \"%s\"...\n", pFileName ); - if ( NpnType >= 0 && NpnType <= 6 ) + if ( NpnType >= 0 && NpnType <= 7 ) Abc_TruthNpnTest( pFileName, NpnType, nVarNum, fDumpRes, fBinary, fVerbose ); else printf( "Unknown canonical form value (%d).\n", NpnType ); |