diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2021-05-18 16:42:16 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2021-05-18 16:42:16 -0700 |
commit | d35b05859c44015661d36aaaa2926e0dd5f3e4dc (patch) | |
tree | bba34a7ff8906f398c8b05c624136a91a0c84a78 /src/base/abci/abc.c | |
parent | 91a2eafc7a04fcce5825cb4e258c137e31ecb7f9 (diff) | |
download | abc-d35b05859c44015661d36aaaa2926e0dd5f3e4dc.tar.gz abc-d35b05859c44015661d36aaaa2926e0dd5f3e4dc.tar.bz2 abc-d35b05859c44015661d36aaaa2926e0dd5f3e4dc.zip |
Adding command &extract.
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r-- | src/base/abci/abc.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index ab80eef3..0ec00864 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -437,6 +437,7 @@ static int Abc_CommandAbc9Dsd ( Abc_Frame_t * pAbc, int argc, cha 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_CommandAbc9Fx ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Extract ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Balance ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9BalanceLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Resub ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -1163,6 +1164,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC9", "&bidec", Abc_CommandAbc9Bidec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&shrink", Abc_CommandAbc9Shrink, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&fx", Abc_CommandAbc9Fx, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&extract", Abc_CommandAbc9Extract, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&b", Abc_CommandAbc9Balance, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&blut", Abc_CommandAbc9BalanceLut, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&resub", Abc_CommandAbc9Resub, 0 ); @@ -34938,6 +34940,72 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandAbc9Extract( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern Gia_Man_t * Abc_NtkShareXorGia( Gia_Man_t * p, int nMultiSize, int fAnd, int fVerbose ); + Gia_Man_t * pTemp; + int nMultiSize = 3; + int c, fAnds = 0; + int fVerbose = 0; + Extra_UtilGetoptReset(); + while ( (c = Extra_UtilGetopt(argc, argv, "Kavh")) != EOF ) + { + switch (c) + { + case 'K': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); + goto usage; + } + nMultiSize = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nMultiSize < 0 ) + goto usage; + break; + case 'a': + fAnds ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + break; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Shrink(): There is no AIG.\n" ); + return 1; + } + pTemp = Abc_NtkShareXorGia( pAbc->pGia, nMultiSize, fAnds, fVerbose ); + Abc_FrameUpdateGia( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &extract [-K <num>] [-vh]\n"); + Abc_Print( -2, "\t extract shared logic for XOR-rich circuits\n"); + Abc_Print( -2, "\t-K <num> : the minimum gate size to consider for extraction [default = %d]\n", nMultiSize ); + Abc_Print( -2, "\t-a : toogle extracting ANDs instead of XORs [default = %s]\n", fAnds? "yes": "no" ); + Abc_Print( -2, "\t-v : print 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_CommandAbc9Balance( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_Man_t * pTemp = NULL; |