summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-03-18 13:38:37 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2017-03-18 13:38:37 -0700
commit1e5d826c4c244db0bca7b3be90d59e703cc9300f (patch)
treeaeb9624c52f935f1109abdc83d0dc3ad2d0cf94a
parent1ccf3218f05c1cc7b4a69fd41103674e45fdcba4 (diff)
downloadabc-1e5d826c4c244db0bca7b3be90d59e703cc9300f.tar.gz
abc-1e5d826c4c244db0bca7b3be90d59e703cc9300f.tar.bz2
abc-1e5d826c4c244db0bca7b3be90d59e703cc9300f.zip
Code for structural unateness checking.
-rw-r--r--src/aig/gia/module.make1
-rw-r--r--src/base/abci/abc.c51
-rw-r--r--src/base/abci/abcUnate.c6
3 files changed, 58 insertions, 0 deletions
diff --git a/src/aig/gia/module.make b/src/aig/gia/module.make
index 82d5a123..0ee41e8b 100644
--- a/src/aig/gia/module.make
+++ b/src/aig/gia/module.make
@@ -82,4 +82,5 @@ SRC += src/aig/gia/giaAig.c \
src/aig/gia/giaTis.c \
src/aig/gia/giaTruth.c \
src/aig/gia/giaTsim.c \
+ src/aig/gia/giaUnate.c \
src/aig/gia/giaUtil.c
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index bea7fe4b..69bd14e6 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -369,6 +369,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_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 );
static int Abc_CommandAbc9Show ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1022,6 +1023,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", "&unate", Abc_CommandAbc9Unate, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&rex2gia", Abc_CommandAbc9Rex2Gia, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&rexwalk", Abc_CommandAbc9RexWalk, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&show", Abc_CommandAbc9Show, 0 );
@@ -28878,6 +28880,55 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandAbc9Unate( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern void Gia_ManCheckUnateTest( Gia_Man_t * p, int fComputeAll, int fVerbose );
+ int c, fComputeAll = 0, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "avh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'a':
+ fComputeAll ^= 1;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9Unate(): There is no AIG.\n" );
+ return 1;
+ }
+ Gia_ManCheckUnateTest( pAbc->pGia, fComputeAll, fVerbose );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: &unate [-avh]\n" );
+ Abc_Print( -2, "\t prints info about unatements of CO funcs in terms of CI vars\n" );
+ Abc_Print( -2, "\t-a : toggle using efficient computation for all pairs [default = %s]\n", fComputeAll? "yes": "no" );
+ Abc_Print( -2, "\t-v : toggle verbose output [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_CommandAbc9Rex2Gia( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern Gia_Man_t * Gia_ManRex2Gia( char * pStr, int fOrder, int fVerbose );
diff --git a/src/base/abci/abcUnate.c b/src/base/abci/abcUnate.c
index 97b36fbe..63003237 100644
--- a/src/base/abci/abcUnate.c
+++ b/src/base/abci/abcUnate.c
@@ -103,7 +103,10 @@ clkBdd = Abc_Clock() - clk;
// p = Extra_UnateComputeSlow( dd, pbGlobal[i] );
p = Extra_UnateComputeSlow( dd, (DdNode *)Abc_ObjGlobalBdd(pNode) );
if ( fVerbose )
+ {
+ printf( "Out%4d : ", i );
Extra_UnateInfoPrint( p );
+ }
TotalSupps += p->nVars;
TotalUnate += p->nUnate;
Extra_UnateInfoDissolve( p );
@@ -119,7 +122,10 @@ clkBdd = Abc_Clock() - clk;
// p = Extra_UnateComputeFast( dd, pbGlobal[i] );
p = Extra_UnateComputeFast( dd, (DdNode *)Abc_ObjGlobalBdd(pNode) );
if ( fVerbose )
+ {
+ printf( "Out%4d : ", i );
Extra_UnateInfoPrint( p );
+ }
TotalSupps += p->nVars;
TotalUnate += p->nUnate;
Extra_UnateInfoDissolve( p );