diff options
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abci/abc.c | 8 | ||||
-rw-r--r-- | src/base/wln/wlnCom.c | 14 | ||||
-rw-r--r-- | src/base/wln/wlnRead.c | 83 |
3 files changed, 99 insertions, 6 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index cc5de8cd..0414687e 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -50235,6 +50235,14 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Abc_CommandAbc9Test(): There is no AIG.\n" ); return 1; } + if ( argc == globalUtilOptind + 1 ) + { + extern void Gia_ManUpdateCoPhase( Gia_Man_t * pNew, Gia_Man_t * pOld ); + Gia_Man_t * pTemp = Gia_AigerRead( argv[globalUtilOptind], 0, 0, 0 ); + Gia_ManUpdateCoPhase( pAbc->pGia, pTemp ); + Gia_ManStop( pTemp ); + return 0; + } Abc_FrameUpdateGia( pAbc, Gia_ManPerformNewResub(pAbc->pGia, 100, 6, 1, 1) ); // printf( "AIG in \"%s\" has the sum of output support sizes equal to %d.\n", pAbc->pGia->pSpec, Gia_ManSumTotalOfSupportSizes(pAbc->pGia) ); return 0; diff --git a/src/base/wln/wlnCom.c b/src/base/wln/wlnCom.c index eb96132b..c5411607 100644 --- a/src/base/wln/wlnCom.c +++ b/src/base/wln/wlnCom.c @@ -330,13 +330,13 @@ usage: ******************************************************************************/ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose ); + extern Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fRev, int fVerbose ); Gia_Man_t * pNew = NULL; Rtl_Lib_t * pLib = Wln_AbcGetRtl(pAbc); char * pTopModule = NULL; - int c, fInv = 0, fVerbose = 0; + int c, fInv = 0, fRev = 0, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Tcvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Tcrvh" ) ) != EOF ) { switch ( c ) { @@ -352,6 +352,9 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'c': fInv ^= 1; break; + case 'r': + fRev ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -366,16 +369,17 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) printf( "The design is not entered.\n" ); return 1; } - pNew = Rtl_LibCollapse( pLib, pTopModule, fVerbose ); + pNew = Rtl_LibCollapse( pLib, pTopModule, fRev, fVerbose ); if ( fInv ) Gia_ManInvertPos( pNew ); Abc_FrameUpdateGia( pAbc, pNew ); return 0; usage: - Abc_Print( -2, "usage: %%collapse [-T <module>] [-cvh] <file_name>\n" ); + Abc_Print( -2, "usage: %%collapse [-T <module>] [-crvh] <file_name>\n" ); Abc_Print( -2, "\t collapse hierarchical design into an AIG\n" ); Abc_Print( -2, "\t-T : specify the top module of the design [default = none]\n" ); Abc_Print( -2, "\t-c : toggle complementing miter outputs after collapsing [default = %s]\n", fInv? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle bit order reversal in the word-level IO [default = %s]\n", fRev? "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"); return 1; diff --git a/src/base/wln/wlnRead.c b/src/base/wln/wlnRead.c index a27d38d2..b45e51f2 100644 --- a/src/base/wln/wlnRead.c +++ b/src/base/wln/wlnRead.c @@ -1736,6 +1736,42 @@ int Rtl_NtkInsertSignalRange( Rtl_Ntk_t * p, int Sig, int * pLits, int nLits ) SeeAlso [] ***********************************************************************/ +Vec_Int_t * Rtl_NtkRevPermInput( Rtl_Ntk_t * p ) +{ + Vec_Int_t * vNew = Vec_IntAlloc( 100 ); int b, i, Count = 0; + for ( i = 0; i < p->nInputs; i++ ) + { + int Width = Rtl_WireWidth( p, i ); + for ( b = 0; b < Width; b++ ) + Vec_IntPush( vNew, Count + Width-1-b ); + Count += Width; + } + return vNew; +} +Vec_Int_t * Rtl_NtkRevPermOutput( Rtl_Ntk_t * p ) +{ + Vec_Int_t * vNew = Vec_IntAlloc( 100 ); int b, i, Count = 0; + for ( i = 0; i < p->nOutputs; i++ ) + { + int Width = Rtl_WireWidth( p, p->nInputs + i ); + for ( b = 0; b < Width; b++ ) + Vec_IntPush( vNew, Count + Width-1-b ); + Count += Width; + } + return vNew; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ void Rtl_NtkBlastInputs( Gia_Man_t * pNew, Rtl_Ntk_t * p ) { int b, i; @@ -2704,6 +2740,41 @@ Gia_Man_t * Rtl_ReduceInverse( Rtl_Lib_t * pLib, Gia_Man_t * p ) SeeAlso [] ***********************************************************************/ +Gia_Man_t * Gia_ManDupPermIO( Gia_Man_t * p, Vec_Int_t * vPermI, Vec_Int_t * vPermO ) +{ + Gia_Man_t * pNew; + Gia_Obj_t * pObj; + int i; + assert( Vec_IntSize(vPermI) == Gia_ManCiNum(p) ); + assert( Vec_IntSize(vPermO) == Gia_ManCoNum(p) ); + pNew = Gia_ManStart( Gia_ManObjNum(p) ); + Gia_ManConst0(p)->Value = 0; + Gia_ManForEachCi( p, pObj, i ) + Gia_ManCi(p, Vec_IntEntry(vPermI, i))->Value = Gia_ManAppendCi(pNew); + Gia_ManForEachAnd( p, pObj, i ) + { + if ( Gia_ObjIsBuf(pObj) ) + pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) ); + else + pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + assert( Abc_Lit2Var(pObj->Value) == i ); + } + Gia_ManForEachCo( p, pObj, i ) + Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManCo(p, Vec_IntEntry(vPermO, i))) ); + return pNew; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Rtl_LibReturnNtk( Rtl_Lib_t * p, char * pModule ) { int NameId = Wln_ReadFindToken( pModule, p->pManName ); @@ -2715,7 +2786,7 @@ int Rtl_LibReturnNtk( Rtl_Lib_t * p, char * pModule ) } return iNtk; } -Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose ) +Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fRev, int fVerbose ) { Gia_Man_t * pGia = NULL; int NameId = Wln_ReadFindToken( pTopModule, p->pManName ); @@ -2733,6 +2804,16 @@ Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose ) Vec_IntPush( vRoots, iNtk ); Rtl_LibBlast2( p, vRoots, 1 ); pGia = Gia_ManDup( pTop->pGia ); + if ( fRev ) + { + Gia_Man_t * pTemp; + Vec_Int_t * vPermI = Rtl_NtkRevPermInput( pTop ); + Vec_Int_t * vPermO = Rtl_NtkRevPermOutput( pTop ); + pGia = Gia_ManDupPermIO( pTemp = pGia, vPermI, vPermO ); + Vec_IntFree( vPermI ); + Vec_IntFree( vPermO ); + Gia_ManStop( pTemp ); + } //Gia_AigerWrite( pGia, "temp_miter.aig", 0, 0, 0 ); if ( pTop->pGia->vBarBufs ) pGia->vBarBufs = Vec_IntDup( pTop->pGia->vBarBufs ); |