diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2007-12-25 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2007-12-25 08:01:00 -0800 |
commit | 00e9c3d06b590b0aac04bafddfd14115d14760f8 (patch) | |
tree | ac9b977538874c9f3b16ac03de0fd7265d19e025 /src/aig/ntl/ntlTime.c | |
parent | 14c01eaccab87d14d1bd0eaa3fc491026349665e (diff) | |
download | abc-00e9c3d06b590b0aac04bafddfd14115d14760f8.tar.gz abc-00e9c3d06b590b0aac04bafddfd14115d14760f8.tar.bz2 abc-00e9c3d06b590b0aac04bafddfd14115d14760f8.zip |
Version abc71225
Diffstat (limited to 'src/aig/ntl/ntlTime.c')
-rw-r--r-- | src/aig/ntl/ntlTime.c | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/src/aig/ntl/ntlTime.c b/src/aig/ntl/ntlTime.c new file mode 100644 index 00000000..d4bd1375 --- /dev/null +++ b/src/aig/ntl/ntlTime.c @@ -0,0 +1,134 @@ +/**CFile**************************************************************** + + FileName [ntlTime.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Netlist representation.] + + Synopsis [Creates timing manager.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 20, 2005.] + + Revision [$Id: ntlTime.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include "ntl.h" + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +float * Ntl_ManCreateDelayTable( Vec_Int_t * vDelays, int nIns, int nOuts ) +{ + float * pDelayTable, Delay; + int iIn, iOut, i, k; + assert( Vec_IntSize(vDelays) % 3 == 0 ); + pDelayTable = ALLOC( float, nIns * nOuts ); + memset( pDelayTable, 0, sizeof(float) * nIns * nOuts ); + Vec_IntForEachEntry( vDelays, iIn, i ) + { + iOut = Vec_IntEntry(vDelays, ++i); + Delay = Aig_Int2Float( Vec_IntEntry(vDelays, ++i) ); + if ( iIn == -1 && iOut == -1 ) + for ( k = 0; k < nIns * nOuts; k++ ) + pDelayTable[k] = Delay; + else if ( iIn == -1 ) + for ( k = 0; k < nIns; k++ ) + pDelayTable[iOut * nIns + k] = Delay; + else if ( iOut == -1 ) + for ( k = 0; k < nOuts; k++ ) + pDelayTable[k * nIns + iIn] = Delay; + else + pDelayTable[iOut * nIns + iIn] = Delay; + } + return pDelayTable; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Aig_TMan_t * Ntl_ManCreateTiming( Ntl_Man_t * p ) +{ + Aig_TMan_t * pMan; + Vec_Ptr_t * vDelayTables; + Ntl_Mod_t * pRoot, * pModel; + Ntl_Obj_t * pObj; + int i, curPi, curPo, Entry; + assert( p->pAig != NULL ); + // start the timing manager + pMan = Aig_TManStart( Aig_ManPiNum(p->pAig), Aig_ManPoNum(p->pAig) ); + // add arrival time info for the true PIs + pRoot = Vec_PtrEntry( p->vModels, 0 ); + Ntl_ModelForEachPi( pRoot, pObj, i ) + Aig_TManInitPiArrival( pMan, i, 0.0 ); + // unpack the data in the arrival times + if ( pRoot->vArrivals ) + Vec_IntForEachEntry( pRoot->vArrivals, Entry, i ) + Aig_TManInitPiArrival( pMan, Entry, Vec_IntEntry(pRoot->vArrivals,++i) ); + // add the required time into for the true POs + pRoot = Vec_PtrEntry( p->vModels, 0 ); + Ntl_ModelForEachPo( pRoot, pObj, i ) + Aig_TManInitPoRequired( pMan, i, AIG_INFINITY ); + // unpack the data in the required times + if ( pRoot->vRequireds ) + Vec_IntForEachEntry( pRoot->vRequireds, Entry, i ) + Aig_TManInitPoRequired( pMan, Entry, Vec_IntEntry(pRoot->vRequireds,++i) ); + // derive timing tables + vDelayTables = Vec_PtrAlloc( Vec_PtrSize(p->vModels) ); + Ntl_ManForEachModel( p, pModel, i ) + { + if ( pModel->vDelays ) + pModel->pDelayTable = Ntl_ManCreateDelayTable( pModel->vDelays, Ntl_ModelPiNum(pModel), Ntl_ModelPoNum(pModel) ); + Vec_PtrPush( vDelayTables, pModel->pDelayTable ); + } + Aig_TManSetDelayTables( pMan, vDelayTables ); + // set up the boxes + curPi = Ntl_ModelPiNum(pRoot); + curPo = Ntl_ModelPoNum(pRoot); + Ntl_ManForEachBox( p, pObj, i ) + { + Aig_TManCreateBoxFirst( pMan, curPo, Ntl_ObjFanoutNum(pObj), curPi, Ntl_ObjFaninNum(pObj), pObj->pImplem->pDelayTable ); + curPo += Ntl_ObjFanoutNum(pObj); + curPi += Ntl_ObjFaninNum(pObj); + } + // forget refs to the delay tables in the network + Ntl_ManForEachModel( p, pModel, i ) + pModel->pDelayTable = NULL; + return pMan; +} + + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + |