diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2019-05-25 18:39:45 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2019-05-25 18:39:45 -0700 |
commit | 890ff42cb7c80acf3dc4023b7ea430aa283cd8aa (patch) | |
tree | 1fd4743a9fc1340a2b1d7979b0b232b8e5f4fb55 | |
parent | 91b542815488fe23c2d625e69eb2a1add12cf1fe (diff) | |
download | abc-890ff42cb7c80acf3dc4023b7ea430aa283cd8aa.tar.gz abc-890ff42cb7c80acf3dc4023b7ea430aa283cd8aa.tar.bz2 abc-890ff42cb7c80acf3dc4023b7ea430aa283cd8aa.zip |
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bo+ Truth1 = Gia_LutComputeTruth6Simple_rec( p, Gia_ObjFaninId1(pObj, iObj) );
+ Truth0 = Gia_ObjFaninC0(pObj) ? ~Truth0 : Truth0;
+ Truth1 = Gia_ObjFaninC1(pObj) ? ~Truth1 : Truth1;
+ Truth = Gia_ObjIsXor(pObj) ? Truth0 ^ Truth1 : Truth0 & Truth1;
+ return Truth;
+}
+word Gia_LutComputeTruth6Simple( Gia_Man_t * p, int iPo )
+{
+ Gia_Obj_t * pObj = Gia_ManPo( p, iPo );
+ word Truth = Gia_LutComputeTruth6Simple_rec( p, Gia_ObjFaninId0p(p, pObj) );
+ return Gia_ObjFaninC0(pObj) ? ~Truth : Truth;
+
+}
+
+/**Function*************************************************************
+
+ Synopsis [Compute truth table.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
word Gia_LutComputeTruth6_rec( Gia_Man_t * p, int iNode, Vec_Wrd_t * vTruths )
{
Gia_Obj_t * pObj;
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 21b89cee..06cd00f1 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
index 21b89cee..06cd00f1 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -389,6 +389,7 @@ static int Abc_CommandAbc9PFan ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9PSig ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Status ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9MuxProfile ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandAbc9PrintTruth ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Unate ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Rex2Gia ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9RexWalk ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1086,6 +1087,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&psig", Abc_CommandAbc9PSig, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&status", Abc_CommandAbc9Status, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&profile", Abc_CommandAbc9MuxProfile, 0 );
+ Cmd_CommandAdd( pAbc, "ABC9", "&print_truth", Abc_CommandAbc9PrintTruth, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&unate", Abc_CommandAbc9Unate, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&rex2gia", Abc_CommandAbc9Rex2Gia, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&rexwalk", Abc_CommandAbc9RexWalk, 0 );
@@ -30694,6 +30696,93 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandAbc9PrintTruth( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern word Gia_LutComputeTruth6Simple( Gia_Man_t * p, int iPo );
+ int i, c, iOutNum = 0, nOutRange = -1, fVerbose = 0; word Truth;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "ORvh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'O':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ iOutNum = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( iOutNum < 0 )
+ goto usage;
+ break;
+ case 'R':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ nOutRange = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nOutRange < 0 )
+ goto usage;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9PrintTruth(): There is no AIG.\n" );
+ return 1;
+ }
+ if ( Gia_ManPiNum(pAbc->pGia) > 6 )
+ {
+ Abc_Print( -1, "The number of inputs of the AIG exceeds 6.\n" );
+ return 1;
+ }
+ if ( iOutNum < 0 || iOutNum + nOutRange > Gia_ManPoNum(pAbc->pGia) )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9PrintTruth(): Range of outputs to extract is incorrect.\n" );
+ return 1;
+ }
+ if ( nOutRange == -1 )
+ nOutRange = Gia_ManCoNum(pAbc->pGia);
+ for ( i = iOutNum; i < iOutNum + nOutRange; i++ )
+ {
+ Truth = Gia_LutComputeTruth6Simple( pAbc->pGia, i );
+ printf( "Output %8d : ", i );
+ Extra_PrintHex( stdout, (unsigned *)&Truth, Gia_ManCiNum(pAbc->pGia) );
+ printf( "\n" );
+ }
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: &print_truth [-OR num] [-vh]\n" );
+ Abc_Print( -2, "\t prints truth tables of outputs in hex notation\n" );
+ Abc_Print( -2, "\t-O num : the index of first PO to print [default = %d]\n", iOutNum );
+ Abc_Print( -2, "\t-R num : (optional) the number of outputs to extract [default = all]\n" );
+ Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Abc_CommandAbc9Unate( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Gia_ManCheckUnateTest( Gia_Man_t * p, int fComputeAll, int fVerbose );