diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index ee79ccd7a..1d0290c04 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -1358,7 +1358,7 @@ extern Gia_Man_t * Gia_ManDupZero( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManDupPerm( Gia_Man_t * p, Vec_Int_t * vPiPerm ); extern Gia_Man_t * Gia_ManDupPermFlop( Gia_Man_t * p, Vec_Int_t * vFfPerm ); extern Gia_Man_t * Gia_ManDupPermFlopGap( Gia_Man_t * p, Vec_Int_t * vFfPerm ); -extern void Gia_ManDupAppend( Gia_Man_t * p, Gia_Man_t * pTwo ); +extern void Gia_ManDupAppend( Gia_Man_t * p, Gia_Man_t * pTwo, int fShareCis ); extern void Gia_ManDupAppendShare( Gia_Man_t * p, Gia_Man_t * pTwo ); extern Gia_Man_t * Gia_ManDupAppendNew( Gia_Man_t * pOne, Gia_Man_t * pTwo ); extern Gia_Man_t * Gia_ManDupAppendCones( Gia_Man_t * p, Gia_Man_t ** ppCones, int nCones, int fOnlyRegs ); diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c index cca6f3d4c..be6eef7a2 100644 --- a/src/aig/gia/giaDup.c +++ b/src/aig/gia/giaDup.c @@ -1134,7 +1134,7 @@ Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ -void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo ) +void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo, int fShareCis ) { Gia_Obj_t * pObj; int i; @@ -1148,7 +1148,7 @@ void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo ) if ( Gia_ObjIsAnd(pObj) ) pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); else if ( Gia_ObjIsCi(pObj) ) - pObj->Value = Gia_ManAppendCi( pNew ); + pObj->Value = fShareCis ? Gia_ManCiLit(pNew, Gia_ObjCioId(pObj)) : Gia_ManAppendCi( pNew ); else if ( Gia_ObjIsCo(pObj) ) pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); } diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 146f54ac8..d6fd5c5c6 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -39767,13 +39767,16 @@ int Abc_CommandAbc9Append( Abc_Frame_t * pAbc, int argc, char ** argv ) char * FileName, * pTemp; char ** pArgvNew; int nArgcNew; - int c; + int c, fShareCis = 0; int fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "ivh" ) ) != EOF ) { switch ( c ) { + case 'i': + fShareCis ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -39813,14 +39816,20 @@ int Abc_CommandAbc9Append( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Reading AIGER has failed.\n" ); return 0; } + if ( fShareCis && Gia_ManCiNum(pAbc->pGia) != Gia_ManCiNum(pSecond) ) + { + Abc_Print( -1, "The AIGs have different number of combinational inputs.\n" ); + return 0; + } // compute the miter - Gia_ManDupAppend( pAbc->pGia, pSecond ); + Gia_ManDupAppend( pAbc->pGia, pSecond, fShareCis ); Gia_ManStop( pSecond ); return 0; usage: - Abc_Print( -2, "usage: &append [-vh] \n" ); + Abc_Print( -2, "usage: &append [-ivh] \n" ); Abc_Print( -2, "\t appends to the current AIG using new PIs and POs\n" ); + Abc_Print( -2, "\t-i : toggle sharing combinational inputs [default = %s]\n", fShareCis? "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"); Abc_Print( -2, "\t : AIGER file with the design to miter\n");