From 19586f105cd15279084541a5edf033724a32be49 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 14 Dec 2015 00:44:33 -0800 Subject: Adding code to support gate profiles. --- src/map/mapper/mapper.h | 1 + src/map/mapper/mapperCreate.c | 1 + src/map/mapper/mapperInt.h | 5 +++-- src/map/mapper/mapperMatch.c | 29 +++++++++++++++++++++++------ src/map/mapper/mapperRefs.c | 41 +++++++++++++++++++++++++++++++---------- 5 files changed, 59 insertions(+), 18 deletions(-) (limited to 'src/map/mapper') diff --git a/src/map/mapper/mapper.h b/src/map/mapper/mapper.h index 169223d8..f0fcea83 100644 --- a/src/map/mapper/mapper.h +++ b/src/map/mapper/mapper.h @@ -109,6 +109,7 @@ extern void Map_ManSetChoiceNum( Map_Man_t * p, int nChoices ); extern void Map_ManSetVerbose( Map_Man_t * p, int fVerbose ); extern void Map_ManSetSwitching( Map_Man_t * p, int fSwitching ); extern void Map_ManSetSkipFanout( Map_Man_t * p, int fSkipFanout ); +extern void Map_ManSetUseProfile( Map_Man_t * p ); extern Map_Man_t * Map_NodeReadMan( Map_Node_t * p ); extern char * Map_NodeReadData( Map_Node_t * p, int fPhase ); diff --git a/src/map/mapper/mapperCreate.c b/src/map/mapper/mapperCreate.c index e7ad4819..d3e574f3 100644 --- a/src/map/mapper/mapperCreate.c +++ b/src/map/mapper/mapperCreate.c @@ -74,6 +74,7 @@ void Map_ManSetChoiceNum( Map_Man_t * p, int nChoices ) { p-> void Map_ManSetVerbose( Map_Man_t * p, int fVerbose ) { p->fVerbose = fVerbose; } void Map_ManSetSwitching( Map_Man_t * p, int fSwitching ) { p->fSwitching = fSwitching; } void Map_ManSetSkipFanout( Map_Man_t * p, int fSkipFanout ) { p->fSkipFanout = fSkipFanout; } +void Map_ManSetUseProfile( Map_Man_t * p ) { p->fUseProfile = 1; } /**Function************************************************************* diff --git a/src/map/mapper/mapperInt.h b/src/map/mapper/mapperInt.h index 28f40a82..79c8d61a 100644 --- a/src/map/mapper/mapperInt.h +++ b/src/map/mapper/mapperInt.h @@ -123,6 +123,7 @@ struct Map_ManStruct_t_ int nTravIds; // the traversal counter int fSwitching; // use switching activity int fSkipFanout; // skip large gates when mapping high-fanout nodes + int fUseProfile; // use standard-cell profile // the supergate library Map_SuperLib_t * pSuperLib; // the current supergate library @@ -385,8 +386,8 @@ extern void Map_MappingEstimateRefs( Map_Man_t * p ); extern float Map_CutGetAreaFlow( Map_Cut_t * pCut, int fPhase ); extern float Map_CutGetAreaRefed( Map_Cut_t * pCut, int fPhase ); extern float Map_CutGetAreaDerefed( Map_Cut_t * pCut, int fPhase ); -extern float Map_CutRef( Map_Cut_t * pCut, int fPhase ); -extern float Map_CutDeref( Map_Cut_t * pCut, int fPhase ); +extern float Map_CutRef( Map_Cut_t * pCut, int fPhase, int fProfile ); +extern float Map_CutDeref( Map_Cut_t * pCut, int fPhase, int fProfile ); extern void Map_MappingSetRefs( Map_Man_t * pMan ); extern float Map_MappingGetArea( Map_Man_t * pMan ); /*=== mapperSwitch.c =============================================================*/ diff --git a/src/map/mapper/mapperMatch.c b/src/map/mapper/mapperMatch.c index e5e12fa8..f7f6c613 100644 --- a/src/map/mapper/mapperMatch.c +++ b/src/map/mapper/mapperMatch.c @@ -76,6 +76,8 @@ void Map_MatchClean( Map_Match_t * pMatch ) ***********************************************************************/ int Map_MatchCompare( Map_Man_t * pMan, Map_Match_t * pM1, Map_Match_t * pM2, int fDoingArea ) { +// if ( pM1->pSuperBest == pM2->pSuperBest ) +// return 0; if ( !fDoingArea ) { // compare the arrival times @@ -108,6 +110,21 @@ int Map_MatchCompare( Map_Man_t * pMan, Map_Match_t * pM1, Map_Match_t * pM2, in return 0; if ( pM1->AreaFlow > pM2->AreaFlow + pMan->fEpsilon ) return 1; + + // make decision based on cell profile + if ( pMan->fUseProfile && pM1->pSuperBest && pM1->pSuperBest ) + { + int M1req = Mio_GateReadProfile(pM1->pSuperBest->pRoot); + int M2req = Mio_GateReadProfile(pM2->pSuperBest->pRoot); + int M1act = Mio_GateReadProfile2(pM1->pSuperBest->pRoot); + int M2act = Mio_GateReadProfile2(pM2->pSuperBest->pRoot); + //printf( "%d %d ", M1req, M2req ); + if ( M1act < M1req && M2act > M2req ) + return 0; + if ( M2act < M2req && M1act > M1req ) + return 1; + } + // compare the arrival times if ( pM1->tArrive.Worst < pM2->tArrive.Worst - pMan->fEpsilon ) return 0; @@ -266,7 +283,7 @@ int Map_MatchNodePhase( Map_Man_t * p, Map_Node_t * pNode, int fPhase ) pMatch = pCutBest->M + fPhase; if ( pNode->nRefAct[fPhase] > 0 || (pNode->pCutBest[!fPhase] == NULL && pNode->nRefAct[!fPhase] > 0) ) - pMatch->AreaFlow = Area1 = Map_CutDeref( pCutBest, fPhase ); + pMatch->AreaFlow = Area1 = Map_CutDeref( pCutBest, fPhase, p->fUseProfile ); else pMatch->AreaFlow = Area1 = Map_CutGetAreaDerefed( pCutBest, fPhase ); } @@ -326,7 +343,7 @@ int Map_MatchNodePhase( Map_Man_t * p, Map_Node_t * pNode, int fPhase ) (pNode->pCutBest[!fPhase] == NULL && pNode->nRefAct[!fPhase] > 0)) ) { if ( p->fMappingMode == 2 || p->fMappingMode == 3 ) - Area2 = Map_CutRef( pNode->pCutBest[fPhase], fPhase ); + Area2 = Map_CutRef( pNode->pCutBest[fPhase], fPhase, p->fUseProfile ); else if ( p->fMappingMode == 4 ) Area2 = Map_SwitchCutRef( pNode, pNode->pCutBest[fPhase], fPhase ); else @@ -479,23 +496,23 @@ void Map_NodeTryDroppingOnePhase( Map_Man_t * p, Map_Node_t * pNode ) { // deref phase 1 cut if necessary if ( p->fMappingMode >= 2 && pNode->nRefAct[1] > 0 ) - Map_CutDeref( pNode->pCutBest[1], 1 ); + Map_CutDeref( pNode->pCutBest[1], 1, p->fUseProfile ); // get rid of the cut pNode->pCutBest[1] = NULL; // ref phase 0 cut if necessary if ( p->fMappingMode >= 2 && pNode->nRefAct[0] == 0 ) - Map_CutRef( pNode->pCutBest[0], 0 ); + Map_CutRef( pNode->pCutBest[0], 0, p->fUseProfile ); } else { // deref phase 0 cut if necessary if ( p->fMappingMode >= 2 && pNode->nRefAct[0] > 0 ) - Map_CutDeref( pNode->pCutBest[0], 0 ); + Map_CutDeref( pNode->pCutBest[0], 0, p->fUseProfile ); // get rid of the cut pNode->pCutBest[0] = NULL; // ref phase 1 cut if necessary if ( p->fMappingMode >= 2 && pNode->nRefAct[1] == 0 ) - Map_CutRef( pNode->pCutBest[1], 1 ); + Map_CutRef( pNode->pCutBest[1], 1, p->fUseProfile ); } } diff --git a/src/map/mapper/mapperRefs.c b/src/map/mapper/mapperRefs.c index 6d6ff121..e1387262 100644 --- a/src/map/mapper/mapperRefs.c +++ b/src/map/mapper/mapperRefs.c @@ -226,7 +226,7 @@ float Map_CutGetAreaFlow( Map_Cut_t * pCut, int fPhase ) seealso [] ***********************************************************************/ -float Map_CutRefDeref( Map_Cut_t * pCut, int fPhase, int fReference ) +float Map_CutRefDeref( Map_Cut_t * pCut, int fPhase, int fReference, int fUpdateProf ) { Map_Node_t * pNodeChild; Map_Cut_t * pCutChild; @@ -239,6 +239,13 @@ float Map_CutRefDeref( Map_Cut_t * pCut, int fPhase, int fReference ) return 0; // start the area of this cut aArea = Map_CutGetRootArea( pCut, fPhase ); + if ( fUpdateProf ) + { + if ( fReference ) + Mio_GateIncProfile2( pCut->M[fPhase].pSuperBest->pRoot ); + else + Mio_GateDecProfile2( pCut->M[fPhase].pSuperBest->pRoot ); + } // go through the children for ( i = 0; i < pCut->nLeaves; i++ ) { @@ -309,7 +316,7 @@ float Map_CutRefDeref( Map_Cut_t * pCut, int fPhase, int fReference ) pCutChild = pNodeChild->pCutBest[fPhaseChild]; } // reference and compute area recursively - aArea += Map_CutRefDeref( pCutChild, fPhaseChild, fReference ); + aArea += Map_CutRefDeref( pCutChild, fPhaseChild, fReference, fUpdateProf ); } return aArea; } @@ -328,8 +335,8 @@ float Map_CutRefDeref( Map_Cut_t * pCut, int fPhase, int fReference ) float Map_CutGetAreaRefed( Map_Cut_t * pCut, int fPhase ) { float aResult, aResult2; - aResult2 = Map_CutRefDeref( pCut, fPhase, 0 ); // dereference - aResult = Map_CutRefDeref( pCut, fPhase, 1 ); // reference + aResult2 = Map_CutRefDeref( pCut, fPhase, 0, 0 ); // dereference + aResult = Map_CutRefDeref( pCut, fPhase, 1, 0 ); // reference // assert( aResult == aResult2 ); return aResult; } @@ -348,8 +355,8 @@ float Map_CutGetAreaRefed( Map_Cut_t * pCut, int fPhase ) float Map_CutGetAreaDerefed( Map_Cut_t * pCut, int fPhase ) { float aResult, aResult2; - aResult2 = Map_CutRefDeref( pCut, fPhase, 1 ); // reference - aResult = Map_CutRefDeref( pCut, fPhase, 0 ); // dereference + aResult2 = Map_CutRefDeref( pCut, fPhase, 1, 0 ); // reference + aResult = Map_CutRefDeref( pCut, fPhase, 0, 0 ); // dereference // assert( aResult == aResult2 ); return aResult; } @@ -365,9 +372,9 @@ float Map_CutGetAreaDerefed( Map_Cut_t * pCut, int fPhase ) seealso [] ***********************************************************************/ -float Map_CutRef( Map_Cut_t * pCut, int fPhase ) +float Map_CutRef( Map_Cut_t * pCut, int fPhase, int fProfile ) { - return Map_CutRefDeref( pCut, fPhase, 1 ); // reference + return Map_CutRefDeref( pCut, fPhase, 1, fProfile ); // reference } /**function************************************************************* @@ -381,9 +388,9 @@ float Map_CutRef( Map_Cut_t * pCut, int fPhase ) seealso [] ***********************************************************************/ -float Map_CutDeref( Map_Cut_t * pCut, int fPhase ) +float Map_CutDeref( Map_Cut_t * pCut, int fPhase, int fProfile ) { - return Map_CutRefDeref( pCut, fPhase, 0 ); // dereference + return Map_CutRefDeref( pCut, fPhase, 0, fProfile ); // dereference } @@ -430,6 +437,8 @@ void Map_MappingSetRefs_rec( Map_Man_t * pMan, Map_Node_t * pNode ) fPhase = !fPhase; pCut = pNodeR->pCutBest[fPhase]; } + if ( pMan->fUseProfile ) + Mio_GateIncProfile2( pCut->M[fPhase].pSuperBest->pRoot ); // visit the transitive fanin uPhase = pCut->M[fPhase].uPhaseBest; for ( i = 0; i < pCut->nLeaves; i++ ) @@ -442,6 +451,8 @@ void Map_MappingSetRefs( Map_Man_t * pMan ) { Map_Node_t * pNode; int i; + if ( pMan->fUseProfile ) + Mio_LibraryCleanProfile2( pMan->pSuperLib->pGenlib ); // clean all references for ( i = 0; i < pMan->vMapObjs->nSize; i++ ) { @@ -476,6 +487,8 @@ float Map_MappingGetArea( Map_Man_t * pMan ) Map_Node_t * pNode; float Area = 0.0; int i; + if ( pMan->fUseProfile ) + Mio_LibraryCleanProfile2( pMan->pSuperLib->pGenlib ); for ( i = 0; i < pMan->vMapObjs->nSize; i++ ) { pNode = pMan->vMapObjs->pArray[i]; @@ -492,10 +505,18 @@ float Map_MappingGetArea( Map_Man_t * pMan ) { // count area of the negative phase if ( pNode->pCutBest[0] && (pNode->nRefAct[0] > 0 || pNode->pCutBest[1] == NULL) ) + { Area += pNode->pCutBest[0]->M[0].pSuperBest->Area; + if ( pMan->fUseProfile ) + Mio_GateIncProfile2( pNode->pCutBest[0]->M[0].pSuperBest->pRoot ); + } // count area of the positive phase if ( pNode->pCutBest[1] && (pNode->nRefAct[1] > 0 || pNode->pCutBest[0] == NULL) ) + { Area += pNode->pCutBest[1]->M[1].pSuperBest->Area; + if ( pMan->fUseProfile ) + Mio_GateIncProfile2( pNode->pCutBest[1]->M[1].pSuperBest->pRoot ); + } } // count area of the interver if we need to implement one phase with another phase if ( (pNode->pCutBest[0] == NULL && pNode->nRefAct[0] > 0) || -- cgit v1.2.3