diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/gia/giaDup.c | 61 | ||||
-rw-r--r-- | src/base/abci/abc.c | 28 |
2 files changed, 79 insertions, 10 deletions
diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c index 19715e2e..b05c8636 100644 --- a/src/aig/gia/giaDup.c +++ b/src/aig/gia/giaDup.c @@ -2794,6 +2794,67 @@ Gia_Man_t * Gia_ManTransformTwoWord2DualOutput( Gia_Man_t * p ) return pNew; } +void Gia_ManCollectOneSide_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNodes ) +{ + if ( Gia_ObjIsTravIdCurrent(p, pObj) ) + return; + Gia_ObjSetTravIdCurrent(p, pObj); + if ( !Gia_ObjIsAnd(pObj) ) + return; + Gia_ManCollectOneSide_rec( p, Gia_ObjFanin0(pObj), vNodes ); + Gia_ManCollectOneSide_rec( p, Gia_ObjFanin1(pObj), vNodes ); + Vec_IntPush( vNodes, Gia_ObjId(p, pObj) ); +} +Vec_Int_t * Gia_ManCollectOneSide( Gia_Man_t * p, int iSide ) +{ + Gia_Obj_t * pObj; int i; + Vec_Int_t * vNodes = Vec_IntAlloc( Gia_ManAndNum(p) ); + Gia_ManIncrementTravId( p ); + Gia_ManForEachPo( p, pObj, i ) + if ( (i & 1) == iSide ) + Gia_ManCollectOneSide_rec( p, Gia_ObjFanin0(pObj), vNodes ); + return vNodes; +} +Gia_Man_t * Gia_ManTransformDualOutput( Gia_Man_t * p ) +{ + Vec_Int_t * vNodes0 = Gia_ManCollectOneSide( p, 0 ); + Vec_Int_t * vNodes1 = Gia_ManCollectOneSide( p, 1 ); + Gia_Man_t * pNew, * pTemp; + Gia_Obj_t * pObj, * pObj2; + int i, fSwap = 0; + assert( Gia_ManRegNum(p) == 0 ); + assert( (Gia_ManPoNum(p) & 1) == 0 ); + if ( Vec_IntSize(vNodes0) > Vec_IntSize(vNodes1) ) + { + ABC_SWAP( Vec_Int_t *, vNodes0, vNodes1 ); + fSwap = 1; + } + assert( Vec_IntSize(vNodes0) <= Vec_IntSize(vNodes1) ); + pNew = Gia_ManStart( Gia_ManObjNum(p) ); + pNew->pName = Abc_UtilStrsav( p->pName ); + pNew->pSpec = Abc_UtilStrsav( p->pSpec ); + Gia_ManConst0(p)->Value = 0; + Gia_ManHashAlloc( pNew ); + Gia_ManForEachCi( p, pObj, i ) + pObj->Value = Gia_ManAppendCi( pNew ); + Gia_ManForEachObjVec( vNodes0, p, pObj, i ) + pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + Gia_ManForEachObjVec( vNodes1, p, pObj, i ) + pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + Vec_IntFree( vNodes0 ); + Vec_IntFree( vNodes1 ); + Gia_ManForEachPo( p, pObj, i ) + { + pObj2 = Gia_ManPo( p, i^fSwap ); + pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj2) ); + } + Gia_ManHashStop( pNew ); + Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); + pNew = Gia_ManCleanup( pTemp = pNew ); + Gia_ManStop( pTemp ); + return pNew; +} + /**Function************************************************************* Synopsis [Performs 'zero' and 'undc' operation.] diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 1a28eb35..a3fc70be 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -1241,12 +1241,9 @@ void Abc_End( Abc_Frame_t * pAbc ) Sdm_ManQuit(); } Abc_NtkFraigStoreClean(); - if ( Abc_FrameGetGlobalFrame()->pGia ) - Gia_ManStop( Abc_FrameGetGlobalFrame()->pGia ); - if ( Abc_FrameGetGlobalFrame()->pGia2 ) - Gia_ManStop( Abc_FrameGetGlobalFrame()->pGia2 ); - if ( Abc_FrameGetGlobalFrame()->pGiaBest ) - Gia_ManStop( Abc_FrameGetGlobalFrame()->pGiaBest ); + Gia_ManStopP( &pAbc->pGia ); + Gia_ManStopP( &pAbc->pGia2 ); + Gia_ManStopP( &pAbc->pGiaBest ); if ( Abc_NtkRecIsRunning3() ) Abc_NtkRecStop3(); } @@ -12457,7 +12454,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) // Cba_PrsReadBlifTest(); } // Abc_NtkComputePaths( Abc_FrameReadNtk(pAbc) ); -// Acb_DataReadTest(); +// Psl_FileTest(); return 0; usage: Abc_Print( -2, "usage: test [-CKDNM] [-aovwh] <file_name>\n" ); @@ -32152,9 +32149,10 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) int fTrans = 0; int fTransX = 0; int fConvert = 0; + int fTransZ = 0; int fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Idstxyvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Idstxyzvh" ) ) != EOF ) { switch ( c ) { @@ -32184,6 +32182,9 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'y': fConvert ^= 1; break; + case 'z': + fTransZ ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -32193,7 +32194,7 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( fTrans || fTransX || fConvert ) + if ( fTrans || fTransX || fTransZ || fConvert ) { if ( pAbc->pGia == NULL ) { @@ -32215,6 +32216,12 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) pAux = Gia_ManTransformMiter2( pAbc->pGia ); Abc_Print( 1, "The miter (current AIG) is transformed by XORing POs of two word-level outputs.\n" ); } + else if ( fTransZ ) + { + extern Gia_Man_t * Gia_ManTransformDualOutput( Gia_Man_t * p ); + pAux = Gia_ManTransformDualOutput( pAbc->pGia ); + Abc_Print( 1, "The dual-output miter (current AIG) is transformed by ordering sides.\n" ); + } else { pAux = Gia_ManTransformTwoWord2DualOutput( pAbc->pGia ); @@ -32260,7 +32267,7 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: &miter [-I num] [-dstxyvh] <file>\n" ); + Abc_Print( -2, "usage: &miter [-I num] [-dstxyzvh] <file>\n" ); Abc_Print( -2, "\t creates miter of two designs (current AIG vs. <file>)\n" ); Abc_Print( -2, "\t-I num : the number of last PIs to replicate [default = %d]\n", nInsDup ); Abc_Print( -2, "\t-d : toggle creating dual-output miter [default = %s]\n", fDualOut? "yes": "no" ); @@ -32268,6 +32275,7 @@ usage: Abc_Print( -2, "\t-t : toggle XORing POs of dual-output miter [default = %s]\n", fTrans? "yes": "no" ); Abc_Print( -2, "\t-x : toggle XORing POs of two-word miter [default = %s]\n", fTransX? "yes": "no" ); Abc_Print( -2, "\t-y : toggle convering two-word miter into dual-output miter [default = %s]\n", fConvert? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle odering sides of the dual-output miter [default = %s]\n", fTransZ? "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<file> : AIGER file with the design to miter\n"); |