From 32314347bae6ddcd841a268e797ec4da45726abb Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 10 Mar 2009 08:01:00 -0700 Subject: Version abc90310 --- src/map/if/ifSeq.c | 71 ++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 40 deletions(-) (limited to 'src/map/if/ifSeq.c') diff --git a/src/map/if/ifSeq.c b/src/map/if/ifSeq.c index 8d1de8c1..e4e27e71 100644 --- a/src/map/if/ifSeq.c +++ b/src/map/if/ifSeq.c @@ -124,6 +124,16 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter ) int fVeryVerbose = 0; int fChange = 0; + if ( nIter == 1 ) + { + // if some latches depend on PIs, update their values + Vec_PtrForEachEntry( p->vLatchOrder, pObj, i ) + { + If_ObjSetLValue( pObj, If_ObjLValue(If_ObjFanin0(pObj)) - p->Period ); + If_ObjSetArrTime( pObj, If_ObjLValue(pObj) ); + } + } + // map the internal nodes p->nCutsMerged = 0; If_ManForEachNode( p, pObj, i ) @@ -158,13 +168,14 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter ) } // compute area and delay + If_ManMarkMapping( p ); if ( fVeryVerbose ) { p->RequiredGlo = If_ManDelayMax( p, 1 ); - p->AreaGlo = If_ManScanMapping(p); +// p->AreaGlo = If_ManScanMapping(p); printf( "S%d: Fi = %6.2f. Del = %6.2f. Area = %8.2f. Cuts = %8d. ", nIter, (float)p->Period, p->RequiredGlo, p->AreaGlo, p->nCutsMerged ); - PRT( "T", clock() - clk ); + ABC_PRT( "T", clock() - clk ); } return fChange; } @@ -185,26 +196,26 @@ int If_ManBinarySearchPeriod( If_Man_t * p ) If_Obj_t * pObj; int i, c, fConverged; int fResetRefs = 0; - p->nAttempts++; // reset initial LValues (PIs to 0; others to -inf) If_ManForEachObj( p, pObj, i ) { - if ( If_ObjIsPi(pObj) || If_ObjIsConst1(pObj) ) - { - If_ObjSetLValue( pObj, (float)0.0 ); - If_ObjSetArrTime( pObj, (float)0.0 ); - } - else - { - If_ObjSetLValue( pObj, (float)-IF_INFINITY ); - If_ObjSetArrTime( pObj, (float)-IF_INFINITY ); - } + If_ObjSetLValue( pObj, (float)-IF_INFINITY ); + If_ObjSetArrTime( pObj, (float)-IF_INFINITY ); // undo any previous mapping, except for CIs if ( If_ObjIsAnd(pObj) ) If_ObjCutBest(pObj)->nLeaves = 0; } + pObj = If_ManConst1( p ); + If_ObjSetLValue( pObj, (float)0.0 ); + If_ObjSetArrTime( pObj, (float)0.0 ); + If_ManForEachPi( p, pObj, i ) + { + pObj = If_ManCi( p, i ); + If_ObjSetLValue( pObj, (float)0.0 ); + If_ObjSetArrTime( pObj, (float)0.0 ); + } // update all values iteratively fConverged = 0; @@ -223,9 +234,10 @@ int If_ManBinarySearchPeriod( If_Man_t * p ) } // report the results + If_ManMarkMapping( p ); if ( p->pPars->fVerbose ) { - p->AreaGlo = If_ManScanMapping(p); +// p->AreaGlo = If_ManScanMapping(p); printf( "Attempt = %2d. Iters = %3d. Area = %10.2f. Fi = %6.2f. ", p->nAttempts, c, p->AreaGlo, (float)p->Period ); if ( fConverged ) printf( " Feasible" ); @@ -279,15 +291,6 @@ void If_ManPerformMappingSeqPost( If_Man_t * p ) If_Obj_t * pObjLi, * pObjLo, * pObj; int i; - // link the latch outputs (CIs) directly to the drivers of latch inputs (COs) - for ( i = 0; i < p->pPars->nLatches; i++ ) - { - pObjLi = If_ManLi( p, i ); - pObjLo = If_ManLo( p, i ); -// printf( "%3d : %2d -> %2d \n", i, -// (int)If_ObjLValue(If_ObjFanin0(pObjLo)), (int)If_ObjLValue(pObjLo) ); - } - // set arrival times assert( p->pPars->pTimesArr != NULL ); If_ManForEachLatchOutput( p, pObjLo, i ) @@ -295,7 +298,7 @@ void If_ManPerformMappingSeqPost( If_Man_t * p ) // set the required times assert( p->pPars->pTimesReq == NULL ); - p->pPars->pTimesReq = ALLOC( float, If_ManCoNum(p) ); + p->pPars->pTimesReq = ABC_ALLOC( float, If_ManCoNum(p) ); If_ManForEachPo( p, pObj, i ) { p->pPars->pTimesReq[i] = p->RequiredGlo2; @@ -338,7 +341,7 @@ int If_ManPerformMappingSeq( If_Man_t * p ) // perform combinational mapping to get the upper bound on the clock period If_ManPerformMappingRound( p, 1, 0, 0, NULL ); - p->RequiredGlo = If_ManDelayMax( p, 0 ); + p->RequiredGlo = If_ManDelayMax( p, 0 ); p->RequiredGlo2 = p->RequiredGlo; // set direct linking of latches with their inputs @@ -373,24 +376,12 @@ int If_ManPerformMappingSeq( If_Man_t * p ) return 0; } } - if ( p->pPars->fVerbose ) +// if ( p->pPars->fVerbose ) { -/* - { - FILE * pTable; - pTable = fopen( "iscas/stats_new.txt", "a+" ); -// fprintf( pTable, "%s ", pNtk->pName ); - fprintf( pTable, "%d ", p->Period ); - // fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) ); -// fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) ); -// fprintf( pTable, "\n" ); - fclose( pTable ); - } -*/ printf( "The best clock period is %3d. ", p->Period ); - PRT( "Sequential time", clock() - clkTotal ); + ABC_PRT( "Time", clock() - clkTotal ); } - p->RequiredGlo = (float)PeriodBest; + p->RequiredGlo = (float)(PeriodBest); // postprocess it using combinational mapping If_ManPerformMappingSeqPost( p ); -- cgit v1.2.3