diff options
Diffstat (limited to 'src/base/abci/abcGen.c')
-rw-r--r-- | src/base/abci/abcGen.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/base/abci/abcGen.c b/src/base/abci/abcGen.c index bfb41374..0b66c476 100644 --- a/src/base/abci/abcGen.c +++ b/src/base/abci/abcGen.c @@ -504,6 +504,48 @@ void Abc_GenFpga( char * pFileName, int nLutSize, int nLuts, int nVars ) fclose( pFile ); } +/**Function************************************************************* + + Synopsis [Generates structure of L K-LUTs implementing an N-var function.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_GenOneHot( char * pFileName, int nVars ) +{ + FILE * pFile; + int i, k, Counter, nDigitsIn, nDigitsOut; + pFile = fopen( pFileName, "w" ); + fprintf( pFile, "# One-hotness condition for %d vars generated by ABC on %s\n", nVars, Extra_TimeStamp() ); + fprintf( pFile, ".model 1hot_%dvars\n", nVars ); + fprintf( pFile, ".inputs" ); + nDigitsIn = Extra_Base10Log( nVars ); + for ( i = 0; i < nVars; i++ ) + fprintf( pFile, " i%0*d", nDigitsIn, i ); + fprintf( pFile, "\n" ); + fprintf( pFile, ".outputs" ); + nDigitsOut = Extra_Base10Log( nVars * (nVars - 1) / 2 ); + for ( i = 0; i < nVars * (nVars - 1) / 2; i++ ) + fprintf( pFile, " o%0*d", nDigitsOut, i ); + fprintf( pFile, "\n" ); + Counter = 0; + for ( i = 0; i < nVars; i++ ) + for ( k = i+1; k < nVars; k++ ) + { + fprintf( pFile, ".names i%0*d i%0*d o%0*d\n", nDigitsIn, i, nDigitsIn, k, nDigitsOut, Counter ); + fprintf( pFile, "11 0\n" ); + Counter++; + } + fprintf( pFile, ".end\n" ); + fprintf( pFile, "\n" ); + fclose( pFile ); +} + + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |