diff options
Diffstat (limited to 'src/base/abci/abcDec.c')
-rw-r--r-- | src/base/abci/abcDec.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/base/abci/abcDec.c b/src/base/abci/abcDec.c index 309c6a50..f5dce96e 100644 --- a/src/base/abci/abcDec.c +++ b/src/base/abci/abcDec.c @@ -353,10 +353,10 @@ void Abc_TruthStoreRead( char * pFileName, Abc_TtStore_t * p ) SeeAlso [] ***********************************************************************/ -void Abc_TtStoreWrite( char * pFileName, Abc_TtStore_t * p ) +void Abc_TtStoreWrite( char * pFileName, Abc_TtStore_t * p, int fBinary ) { FILE * pFile; - int i; + int i, nBytes = 8 * Abc_Truth6WordNum( p->nVars ); pFile = fopen( pFileName, "wb" ); if ( pFile == NULL ) { @@ -365,8 +365,10 @@ void Abc_TtStoreWrite( char * pFileName, Abc_TtStore_t * p ) } for ( i = 0; i < p->nFuncs; i++ ) { - Abc_TruthWriteHex( pFile, p->pFuncs[i], p->nVars ); - fprintf( pFile, "\n" ); + if ( fBinary ) + fwrite( p->pFuncs[i], nBytes, 1, pFile ); + else + Abc_TruthWriteHex( pFile, p->pFuncs[i], p->nVars ), fprintf( pFile, "\n" ); } fclose( pFile ); } @@ -441,7 +443,7 @@ void Abc_TtStoreTest( char * pFileName ) return; // write into another file - Abc_TtStoreWrite( pFileOutput, p ); + Abc_TtStoreWrite( pFileOutput, p, 0 ); // delete data-structure Abc_TtStoreFree( p, -1 ); @@ -471,6 +473,8 @@ void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose ) pAlgoName = "bi-decomp"; else if ( DecType == 3 ) pAlgoName = "DSD"; + else if ( DecType == 4 ) + pAlgoName = "fast DSD"; if ( pAlgoName ) printf( "Applying %-10s to %8d func%s of %2d vars... ", @@ -535,6 +539,24 @@ void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose ) Kit_DsdNtkFree( pNtk ); } } + else if ( DecType == 4 ) + { + extern void Dau_DsdTestOne( word t, int i ); + if ( p->nVars != 6 ) + { + printf( "Currently only works for 6 variables.\n" ); + return; + } + // perform disjoint-support decomposition and count AIG nodes + // (non-DSD blocks are decomposed into 2:1 MUXes, each counting as 3 AIG nodes) + assert( p->nVars == 6 ); + for ( i = 0; i < p->nFuncs; i++ ) + { + if ( fVerbose ) + printf( "%7d : ", i ); + Dau_DsdTestOne( *p->pFuncs[i], i ); + } + } else assert( 0 ); printf( "AIG nodes =%9d ", nNodes ); @@ -585,7 +607,7 @@ int Abc_DecTest( char * pFileName, int DecType, int nVarNum, int fVerbose ) printf( "Using truth tables from file \"%s\"...\n", pFileName ); if ( DecType == 0 ) { if ( nVarNum < 0 ) Abc_TtStoreTest( pFileName ); } - else if ( DecType >= 1 && DecType <= 3 ) + else if ( DecType >= 1 && DecType <= 4 ) Abc_TruthDecTest( pFileName, DecType, nVarNum, fVerbose ); else printf( "Unknown decomposition type value (%d).\n", DecType ); |