diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-08-23 20:38:55 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-08-23 20:38:55 -0700 |
commit | 0e4561ab9f4070841037a2ac87ef9aaef14d2b03 (patch) | |
tree | eb15298b900db1f28921deca5fbef1e2b3f6ab1d /src/base/cba | |
parent | 033203b7bd2a55a60cb9321824e3c556f5ec999b (diff) | |
download | abc-0e4561ab9f4070841037a2ac87ef9aaef14d2b03.tar.gz abc-0e4561ab9f4070841037a2ac87ef9aaef14d2b03.tar.bz2 abc-0e4561ab9f4070841037a2ac87ef9aaef14d2b03.zip |
Experiments with mapping plus small changes.
Diffstat (limited to 'src/base/cba')
-rw-r--r-- | src/base/cba/cba.h | 15 | ||||
-rw-r--r-- | src/base/cba/cbaNtk.c | 33 |
2 files changed, 36 insertions, 12 deletions
diff --git a/src/base/cba/cba.h b/src/base/cba/cba.h index 7dd1b8ac..a23c2bc7 100644 --- a/src/base/cba/cba.h +++ b/src/base/cba/cba.h @@ -69,6 +69,14 @@ typedef enum { CBA_BOX_MUX, CBA_BOX_MAJ, + CBA_BOX_ABC, + CBA_BOX_BA, + CBA_BOX_BO, + CBA_BOX_BX, + CBA_BOX_BN, + CBA_BOX_BAO, + CBA_BOX_BOA, + CBA_BOX_RAND, CBA_BOX_RNAND, CBA_BOX_ROR, @@ -95,6 +103,7 @@ typedef enum { CBA_BOX_ADD, CBA_BOX_SUB, CBA_BOX_MUL, + CBA_BOX_SMUL, CBA_BOX_DIV, CBA_BOX_MOD, CBA_BOX_REM, @@ -102,6 +111,7 @@ typedef enum { CBA_BOX_MIN, CBA_BOX_ABS, + CBA_BOX_SLTHAN, CBA_BOX_LTHAN, CBA_BOX_LETHAN, CBA_BOX_METHAN, @@ -111,6 +121,7 @@ typedef enum { CBA_BOX_SHIL, CBA_BOX_SHIR, + CBA_BOX_SHIRA, CBA_BOX_ROTL, CBA_BOX_ROTR, @@ -124,6 +135,8 @@ typedef enum { CBA_BOX_RAMR, CBA_BOX_RAMW, CBA_BOX_RAMWC, + CBA_BOX_RAML, + CBA_BOX_RAMS, CBA_BOX_RAMBOX, CBA_BOX_LATCH, @@ -1036,7 +1049,7 @@ extern int Cba_ManIsTopoOrder( Cba_Man_t * p ); extern Vec_Int_t * Cba_NtkCollectDfs( Cba_Ntk_t * p ); extern Cba_Man_t * Cba_ManCollapse( Cba_Man_t * p, int TypeBuf ); extern Cba_Man_t * Cba_ManExtractGroup( Cba_Man_t * p, Vec_Int_t * vObjs ); -extern Cba_Man_t * Cba_ManDeriveFromGia( Gia_Man_t * pGia ); +extern Cba_Man_t * Cba_ManDeriveFromGia( Gia_Man_t * pGia, int fUseXor ); extern Cba_Man_t * Cba_ManInsertGroup( Cba_Man_t * p, Vec_Int_t * vObjs, Cba_Ntk_t * pSyn ); /*=== cbaReadBlif.c ==========================================================*/ extern void Prs_ManReadBlifTest( char * pFileName ); diff --git a/src/base/cba/cbaNtk.c b/src/base/cba/cbaNtk.c index f15df89a..6c312e88 100644 --- a/src/base/cba/cbaNtk.c +++ b/src/base/cba/cbaNtk.c @@ -700,7 +700,7 @@ Cba_Man_t * Cba_ManExtractGroup( Cba_Man_t * p, Vec_Int_t * vObjs ) SeeAlso [] ***********************************************************************/ -static inline int Cba_NtkInsertGiaLit( Cba_Ntk_t * p, int iLit, Vec_Int_t * vLit2Fon ) +static inline int Cba_NtkInsertGiaLit( Cba_Ntk_t * p, int iLit, Vec_Int_t * vLit2Fon, int fUseXor ) { int iObjNew; if ( iLit == 0 || iLit == 1 ) @@ -709,23 +709,34 @@ static inline int Cba_NtkInsertGiaLit( Cba_Ntk_t * p, int iLit, Vec_Int_t * vLit return Vec_IntEntry(vLit2Fon, iLit); assert( Abc_LitIsCompl(iLit) ); assert( Vec_IntEntry(vLit2Fon, Abc_LitNot(iLit)) >= 0 ); - iObjNew = Cba_ObjAlloc( p, CBA_BOX_INV, 1, 1 ); - Cba_ObjSetFinFon( p, iObjNew, 0, Vec_IntEntry(vLit2Fon, Abc_LitNot(iLit)) ); + // create inverter + if ( fUseXor ) + { + iObjNew = Cba_ObjAlloc( p, CBA_BOX_XOR, 2, 1 ); + Cba_ObjSetFinFon( p, iObjNew, 0, Vec_IntEntry(vLit2Fon, Abc_LitNot(iLit)) ); + Cba_ObjSetFinFon( p, iObjNew, 1, Cba_FonFromConst(1) ); + } + else + { + iObjNew = Cba_ObjAlloc( p, CBA_BOX_INV, 1, 1 ); + Cba_ObjSetFinFon( p, iObjNew, 0, Vec_IntEntry(vLit2Fon, Abc_LitNot(iLit)) ); + } + // save the result Vec_IntWriteEntry( vLit2Fon, iLit, Cba_ObjFon0(p, iObjNew) ); return Cba_ObjFon0(p, iObjNew); } -static inline int Cba_NtkInsertGiaObj( Cba_Ntk_t * p, Gia_Man_t * pGia, int iObj, Vec_Int_t * vLit2Fon ) +static inline int Cba_NtkInsertGiaObj( Cba_Ntk_t * p, Gia_Man_t * pGia, int iObj, Vec_Int_t * vLit2Fon, int fUseXor ) { Gia_Obj_t * pObj = Gia_ManObj( pGia, iObj ); int iLit0 = Gia_ObjFaninLit0( pObj, iObj ); int iLit1 = Gia_ObjFaninLit1( pObj, iObj ); - int iFon0 = Cba_NtkInsertGiaLit( p, iLit0, vLit2Fon ); - int iFon1 = Cba_NtkInsertGiaLit( p, iLit1, vLit2Fon ); + int iFon0 = Cba_NtkInsertGiaLit( p, iLit0, vLit2Fon, fUseXor ); + int iFon1 = Cba_NtkInsertGiaLit( p, iLit1, vLit2Fon, fUseXor ); int iObjNew; if ( Gia_ObjIsMux(pGia, pObj) ) { int iLit2 = Gia_ObjFaninLit2( pGia, iObj ); - int iFon2 = Cba_NtkInsertGiaLit( p, iLit2, vLit2Fon ); + int iFon2 = Cba_NtkInsertGiaLit( p, iLit2, vLit2Fon, fUseXor ); iObjNew = Cba_ObjAlloc( p, CBA_BOX_MUX, 3, 1 ); Cba_ObjSetFinFon( p, iObjNew, 0, iFon2 ); Cba_ObjSetFinFon( p, iObjNew, 1, iFon1 ); @@ -741,7 +752,7 @@ static inline int Cba_NtkInsertGiaObj( Cba_Ntk_t * p, Gia_Man_t * pGia, int iObj Vec_IntWriteEntry( vLit2Fon, Abc_Var2Lit(iObj, 0), Cba_ObjFon0(p, iObjNew) ); return iObjNew; } -Cba_Man_t * Cba_ManDeriveFromGia( Gia_Man_t * pGia ) +Cba_Man_t * Cba_ManDeriveFromGia( Gia_Man_t * pGia, int fUseXor ) { Cba_Man_t * p = Cba_ManAlloc( pGia->pSpec, 1, NULL, NULL, NULL, NULL ); Cba_Ntk_t * pNtk = Cba_NtkAlloc( p, Abc_NamStrFindOrAdd(p->pStrs, pGia->pName, NULL), Gia_ManCiNum(pGia), Gia_ManCoNum(pGia), 1000, 2000, 2000 ); @@ -759,19 +770,19 @@ Cba_Man_t * Cba_ManDeriveFromGia( Gia_Man_t * pGia ) Vec_IntWriteEntry( vLit2Fon, Abc_Var2Lit(iObj, 0), Cba_ObjFon0(pNtk, iObjNew) ); } Gia_ManForEachAndId( pGia, iObj ) - Cba_NtkInsertGiaObj( pNtk, pGia, iObj, vLit2Fon ); + Cba_NtkInsertGiaObj( pNtk, pGia, iObj, vLit2Fon, fUseXor ); // create inverters if needed Gia_ManForEachCoId( pGia, iObj, i ) { pObj = Gia_ManObj( pGia, iObj ); iLit0 = Gia_ObjFaninLit0( pObj, iObj ); - iFon0 = Cba_NtkInsertGiaLit( pNtk, iLit0, vLit2Fon ); // can be const! + iFon0 = Cba_NtkInsertGiaLit( pNtk, iLit0, vLit2Fon, fUseXor ); // can be const! } Gia_ManForEachCoId( pGia, iObj, i ) { pObj = Gia_ManObj( pGia, iObj ); iLit0 = Gia_ObjFaninLit0( pObj, iObj ); - iFon0 = Cba_NtkInsertGiaLit( pNtk, iLit0, vLit2Fon ); // can be const! + iFon0 = Cba_NtkInsertGiaLit( pNtk, iLit0, vLit2Fon, fUseXor ); // can be const! iObjNew = Cba_ObjAlloc( pNtk, CBA_BOX_BUF, 1, 1 ); Cba_ObjSetFinFon( pNtk, iObjNew, 0, iFon0 ); iFon0 = Cba_ObjFon0(pNtk, iObjNew); // non-const fon unique for this output |