From 8453afcf8b44461c518a44c050fd13fe466c303a Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 15 Mar 2015 13:27:07 +0700 Subject: Enable arrival/required times in &nf. --- src/aig/gia/giaIf.c | 5 +++++ src/aig/gia/giaNf.c | 18 ++++++++++++++---- src/base/abci/abc.c | 24 +++++++++++++++++++++++- src/base/abci/abcPrint.c | 7 +++++-- 4 files changed, 47 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c index fea46954..8a45701d 100644 --- a/src/aig/gia/giaIf.c +++ b/src/aig/gia/giaIf.c @@ -2031,6 +2031,11 @@ void Gia_ManTransferPacking( Gia_Man_t * p, Gia_Man_t * pGia ) } void Gia_ManTransferTiming( Gia_Man_t * p, Gia_Man_t * pGia ) { + if ( pGia->vInArrs || pGia->vOutReqs ) + { + p->vInArrs = pGia->vInArrs; pGia->vInArrs = NULL; + p->vOutReqs = pGia->vOutReqs; pGia->vOutReqs = NULL; + } if ( pGia->pManTime == NULL || p == pGia ) return; p->pManTime = pGia->pManTime; pGia->pManTime = NULL; diff --git a/src/aig/gia/giaNf.c b/src/aig/gia/giaNf.c index 83000f94..941aadd6 100644 --- a/src/aig/gia/giaNf.c +++ b/src/aig/gia/giaNf.c @@ -1250,15 +1250,18 @@ void Nf_ManCutMatchOne( Nf_Man_t * p, int iObj, int * pCut, int * pCutSet ) Nf_ManCutMatchPrint( p, iObj, 1, &pBest->M[1][1] ); */ } -static inline void Nf_ObjPrepareCi( Nf_Man_t * p, int iObj ) +static inline void Nf_ObjPrepareCi( Nf_Man_t * p, int iObj, float Time ) { + Nf_Mat_t * pD0 = Nf_ObjMatchD( p, iObj, 0 ); + Nf_Mat_t * pA0 = Nf_ObjMatchA( p, iObj, 0 ); Nf_Mat_t * pD = Nf_ObjMatchD( p, iObj, 1 ); Nf_Mat_t * pA = Nf_ObjMatchA( p, iObj, 1 ); + pD0->D = pA0->D = pD->D = pA->D = Time; pD->fCompl = 1; - pD->D = p->InvDelay; + pD->D += p->InvDelay; pD->A = p->InvArea; pA->fCompl = 1; - pA->D = p->InvDelay; + pA->D += p->InvDelay; pA->A = p->InvArea; Nf_ObjMatchD( p, iObj, 0 )->fBest = 1; Nf_ObjMatchD( p, iObj, 1 )->fBest = 1; @@ -1551,6 +1554,13 @@ int Nf_ManSetMapRefs( Nf_Man_t * p ) { Required = Nf_ObjMatchD( p, Gia_ObjFaninId0p(p->pGia, pObj), Gia_ObjFaninC0(pObj) )->D; Required = p->pPars->fDoAverage ? Required * (100.0 + p->pPars->nRelaxRatio) / 100.0 : p->pPars->MapDelay; + // if external required time can be achieved, use it + if ( p->pGia->vOutReqs && Vec_FltEntry(p->pGia->vOutReqs, i) > 0 && Required <= Vec_FltEntry(p->pGia->vOutReqs, i) ) + Required = Vec_FltEntry(p->pGia->vOutReqs, i); + // if external required cannot be achieved, set the earliest possible arrival time +// else if ( p->pGia->vOutReqs && Vec_FltEntry(p->pGia->vOutReqs, i) > 0 && Required > Vec_FltEntry(p->pGia->vOutReqs, i) ) +// ptTime->Rise = ptTime->Fall = ptTime->Worst = Required; + // otherwise, set the global required time Nf_ObjUpdateRequired( p, Gia_ObjFaninId0p(p->pGia, pObj), Gia_ObjFaninC0(pObj), Required ); Nf_ObjMapRefInc( p, Gia_ObjFaninId0p(p->pGia, pObj), Gia_ObjFaninC0(pObj)); } @@ -2111,7 +2121,7 @@ Gia_Man_t * Nf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars ) Nf_ManComputeCuts( p ); Nf_ManPrintQuit( p ); Gia_ManForEachCiId( p->pGia, Id, i ) - Nf_ObjPrepareCi( p, Id ); + Nf_ObjPrepareCi( p, Id, p->pGia->vInArrs ? Vec_FltEntry(p->pGia->vInArrs, i) : 0.0 ); for ( p->Iter = 0; p->Iter < p->pPars->nRounds; p->Iter++ ) { Nf_ManComputeMapping( p ); diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 67dd0e6d..17e15335 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -25884,12 +25884,21 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) pGia = Gia_ManFromAig( pAig ); Aig_ManStop( pAig ); } - // replace + // copy names if ( fNames ) { pGia->vNamesIn = Abc_NtkCollectCiNames( pAbc->pNtkCur ); pGia->vNamesOut = Abc_NtkCollectCoNames( pAbc->pNtkCur ); } + // copy user timing information + if ( pAbc->pNtkCur->pManTime != NULL ) + { + Abc_Ntk_t * pNtk = pAbc->pNtkCur; + Vec_FltFreeP( &pGia->vInArrs ); + Vec_FltFreeP( &pGia->vOutReqs ); + pGia->vInArrs = Vec_FltAllocArray( Abc_NtkGetCiArrivalFloats(pNtk), Abc_NtkCiNum(pNtk) ); + pGia->vOutReqs = Vec_FltAllocArray( Abc_NtkGetCiArrivalFloats(pNtk), Abc_NtkCoNum(pNtk) ); + } Abc_FrameUpdateGia( pAbc, pGia ); return 0; @@ -26003,6 +26012,19 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv ) } } } + // transfer timing information + if ( pAbc->pGia->vInArrs || pAbc->pGia->vOutReqs ) + { + Abc_Obj_t * pObj; int i; + Abc_NtkTimeInitialize( pNtk, NULL ); + if ( pAbc->pGia->vInArrs ) + Abc_NtkForEachCi( pNtk, pObj, i ) + Abc_NtkTimeSetArrival( pNtk, Abc_ObjId(pObj), Vec_FltEntry(pAbc->pGia->vInArrs, i), Vec_FltEntry(pAbc->pGia->vInArrs, i) ); + if ( pAbc->pGia->vOutReqs ) + Abc_NtkForEachCo( pNtk, pObj, i ) + Abc_NtkTimeSetRequired( pNtk, Abc_ObjId(pObj), Vec_FltEntry(pAbc->pGia->vOutReqs, i), Vec_FltEntry(pAbc->pGia->vOutReqs, i) ); + } + // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtk ); if ( fStatusClear ) diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index a6545085..b69804a2 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -286,12 +286,15 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum Abc_Print( 1," bdd =%6d", Abc_NtkGetBddNodeNum(pNtk) - nSingles ); else if ( Abc_NtkHasMapping(pNtk) ) { + int fHasTimeMan = (int)(pNtk->pManTime != NULL); assert( pNtk->pManFunc == Abc_FrameReadLibGen() ); Abc_Print( 1," area =%5.2f", Abc_NtkGetMappedArea(pNtk) ); Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTrace(pNtk, NULL, NULL, 0) ); - if ( pNtk->pManTime ) + if ( !fHasTimeMan && pNtk->pManTime ) + { Abc_ManTimeStop( pNtk->pManTime ); - pNtk->pManTime = NULL; + pNtk->pManTime = NULL; + } } else if ( !Abc_NtkHasBlackbox(pNtk) ) { -- cgit v1.2.3