From 118776f39dcc3bbcfa0675807aae1abea639a340 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 26 Feb 2015 11:37:42 -0800 Subject: Adding switch -x to command &fadds. --- src/aig/gia/giaFadds.c | 19 ++++++++++++------- src/base/abci/abc.c | 14 +++++++++----- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/aig/gia/giaFadds.c b/src/aig/gia/giaFadds.c index 37e9da51..4a3a07ea 100644 --- a/src/aig/gia/giaFadds.c +++ b/src/aig/gia/giaFadds.c @@ -765,7 +765,7 @@ int Gia_ObjFanin1CopyCarry( Vec_Int_t * vCarries, Gia_Obj_t * pObj, int Id ) return Gia_ObjFanin1Copy(pObj); return Abc_LitNotCond( Vec_IntEntry(vCarries, Gia_ObjFaninId1(pObj, Id)), Gia_ObjFaninC1(pObj) ); } -Gia_Man_t * Gia_ManDupWithArtificalFaddBoxes( Gia_Man_t * p, int fUseFanout ) +Gia_Man_t * Gia_ManDupWithArtificalFaddBoxes( Gia_Man_t * p, int fUseFanout, int fXorTrick ) { Gia_Man_t * pNew; Gia_Obj_t * pObj; @@ -821,7 +821,7 @@ Gia_Man_t * Gia_ManDupWithArtificalFaddBoxes( Gia_Man_t * p, int fUseFanout ) pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); else // AND-gate with chain { - int iCiLit, iOtherLit, iLit0, iLit1, iLit2; + int iCiLit, iOtherLit, iLit0, iLit1, iLit2, iXorLit; assert( pObj->fMark0 != pObj->fMark1 ); iCiLit = pObj->fMark0 ? Gia_ObjFanin0CopyCarry(vCarries, pObj, i) : Gia_ObjFanin1CopyCarry(vCarries, pObj, i); iOtherLit = pObj->fMark0 ? Gia_ObjFanin1Copy(pObj) : Gia_ObjFanin0Copy(pObj); @@ -835,14 +835,19 @@ Gia_Man_t * Gia_ManDupWithArtificalFaddBoxes( Gia_Man_t * p, int fUseFanout ) Gia_ManAppendCo( pNew, iLit1 ); Gia_ManAppendCo( pNew, iLit2 ); // add CI (unused sum bit) - Gia_ManAppendCi(pNew); + iXorLit = Gia_ManAppendCi(pNew); // add CI (carry bit) pObj->Value = Abc_LitNotCond( Gia_ManAppendCi(pNew), Abc_LitIsCompl(iCiLit) ); if ( vCarries && pObj->fPhase ) { Vec_IntWriteEntry( vCarries, i, pObj->Value ); if ( Gia_ObjRefNum(p, pObj) > 0 ) - pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + { + if ( fXorTrick ) + pObj->Value = Gia_ManAppendAnd( pNew, Abc_LitNotCond(iXorLit, !Abc_LitIsCompl(iCiLit)), iOtherLit ); + else + pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + } } nBoxes++; } @@ -877,7 +882,7 @@ Gia_Man_t * Gia_ManDupWithArtificalFaddBoxesTest( Gia_Man_t * p ) } // output new AIG - pNew = Gia_ManDupWithArtificalFaddBoxes( p, 0 ); + pNew = Gia_ManDupWithArtificalFaddBoxes( p, 0, 0 ); Gia_ManCleanMark01( p ); return pNew; } @@ -1079,7 +1084,7 @@ int Gia_ManIteratePaths( Gia_Man_t * p, int DelayC, int nPathMin, int nPathMax, return 1; } // annotate artificial chains and then put them into boxes -Gia_Man_t * Gia_ManDupWithArtificialBoxes( Gia_Man_t * p, int DelayC, int nPathMin, int nPathMax, int nPathLimit, int fUseFanout, int fIgnoreBoxDelays, int fVerbose ) +Gia_Man_t * Gia_ManDupWithArtificialBoxes( Gia_Man_t * p, int DelayC, int nPathMin, int nPathMax, int nPathLimit, int fUseFanout, int fXorTrick, int fIgnoreBoxDelays, int fVerbose ) { Gia_Man_t * pNew; /* @@ -1090,7 +1095,7 @@ Gia_Man_t * Gia_ManDupWithArtificialBoxes( Gia_Man_t * p, int DelayC, int nPathM } */ Gia_ManIteratePaths( p, DelayC, nPathMin, nPathMax, nPathLimit, fIgnoreBoxDelays, fVerbose ); - pNew = Gia_ManDupWithArtificalFaddBoxes( p, fUseFanout ); + pNew = Gia_ManDupWithArtificalFaddBoxes( p, fUseFanout, fXorTrick ); Gia_ManCleanMark01( p ); return pNew; } diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 1b21672c..14d6ddbe 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -36947,12 +36947,12 @@ usage: int Abc_CommandAbc9Fadds( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Gia_Man_t * Gia_ManDupWithNaturalBoxes( Gia_Man_t * p, int nFaddMin, int fVerbose ); - extern Gia_Man_t * Gia_ManDupWithArtificialBoxes( Gia_Man_t * p, int DelayC, int nPathMin, int nPathMax, int nPathLimit, int fUseFanout, int fIgnoreBoxDelays, int fVerbose ); + extern Gia_Man_t * Gia_ManDupWithArtificialBoxes( Gia_Man_t * p, int DelayC, int nPathMin, int nPathMax, int nPathLimit, int fUseFanout, int fXorTrick, int fIgnoreBoxDelays, int fVerbose ); Gia_Man_t * pTemp, * pTemp2; int c, nFaddMin = 3, fUseNat = 0, fUseArt = 0, fVerbose = 0; - int DelayC = 0, nPathMin = 3, nPathMax = 32, nPathLimit = 50, fUseFanout = 0, fIgnoreBoxDelays = 0; + int DelayC = 0, nPathMin = 3, nPathMax = 32, nPathLimit = 50, fUseFanout = 0, fUseXorTrick = 0, fIgnoreBoxDelays = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "NBSLPnafbvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "NBSLPnafxbvh" ) ) != EOF ) { switch ( c ) { @@ -37020,6 +37020,9 @@ int Abc_CommandAbc9Fadds( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'f': fUseFanout ^= 1; break; + case 'x': + fUseXorTrick ^= 1; + break; case 'b': fIgnoreBoxDelays ^= 1; break; @@ -37045,7 +37048,7 @@ int Abc_CommandAbc9Fadds( Abc_Frame_t * pAbc, int argc, char ** argv ) Gia_ManTransferTiming( pTemp, pAbc->pGia ); } if ( fUseArt ) - pTemp2 = Gia_ManDupWithArtificialBoxes( pTemp, DelayC, nPathMin, nPathMax, nPathLimit, fUseFanout, fIgnoreBoxDelays, fVerbose ); + pTemp2 = Gia_ManDupWithArtificialBoxes( pTemp, DelayC, nPathMin, nPathMax, nPathLimit, fUseFanout, fUseXorTrick, fIgnoreBoxDelays, fVerbose ); else { pTemp2 = Gia_ManDup( pTemp ); @@ -37055,7 +37058,7 @@ int Abc_CommandAbc9Fadds( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_FrameUpdateGia( pAbc, pTemp2 ); return 0; usage: - Abc_Print( -2, "usage: &fadds [-NBSLP num] [-nafvh]\n" ); + Abc_Print( -2, "usage: &fadds [-NBSLP num] [-nafxvh]\n" ); Abc_Print( -2, "\t detects full-adder chains and puts them into white boxes\n" ); Abc_Print( -2, "\t-n : toggles detecting natural full-adder chains [default = %s]\n", fUseNat? "yes": "no" ); Abc_Print( -2, "\t-N num : minimum length of a natural full-adder chain to detect [default = %d]\n", nFaddMin ); @@ -37065,6 +37068,7 @@ usage: Abc_Print( -2, "\t-L num : maximum length of an artificial full-adder chain [default = %d]\n", nPathMax ); Abc_Print( -2, "\t-P num : maximum number of artificial full-adder chains to detect [default = %d]\n", nPathLimit ); Abc_Print( -2, "\t-f : toggles allowing external fanouts in artificial chains [default = %s]\n", fUseFanout? "yes": "no" ); + Abc_Print( -2, "\t-x : toggles using XOR to generate fanouts in artificial chains [default = %s]\n", fUseXorTrick? "yes": "no" ); Abc_Print( -2, "\t-b : toggles ignoring boxes when computing delays [default = %s]\n", fIgnoreBoxDelays? "yes": "no" ); Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); -- cgit v1.2.3