diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-08-20 20:18:31 +0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-08-20 20:18:31 +0700 |
commit | 21dfaedebd842c240e770d3bcfb62e2fb4531b40 (patch) | |
tree | 78e1a3b8b0c7484306acc64e203ebb436dab6e54 /src/base/abci/abcPrint.c | |
parent | b71b5bbc233492321566551b7b5a69d99beaa297 (diff) | |
download | abc-21dfaedebd842c240e770d3bcfb62e2fb4531b40.tar.gz abc-21dfaedebd842c240e770d3bcfb62e2fb4531b40.tar.bz2 abc-21dfaedebd842c240e770d3bcfb62e2fb4531b40.zip |
Experiments with SPFD-based decomposition + new K-map print-out.
Diffstat (limited to 'src/base/abci/abcPrint.c')
-rw-r--r-- | src/base/abci/abcPrint.c | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index 352ddf52..9e2f48d3 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -1384,6 +1384,118 @@ float Abc_NtkMfsTotalGlitching( Abc_Ntk_t * pNtk ) return nSwitches ? 100.0*(nGlitches-nSwitches)/nSwitches : 0.0; } +/**Function************************************************************* + + Synopsis [Prints K-map of 6-var function represented by truth table.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_Show6VarFunc( word F0, word F1 ) +{ + // order of cells in the Karnaugh map +// int Cells[8] = { 0, 1, 3, 2, 6, 7, 5, 4 }; + int Cells[8] = { 0, 4, 6, 2, 3, 7, 5, 1 }; + // intermediate variables + int s; // symbol counter + int h; // horizontal coordinate; + int v; // vertical coordinate; + assert( (F0 & F1) == 0 ); + + // output minterms above + for ( s = 0; s < 4; s++ ) + printf( " " ); + printf( " " ); + for ( h = 0; h < 8; h++ ) + { + for ( s = 0; s < 3; s++ ) + printf( "%d", ((Cells[h] >> (2-s)) & 1) ); + printf( " " ); + } + printf( "\n" ); + + // output horizontal line above + for ( s = 0; s < 4; s++ ) + printf( " " ); + printf( "+" ); + for ( h = 0; h < 8; h++ ) + { + for ( s = 0; s < 3; s++ ) + printf( "-" ); + printf( "+" ); + } + printf( "\n" ); + + // output lines with function values + for ( v = 0; v < 8; v++ ) + { + for ( s = 0; s < 3; s++ ) + printf( "%d", ((Cells[v] >> (2-s)) & 1) ); + printf( " |" ); + + for ( h = 0; h < 8; h++ ) + { + printf( " " ); + if ( ((F0 >> ((Cells[v]*8)+Cells[h])) & 1) ) + printf( "0" ); + else if ( ((F1 >> ((Cells[v]*8)+Cells[h])) & 1) ) + printf( "1" ); + else + printf( " " ); + printf( " |" ); + } + printf( "\n" ); + + // output horizontal line above + for ( s = 0; s < 4; s++ ) + printf( " " ); +// printf( "%c", v == 7 ? '+' : '|' ); + printf( "+" ); + for ( h = 0; h < 8; h++ ) + { + for ( s = 0; s < 3; s++ ) + printf( "-" ); +// printf( "%c", v == 7 ? '+' : '|' ); + printf( "%c", (v == 7 || h == 7) ? '+' : '|' ); + } + printf( "\n" ); + } +} + +/**Function************************************************************* + + Synopsis [Prints K-map of 6-var function represented by truth table.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_NtkShow6VarFunc( char * pF0, char * pF1 ) +{ + word F0, F1; + if ( strlen(pF0) != 16 ) + { + printf( "Wrong length (%d) of 6-var truth table (%s).\n", strlen(pF0), pF0 ); + return; + } + if ( strlen(pF1) != 16 ) + { + printf( "Wrong length (%d) of 6-var truth table (%s).\n", strlen(pF1), pF1 ); + return; + } + Extra_ReadHexadecimal( (unsigned *)&F0, pF0, 6 ); + Extra_ReadHexadecimal( (unsigned *)&F1, pF1, 6 ); + Abc_Show6VarFunc( F0, F1 ); +} + + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |