From e37bbba72d101debccd1f896f8a2aa09ebfbb297 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 6 Dec 2017 13:00:08 -0800 Subject: An improvement to 'twoexact' and 'lutexact'. --- src/base/abci/abc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index e04c651e..f4bbaf16 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -8229,6 +8229,16 @@ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Truth table should be given on the command line.\n" ); return 1; } + if ( (1 << (nVars-2)) != (int)strlen(pTtStr) ) + { + Abc_Print( -1, "Truth table is expected to have %d hex digits (instead of %d).\n", (1 << (nVars-2)), strlen(pTtStr) ); + return 1; + } + if ( nVars > nNodes * (2 - 1) + 1 ) + { + Abc_Print( -1, "Function with %d variales cannot be implemented with %d two-input gates.\n", nVars, nNodes ); + return 1; + } if ( nVars > 10 ) { Abc_Print( -1, "Function should not have more than 10 inputs.\n" ); @@ -8250,6 +8260,13 @@ usage: Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose ? "yes" : "no" ); Abc_Print( -2, "\t-h : print the command usage\n" ); Abc_Print( -2, "\t : truth table in hex notation\n" ); + Abc_Print( -2, "\t \n" ); + Abc_Print( -2, "\t For example, command line \"twoexact -g -I 5 -N 12 169AE443\"\n" ); + Abc_Print( -2, "\t synthesizes the smallest circuit composed of two-input gates\n" ); + Abc_Print( -2, "\t for the only NPN class of 5-input functions that requires 12 gates;\n" ); + Abc_Print( -2, "\t all other functions can be realized with 11 two-input gates or less\n" ); + Abc_Print( -2, "\t (see Section 7.1.2 \"Boolean evaluation\" in the book by Donald Knuth\n" ); + Abc_Print( -2, "\t http://www.cs.utsa.edu/~wagner/knuth/fasc0c.pdf)\n" ); return 1; } @@ -8329,6 +8346,16 @@ int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Truth table should be given on the command line.\n" ); return 1; } + if ( (1 << (nVars-2)) != (int)strlen(pTtStr) ) + { + Abc_Print( -1, "Truth table is expected to have %d hex digits (instead of %d).\n", (1 << (nVars-2)), strlen(pTtStr) ); + return 1; + } + if ( nVars > nNodes * (nLutSize - 1) + 1 ) + { + Abc_Print( -1, "Function with %d variales cannot be implemented with %d %d-input LUTs.\n", nVars, nNodes, nLutSize ); + return 1; + } if ( nVars > 10 ) { Abc_Print( -1, "Function should not have more than 10 inputs.\n" ); -- cgit v1.2.3