diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-12-08 14:10:41 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-12-08 14:10:41 -0800 |
commit | 1398de7c46d3b2f4e63a6b10965f1e9f4d62742c (patch) | |
tree | 91897fd6383960f6fb11322500756781250612b0 /src/aig | |
parent | 3e2fad35748982c032ad30d8ccc6d5216213dff2 (diff) | |
download | abc-1398de7c46d3b2f4e63a6b10965f1e9f4d62742c.tar.gz abc-1398de7c46d3b2f4e63a6b10965f1e9f4d62742c.tar.bz2 abc-1398de7c46d3b2f4e63a6b10965f1e9f4d62742c.zip |
Integrating barrier buffers.
Diffstat (limited to 'src/aig')
-rw-r--r-- | src/aig/gia/gia.h | 8 | ||||
-rw-r--r-- | src/aig/gia/giaAiger.c | 9 | ||||
-rw-r--r-- | src/aig/gia/giaDup.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaJf.c | 26 | ||||
-rw-r--r-- | src/aig/gia/giaKf.c | 4 | ||||
-rw-r--r-- | src/aig/gia/giaMan.c | 2 | ||||
-rw-r--r-- | src/aig/gia/giaUtil.c | 8 |
7 files changed, 36 insertions, 23 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index 7b8020ad..9a256302 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -423,7 +423,7 @@ static inline int Gia_ObjIsXor( Gia_Obj_t * pObj ) { static inline int Gia_ObjIsMuxId( Gia_Man_t * p, int iObj ) { return p->pMuxes && p->pMuxes[iObj] > 0; } static inline int Gia_ObjIsMux( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsMuxId( p, Gia_ObjId(p, pObj) ); } static inline int Gia_ObjIsAndReal( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 > pObj->iDiff1 && !Gia_ObjIsMux(p, pObj); } -static inline int Gia_ObjIsBuf( Gia_Obj_t * pObj ) { return pObj->iDiff0 == pObj->iDiff1 && pObj->iDiff0 != GIA_NONE; } +static inline int Gia_ObjIsBarBuf( Gia_Obj_t * pObj ) { return pObj->iDiff0 == pObj->iDiff1 && !pObj->fTerm; } static inline int Gia_ObjIsCand( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) || Gia_ObjIsCi(pObj); } static inline int Gia_ObjIsConst0( Gia_Obj_t * pObj ) { return pObj->iDiff0 == GIA_NONE && pObj->iDiff1 == GIA_NONE; } static inline int Gia_ManObjIsConst0( Gia_Man_t * p, Gia_Obj_t * pObj){ return pObj == p->pObjs; } @@ -955,6 +955,8 @@ static inline int Gia_ObjLutIsMux( Gia_Man_t * p, int Id ) { re static inline int Gia_ManHasCellMapping( Gia_Man_t * p ) { return p->vCellMapping != NULL; } static inline int Gia_ObjIsCell( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, iLit) != 0; } +static inline int Gia_ObjIsCellInv( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, iLit) == -1; } +static inline int Gia_ObjIsCellBuf( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, iLit) == -2; } static inline int Gia_ObjCellSize( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, Vec_IntEntry(p->vCellMapping, iLit)); } static inline int * Gia_ObjCellFanins( Gia_Man_t * p, int iLit ) { return Vec_IntEntryP(p->vCellMapping, Vec_IntEntry(p->vCellMapping, iLit))+1; } static inline int Gia_ObjCellFanin( Gia_Man_t * p, int iLit, int i ){ return Gia_ObjCellFanins(p, iLit)[i]; } @@ -990,6 +992,10 @@ static inline int Gia_ObjCellId( Gia_Man_t * p, int iLit ) { re for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) #define Gia_ManForEachObjReverse1( p, pObj, i ) \ for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) +#define Gia_ManForEachBuf( p, pObj, i ) \ + for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsBarBuf(pObj) ) {} else +#define Gia_ManForEachBufId( p, i ) \ + for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsBarBuf(Gia_ManObj(p, i)) ) {} else #define Gia_ManForEachAnd( p, pObj, i ) \ for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else #define Gia_ManForEachAndId( p, i ) \ diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c index 1f6ba03b..3bbecc7e 100644 --- a/src/aig/gia/giaAiger.c +++ b/src/aig/gia/giaAiger.c @@ -294,7 +294,12 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS iNode1 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit1 >> 1), uLit1 & 1 ); assert( Vec_IntSize(vNodes) == i + 1 + nInputs + nLatches ); if ( fSkipStrash ) - Vec_IntPush( vNodes, Gia_ManAppendAnd(pNew, iNode0, iNode1) ); + { + if ( iNode0 == iNode1 ) + Vec_IntPush( vNodes, Gia_ManAppendBuf(pNew, iNode0) ); + else + Vec_IntPush( vNodes, Gia_ManAppendAnd(pNew, iNode0, iNode1) ); + } else Vec_IntPush( vNodes, Gia_ManHashAnd(pNew, iNode0, iNode1) ); } @@ -1099,7 +1104,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int uLit = Abc_Var2Lit( i, 0 ); uLit0 = Gia_ObjFaninLit0( pObj, i ); uLit1 = Gia_ObjFaninLit1( pObj, i ); - assert( uLit0 < uLit1 ); + assert( Gia_ManBufNum(p) || uLit0 < uLit1 ); Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit - uLit1 ); Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit1 - uLit0 ); if ( Pos > nBufferSize - 10 ) diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c index 5929b3b5..b374ad49 100644 --- a/src/aig/gia/giaDup.c +++ b/src/aig/gia/giaDup.c @@ -999,7 +999,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p ) pObj->Value = Gia_ManAppendXorReal( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); else if ( Gia_ObjIsMux(p, pObj) ) pObj->Value = Gia_ManAppendMuxReal( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) ); - else if ( Gia_ObjIsBuf(pObj) ) + else if ( Gia_ObjIsBarBuf(pObj) ) pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) ); else pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); diff --git a/src/aig/gia/giaJf.c b/src/aig/gia/giaJf.c index 0a0e7d48..e0434338 100644 --- a/src/aig/gia/giaJf.c +++ b/src/aig/gia/giaJf.c @@ -251,7 +251,7 @@ float * Jf_ManInitRefs( Jf_Man_t * pMan ) Gia_ManForEachAnd( p, pObj, i ) { Gia_ObjRefFanin0Inc( p, pObj ); - if ( Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsBarBuf(pObj) ) continue; Gia_ObjRefFanin1Inc( p, pObj ); if ( !Gia_ObjIsMuxType(pObj) ) @@ -311,7 +311,7 @@ void Jf_ManProfileClasses( Jf_Man_t * p ) int i, iFunc, Total = 0, CostTotal = 0, Other = 0, CostOther = 0; printf( "DSD classes that appear in more than %.1f %% of mapped nodes:\n", 0.1 * p->pPars->nVerbLimit ); Gia_ManForEachAnd( p->pGia, pObj, i ) - if ( !Gia_ObjIsBuf(pObj) && Gia_ObjRefNumId(p->pGia, i) ) + if ( !Gia_ObjIsBarBuf(pObj) && Gia_ObjRefNumId(p->pGia, i) ) { iFunc = Jf_CutFuncClass( Jf_ObjCutBest(p, i) ); assert( iFunc < 595 ); @@ -1100,7 +1100,7 @@ static inline void Jf_ObjAssignCut( Jf_Man_t * p, Gia_Obj_t * pObj ) { int iObj = Gia_ObjId(p->pGia, pObj); int pClause[3] = { 1, Jf_CutSetAll(2, 0, 1), Jf_ObjLit(iObj, 0) }; // set function - assert( Gia_ObjIsCi(pObj) || Gia_ObjIsBuf(pObj) ); + assert( Gia_ObjIsCi(pObj) || Gia_ObjIsBarBuf(pObj) ); Vec_IntWriteEntry( &p->vCuts, iObj, Vec_SetAppend( &p->pMem, pClause, 3 ) ); } static inline void Jf_ObjPropagateBuf( Jf_Man_t * p, Gia_Obj_t * pObj, int fReverse ) @@ -1108,7 +1108,7 @@ static inline void Jf_ObjPropagateBuf( Jf_Man_t * p, Gia_Obj_t * pObj, int fReve int iObj = Gia_ObjId( p->pGia, pObj ); int iFanin = Gia_ObjFaninId0( pObj, iObj ); assert( 0 ); - assert( Gia_ObjIsBuf(pObj) ); + assert( Gia_ObjIsBarBuf(pObj) ); if ( fReverse ) ABC_SWAP( int, iObj, iFanin ); Vec_IntWriteEntry( &p->vArr, iObj, Jf_ObjArr(p, iFanin) ); @@ -1247,9 +1247,9 @@ void Jf_ManComputeCuts( Jf_Man_t * p, int fEdge ) } Gia_ManForEachObj( p->pGia, pObj, i ) { - if ( Gia_ObjIsCi(pObj) || Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsCi(pObj) || Gia_ObjIsBarBuf(pObj) ) Jf_ObjAssignCut( p, pObj ); - if ( Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsBarBuf(pObj) ) Jf_ObjPropagateBuf( p, pObj, 0 ); else if ( Gia_ObjIsAnd(pObj) ) Jf_ObjComputeCuts( p, pObj, fEdge ); @@ -1291,7 +1291,7 @@ int Jf_ManComputeDelay( Jf_Man_t * p, int fEval ) if ( fEval ) { Gia_ManForEachObj( p->pGia, pObj, i ) - if ( Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsBarBuf(pObj) ) Jf_ObjPropagateBuf( p, pObj, 0 ); else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 ) Vec_IntWriteEntry( &p->vArr, i, Jf_CutArr(p, Jf_ObjCutBest(p, i)) ); @@ -1314,7 +1314,7 @@ int Jf_ManComputeRefs( Jf_Man_t * p ) p->pPars->Area = p->pPars->Edge = 0; Gia_ManForEachObjReverse( p->pGia, pObj, i ) { - if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBarBuf(pObj) ) Gia_ObjRefInc( p->pGia, Gia_ObjFanin0(pObj) ); else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 ) { @@ -1381,7 +1381,7 @@ void Jf_ManPropagateFlow( Jf_Man_t * p, int fEdge ) Gia_Obj_t * pObj; int i; Gia_ManForEachObj( p->pGia, pObj, i ) - if ( Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsBarBuf(pObj) ) Jf_ObjPropagateBuf( p, pObj, 0 ); else if ( Gia_ObjIsAnd(pObj) && Jf_ObjIsUnit(pObj) ) Jf_ObjComputeBestCut( p, pObj, fEdge, 0 ); @@ -1393,7 +1393,7 @@ void Jf_ManPropagateEla( Jf_Man_t * p, int fEdge ) int i, CostBef, CostAft; p->pPars->Area = p->pPars->Edge = p->pPars->Clause = 0; Gia_ManForEachObjReverse( p->pGia, pObj, i ) - if ( Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsBarBuf(pObj) ) Jf_ObjPropagateBuf( p, pObj, 1 ); else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 ) { @@ -1457,7 +1457,7 @@ Gia_Man_t * Jf_ManDeriveMappingGia( Jf_Man_t * p ) // iterate through nodes used in the mapping Gia_ManForEachAnd( p->pGia, pObj, i ) { - if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) + if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) continue; pCut = Jf_ObjCutBest( p, i ); // printf( "Best cut of node %d: ", i ); Jf_CutPrint(pCut); @@ -1549,7 +1549,7 @@ void Jf_ManDeriveMapping( Jf_Man_t * p ) Vec_IntFill( vMapping, Gia_ManObjNum(p->pGia), 0 ); Gia_ManForEachAnd( p->pGia, pObj, i ) { - if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) + if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) continue; pCut = Jf_ObjCutBest( p, i ); Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) ); @@ -1599,7 +1599,7 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p ) Gia_ManHashStart( pNew ); Gia_ManForEachAnd( p->pGia, pObj, i ) { - if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) + if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) continue; pCut = Jf_ObjCutBest( p, i ); // printf( "Best cut of node %d: ", i ); Jf_CutPrint(pCut); diff --git a/src/aig/gia/giaKf.c b/src/aig/gia/giaKf.c index caa88bfc..87f9bfbe 100644 --- a/src/aig/gia/giaKf.c +++ b/src/aig/gia/giaKf.c @@ -914,7 +914,7 @@ int Kf_ManComputeRefs( Kf_Man_t * p ) p->pPars->Area = p->pPars->Edge = 0; Gia_ManForEachObjReverse( p->pGia, pObj, i ) { - if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBuf(pObj) ) + if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBarBuf(pObj) ) Gia_ObjRefInc( p->pGia, Gia_ObjFanin0(pObj) ); else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 ) { @@ -1270,7 +1270,7 @@ Gia_Man_t * Kf_ManDerive( Kf_Man_t * p ) Vec_IntFill( vMapping, Gia_ManObjNum(p->pGia), 0 ); Gia_ManForEachAnd( p->pGia, pObj, i ) { - if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) + if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 ) continue; pCut = Kf_ObjCutBest( p, i ); Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) ); diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c index 44dff1a2..7439ba73 100644 --- a/src/aig/gia/giaMan.c +++ b/src/aig/gia/giaMan.c @@ -436,6 +436,8 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ) Abc_Print( 1, " ch =%5d", Gia_ManChoiceNum(p) ); if ( p->pManTime ) Abc_Print( 1, " box = %d", Gia_ManNonRegBoxNum(p) ); + if ( Gia_ManBufNum(p) ) + Abc_Print( 1, " buf = %d", Gia_ManBufNum(p) ); if ( pPars && pPars->fMuxXor ) printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p ); if ( pPars && pPars->fSwitch ) diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c index 13685eca..69903830 100644 --- a/src/aig/gia/giaUtil.c +++ b/src/aig/gia/giaUtil.c @@ -882,7 +882,7 @@ int Gia_ObjIsMuxType( Gia_Obj_t * pNode ) // check that the node is regular assert( !Gia_IsComplement(pNode) ); // if the node is not AND, this is not MUX - if ( !Gia_ObjIsAnd(pNode) || Gia_ObjIsBuf(pNode) ) + if ( !Gia_ObjIsAnd(pNode) || Gia_ObjIsBarBuf(pNode) ) return 0; // if the children are not complemented, this is not MUX if ( !Gia_ObjFaninC0(pNode) || !Gia_ObjFaninC1(pNode) ) @@ -916,7 +916,7 @@ int Gia_ObjRecognizeExor( Gia_Obj_t * pObj, Gia_Obj_t ** ppFan0, Gia_Obj_t ** pp { Gia_Obj_t * p0, * p1; assert( !Gia_IsComplement(pObj) ); - if ( !Gia_ObjIsAnd(pObj) || Gia_ObjIsBuf(pObj) ) + if ( !Gia_ObjIsAnd(pObj) || Gia_ObjIsBarBuf(pObj) ) return 0; assert( Gia_ObjIsAnd(pObj) ); p0 = Gia_ObjChild0(pObj); @@ -1273,7 +1273,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj ) printf( "RO( %4d%s )", Gia_ObjFaninId0p(p, Gia_ObjRoToRi(p, pObj)), (Gia_ObjFaninC0(Gia_ObjRoToRi(p, pObj))? "\'" : " ") ); else if ( Gia_ObjIsCo(pObj) ) printf( "RI( %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") ); -// else if ( Gia_ObjIsBuf(pObj) ) +// else if ( Gia_ObjIsBarBuf(pObj) ) // printf( "BUF( %d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") ); else if ( Gia_ObjIsXor(pObj) ) printf( "XOR( %4d%s, %4d%s )", @@ -1308,7 +1308,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj ) printf( "Node %4d : ", Gia_ObjId(pFanout) ); if ( Gia_ObjIsPo(pFanout) ) printf( "PO( %4d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") ); - else if ( Gia_ObjIsBuf(pFanout) ) + else if ( Gia_ObjIsBarBuf(pFanout) ) printf( "BUF( %d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") ); else printf( "AND( %4d%s, %4d%s )", |