diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-07-02 13:58:12 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-07-02 13:58:12 -0700 |
commit | f866920eb5603f60fb087c96607d58c94fb31f28 (patch) | |
tree | b2b92fd38a1c7e79b10ed45baaf13bfa2f8e67bd /src/base | |
parent | 6c2ac7661dc1ea3ddd83617dd247a467e00486de (diff) | |
download | abc-f866920eb5603f60fb087c96607d58c94fb31f28.tar.gz abc-f866920eb5603f60fb087c96607d58c94fb31f28.tar.bz2 abc-f866920eb5603f60fb087c96607d58c94fb31f28.zip |
Added a new demitering feature for dual-output miters.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abci/abc.c | 37 | ||||
-rw-r--r-- | src/base/abci/abcDar.c | 68 |
2 files changed, 100 insertions, 5 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 7486e384..926fb999 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -5513,21 +5513,30 @@ usage: int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes; - int fSeq; + int fDual, fSeq, fVerbose; int c; extern int Abc_NtkDemiter( Abc_Ntk_t * pNtk ); extern int Abc_NtkDarDemiter( Abc_Ntk_t * pNtk ); + extern int Abc_NtkDarDemiterDual( Abc_Ntk_t * pNtk, int fVerbose ); // set defaults + fDual = 0; fSeq = 1; + fVerbose = 1; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "sh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "dsvh" ) ) != EOF ) { switch ( c ) { + case 'd': + fDual ^= 1; + break; case 's': fSeq ^= 1; break; + case 'v': + fVerbose ^= 1; + break; default: goto usage; } @@ -5545,6 +5554,22 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) return 1; } + if ( (Abc_NtkPoNum(pNtk) & 1) ) + { + Abc_Print( -1, "The number of POs should be even.\n" ); + return 0; + } + + if ( fDual ) + { + if ( !Abc_NtkDarDemiterDual( pNtk, fVerbose ) ) + { + Abc_Print( -1, "Demitering has failed.\n" ); + return 1; + } + return 0; + } + // get the new network if ( fSeq ) { @@ -5577,9 +5602,11 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: demiter [-sh]\n" ); - Abc_Print( -2, "\t removes topmost EXOR from the miter to create two POs\n" ); - Abc_Print( -2, "\t-s : applied multi-output algorithm [default = %s]\n", fSeq? "yes": "no" ); + Abc_Print( -2, "usage: demiter [-dsvh]\n" ); + Abc_Print( -2, "\t removes topmost XOR from the miter to create two POs\n" ); + Abc_Print( -2, "\t-d : demiters a dual-output miter (without XORs) [default = %s]\n", fSeq? "yes": "no" ); + Abc_Print( -2, "\t-s : applies a multi-output algorithm [default = %s]\n", fSeq? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles outputting verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } diff --git a/src/base/abci/abcDar.c b/src/base/abci/abcDar.c index c113d856..b1fe8bbe 100644 --- a/src/base/abci/abcDar.c +++ b/src/base/abci/abcDar.c @@ -2051,6 +2051,74 @@ int Abc_NtkDarDemiter( Abc_Ntk_t * pNtk ) Aig_ManStop( pMan ); return 1; } + +/**Function************************************************************* + + Synopsis [Gives the current ABC network to AIG manager for processing.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_NtkDarDemiterDual( Abc_Ntk_t * pNtk, int fVerbose ) +{ + char * pFileNameGeneric, pFileName0[1000], pFileName1[1000]; + Aig_Man_t * pMan, * pPart0, * pPart1;//, * pMiter; + if ( (Abc_NtkPoNum(pNtk) & 1) ) + { + printf( "The number of POs should be even.\n" ); + return 0; + } + // derive the AIG manager + pMan = Abc_NtkToDar( pNtk, 0, 1 ); + if ( pMan == NULL ) + { + printf( "Converting network into AIG has failed.\n" ); + return 0; + } +// if ( !Saig_ManDemiterSimple( pMan, &pPart0, &pPart1 ) ) + if ( !Saig_ManDemiterDual( pMan, &pPart0, &pPart1 ) ) + { + printf( "Demitering has failed.\n" ); + return 0; + } + // create new AIG + ABC_FREE( pPart0->pName ); + pPart0->pName = Aig_UtilStrsav( "part0" ); + // create new AIGs + ABC_FREE( pPart1->pName ); + pPart1->pName = Aig_UtilStrsav( "part1" ); + // create file names + pFileNameGeneric = Extra_FileNameGeneric( pNtk->pSpec ); + sprintf( pFileName0, "%s%s", pFileNameGeneric, "_part0.aig" ); + sprintf( pFileName1, "%s%s", pFileNameGeneric, "_part1.aig" ); + ABC_FREE( pFileNameGeneric ); + Ioa_WriteAiger( pPart0, pFileName0, 0, 0 ); + Ioa_WriteAiger( pPart1, pFileName1, 0, 0 ); + printf( "Demitering produced two files \"%s\" and \"%s\".\n", pFileName0, pFileName1 ); + // dump files + if ( fVerbose ) + { +// printf( "Init: " ); + Aig_ManPrintStats( pMan ); +// printf( "Part1: " ); + Aig_ManPrintStats( pPart0 ); +// printf( "Part2: " ); + Aig_ManPrintStats( pPart1 ); + } + // create two-level miter +// pMiter = Saig_ManCreateMiterTwo( pPart0, pPart1, 2 ); +// Aig_ManDumpBlif( pMiter, "miter01.blif", NULL, NULL ); +// Aig_ManStop( pMiter ); +// printf( "The new miter is written into file \"%s\".\n", "miter01.blif" ); + Aig_ManStop( pPart0 ); + Aig_ManStop( pPart1 ); + Aig_ManStop( pMan ); + return 1; +} /**Function************************************************************* |