diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-09-27 18:50:23 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-09-27 18:50:23 -0700 |
commit | a7fcdf20ab47209c1524b9e3ad612bc949122ef5 (patch) | |
tree | 91aaf40924ee897c71bc1fab29abacde8a6a701b /src/base | |
parent | a695d708108facb4a52571d418905b95bbd9ec9b (diff) | |
download | abc-a7fcdf20ab47209c1524b9e3ad612bc949122ef5.tar.gz abc-a7fcdf20ab47209c1524b9e3ad612bc949122ef5.tar.bz2 abc-a7fcdf20ab47209c1524b9e3ad612bc949122ef5.zip |
Performance balancing command &b.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abci/abc.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index e6d492c1..0b1c6b23 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -350,6 +350,7 @@ static int Abc_CommandAbc9Enable ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc9Dc2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Bidec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Shrink ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Balance ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Append ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -908,6 +909,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC9", "&dc2", Abc_CommandAbc9Dc2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bidec", Abc_CommandAbc9Bidec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&shrink", Abc_CommandAbc9Shrink, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&b", Abc_CommandAbc9Balance, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&miter", Abc_CommandAbc9Miter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&miter2", Abc_CommandAbc9Miter2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&append", Abc_CommandAbc9Append, 0 ); @@ -27405,6 +27407,78 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandAbc9Balance( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp = NULL; + int c,fVerbose = 0; + int fSimpleAnd = 0; + int fKeepLevel = 0; + int nFanoutMax = 50; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "Nlavh" ) ) != EOF ) + { + switch ( c ) + { + case 'N': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by a char string.\n" ); + goto usage; + } + nFanoutMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nFanoutMax < 0 ) + goto usage; + break; + case 'l': + fKeepLevel ^= 1; + break; + case 'a': + fSimpleAnd ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Balance(): There is no AIG.\n" ); + return 1; + } + if ( Gia_ManHasMapping(pAbc->pGia) ) + { + Abc_Print( -1, "Abc_CommandAbc9Balance(): The current AIG is mapped.\n" ); + return 1; + } + pTemp = Gia_ManBalance( pAbc->pGia, fSimpleAnd, fVerbose ); + Abc_FrameUpdateGia( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &b [-avh]\n" ); + Abc_Print( -2, "\t performs AIG balancing to reduce delay\n" ); + Abc_Print( -2, "\t-a : toggle using AND instead of AND/XOR/MUX [default = %s]\n", fSimpleAnd? "yes": "no" ); + 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_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; |