diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-12-21 22:22:31 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-12-21 22:22:31 -0800 |
commit | 58d28539a7bfaa4edfa6a549c0802cb4a2aabe41 (patch) | |
tree | 3dbf8ad3467a7e468993f6cf42a1648c21f91b72 /src | |
parent | fa32acde61bed1ce9bfaaeb98b95e4ad6144da2c (diff) | |
download | abc-58d28539a7bfaa4edfa6a549c0802cb4a2aabe41.tar.gz abc-58d28539a7bfaa4edfa6a549c0802cb4a2aabe41.tar.bz2 abc-58d28539a7bfaa4edfa6a549c0802cb4a2aabe41.zip |
Gate sizing with barrier buffers.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abc/abc.h | 2 | ||||
-rw-r--r-- | src/base/abc/abcDfs.c | 25 | ||||
-rw-r--r-- | src/base/abc/abcNtk.c | 44 | ||||
-rw-r--r-- | src/map/scl/sclSize.h | 1 | ||||
-rw-r--r-- | src/map/scl/sclUpsize.c | 25 | ||||
-rw-r--r-- | src/map/scl/sclUtil.c | 27 |
6 files changed, 123 insertions, 1 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index 6e5f3301..d684d3df 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -610,6 +610,7 @@ extern ABC_DLL Abc_Ntk_t * Abc_NtkDarLatchSweep( Abc_Ntk_t * pNtk, int fL extern ABC_DLL float Abc_NtkDelayTraceLut( Abc_Ntk_t * pNtk, int fUseLutLib ); /*=== abcDfs.c ==========================================================*/ extern ABC_DLL Vec_Ptr_t * Abc_NtkDfs( Abc_Ntk_t * pNtk, int fCollectAll ); +extern ABC_DLL Vec_Ptr_t * Abc_NtkDfs2( Abc_Ntk_t * pNtk ); extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes ); extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse( Abc_Ntk_t * pNtk ); extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverseNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes ); @@ -755,6 +756,7 @@ extern ABC_DLL Abc_Ntk_t * Abc_NtkStartRead( char * pName ); extern ABC_DLL void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk ); extern ABC_DLL Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk ); extern ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs( Abc_Ntk_t * pNtk ); +extern ABC_DLL Abc_Ntk_t * Abc_NtkDupDfsNoBarBufs( Abc_Ntk_t * pNtk ); extern ABC_DLL Abc_Ntk_t * Abc_NtkDupTransformMiter( Abc_Ntk_t * pNtk ); extern ABC_DLL Abc_Ntk_t * Abc_NtkCreateCone( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode, char * pNodeName, int fUseAllCis ); extern ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, int fUseAllCis ); diff --git a/src/base/abc/abcDfs.c b/src/base/abc/abcDfs.c index 1825087e..9dd2b4bf 100644 --- a/src/base/abc/abcDfs.c +++ b/src/base/abc/abcDfs.c @@ -110,6 +110,31 @@ Vec_Ptr_t * Abc_NtkDfs( Abc_Ntk_t * pNtk, int fCollectAll ) Synopsis [Returns the DFS ordered array of logic nodes.] + Description [Collects only the internal nodes, leaving out CIs and CO. + However it marks with the current TravId both CIs and COs.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Ptr_t * Abc_NtkDfs2( Abc_Ntk_t * pNtk ) +{ + Vec_Ptr_t * vNodes = Vec_PtrAlloc( 100 ); + Abc_Obj_t * pObj; int i; + Abc_NtkIncrementTravId( pNtk ); + Abc_NtkForEachCo( pNtk, pObj, i ) + { + Abc_NodeSetTravIdCurrent( pObj ); + Abc_NtkDfs_rec( Abc_ObjFanin0Ntk(Abc_ObjFanin0(pObj)), vNodes ); + } + return vNodes; +} + +/**Function************************************************************* + + Synopsis [Returns the DFS ordered array of logic nodes.] + Description [Collects only the internal nodes, leaving out PIs, POs and latches.] SideEffects [] diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c index cb52924f..ed00968b 100644 --- a/src/base/abc/abcNtk.c +++ b/src/base/abc/abcNtk.c @@ -513,6 +513,50 @@ Abc_Ntk_t * Abc_NtkDupDfs( Abc_Ntk_t * pNtk ) pNtk->pCopy = pNtkNew; return pNtkNew; } +Abc_Ntk_t * Abc_NtkDupDfsNoBarBufs( Abc_Ntk_t * pNtk ) +{ + Vec_Ptr_t * vNodes; + Abc_Ntk_t * pNtkNew; + Abc_Obj_t * pObj, * pFanin; + int i, k; + if ( pNtk == NULL ) + return NULL; + assert( Abc_NtkIsLogic(pNtk) ); + assert( pNtk->nBarBufs2 > 0 ); + // start the network + pNtkNew = Abc_NtkStartFrom( pNtk, pNtk->ntkType, pNtk->ntkFunc ); + // copy the internal nodes + vNodes = Abc_NtkDfs2( pNtk ); + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) + if ( Abc_ObjIsBarBuf(pObj) ) + pObj->pCopy = Abc_ObjFanin0(pObj)->pCopy; + else + Abc_NtkDupObj( pNtkNew, pObj, 0 ); + Vec_PtrFree( vNodes ); + // reconnect all objects (no need to transfer attributes on edges) + Abc_NtkForEachObj( pNtk, pObj, i ) + if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) && !Abc_ObjIsBarBuf(pObj) ) + Abc_ObjForEachFanin( pObj, pFanin, k ) + if ( pObj->pCopy && pFanin->pCopy ) + Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); + // duplicate the EXDC Ntk + if ( pNtk->pExdc ) + pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc ); + if ( pNtk->pExcare ) + pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)pNtk->pExcare ); + // duplicate timing manager + if ( pNtk->pManTime ) + Abc_NtkTimeInitialize( pNtkNew, pNtk ); + if ( pNtk->vPhases ) + Abc_NtkTransferPhases( pNtkNew, pNtk ); + if ( pNtk->pWLoadUsed ) + pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed ); + // check correctness + if ( !Abc_NtkCheck( pNtkNew ) ) + fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" ); + pNtk->pCopy = pNtkNew; + return pNtkNew; +} /**Function************************************************************* diff --git a/src/map/scl/sclSize.h b/src/map/scl/sclSize.h index 771eb820..78c1f2f2 100644 --- a/src/map/scl/sclSize.h +++ b/src/map/scl/sclSize.h @@ -577,6 +577,7 @@ extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_S /*=== sclUtil.c ===============================================================*/ extern void Abc_SclMioGates2SclGates( SC_Lib * pLib, Abc_Ntk_t * p ); extern void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p ); +extern void Abc_SclTransferGates( Abc_Ntk_t * pOld, Abc_Ntk_t * pNew ); extern void Abc_SclPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p ); extern void Abc_SclMinsizePerform( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax, int fVerbose ); extern int Abc_SclCountMinSize( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax ); diff --git a/src/map/scl/sclUpsize.c b/src/map/scl/sclUpsize.c index d5d405d3..5c630735 100644 --- a/src/map/scl/sclUpsize.c +++ b/src/map/scl/sclUpsize.c @@ -865,7 +865,7 @@ void Abc_SclUpsizeRemoveDangling( SC_Man * p, Abc_Ntk_t * pNtk ) SeeAlso [] ***********************************************************************/ -void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ) +void Abc_SclUpsizePerformInt( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ) { SC_Man * p; Vec_Int_t * vPathPos = NULL; // critical POs @@ -1013,6 +1013,29 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars // Abc_NtkCleanMarkAB( pNtk ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ) +{ + Abc_Ntk_t * pNtkNew = pNtk; + if ( pNtk->nBarBufs2 > 0 ) + pNtkNew = Abc_NtkDupDfsNoBarBufs( pNtk ); + Abc_SclUpsizePerformInt( pLib, pNtkNew, pPars ); + if ( pNtk->nBarBufs2 > 0 ) + Abc_SclTransferGates( pNtk, pNtkNew ); + if ( pNtk->nBarBufs2 > 0 ) + Abc_NtkDelete( pNtkNew ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/map/scl/sclUtil.c b/src/map/scl/sclUtil.c index 4489e3f2..5af1b88b 100644 --- a/src/map/scl/sclUtil.c +++ b/src/map/scl/sclUtil.c @@ -96,6 +96,33 @@ void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p ) /**Function************************************************************* + Synopsis [Transfer gate sizes from AIG without barbufs.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_SclTransferGates( Abc_Ntk_t * pOld, Abc_Ntk_t * pNew ) +{ + Abc_Obj_t * pObj; int i; + assert( pOld->nBarBufs2 > 0 ); + assert( pNew->nBarBufs2 == 0 ); + Abc_NtkForEachNode( pOld, pObj, i ) + { + if ( pObj->pCopy == NULL ) + continue; + if ( Abc_ObjIsBarBuf(pObj) ) + continue; + assert( Abc_ObjNtk(pObj->pCopy) == pNew ); + pObj->pData = pObj->pCopy->pData; + } +} + +/**Function************************************************************* + Synopsis [Reports percentage of gates of each size.] Description [] |