From ebfd70cdf41c5ba10b4cae66a5bcaf289f162732 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 8 Jul 2011 19:40:07 -0700 Subject: Initial changes to enable new features in the mapper --- src/map/if/if.h | 4 +++- src/map/if/ifCut.c | 6 +++--- src/map/if/ifMap.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/map/if/ifUtil.c | 1 + 4 files changed, 67 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/if/if.h b/src/map/if/if.h index 61944eaa..86d504bc 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -161,6 +161,7 @@ struct If_Man_t_ int fNextRound; // set to 1 after the first round int nChoices; // the number of choice nodes Vec_Int_t * vSwitching; // switching activity of each node + Vec_Int_t ** pDriverCuts; // temporary driver cuts // sequential mapping Vec_Ptr_t * vLatchOrder; // topological ordering of latches Vec_Int_t * vLags; // sequentail lags of all nodes @@ -228,7 +229,8 @@ struct If_Obj_t_ unsigned fMark : 1; // multipurpose mark unsigned fVisit : 1; // multipurpose mark unsigned fSpec : 1; // multipurpose mark - unsigned Level : 21; // logic level of the node + unsigned fDriver : 1; // multipurpose mark + unsigned Level : 20; // logic level of the node int Id; // integer ID int IdPio; // integer ID of PIs/POs int nRefs; // the number of references diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index f51807ee..59d4e8e3 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -881,7 +881,7 @@ float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut ) Flow = If_CutLutArea(p, pCut); If_CutForEachLeaf( p, pCut, pLeaf, i ) { - if ( pLeaf->nRefs == 0 ) + if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) ) Flow += If_ObjCutBest(pLeaf)->Area; else if ( p->pPars->fSeqMap ) // seq Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->nRefs; @@ -914,7 +914,7 @@ float If_CutEdgeFlow( If_Man_t * p, If_Cut_t * pCut ) Flow = pCut->nLeaves; If_CutForEachLeaf( p, pCut, pLeaf, i ) { - if ( pLeaf->nRefs == 0 ) + if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) ) Flow += If_ObjCutBest(pLeaf)->Edge; else if ( p->pPars->fSeqMap ) // seq Flow += If_ObjCutBest(pLeaf)->Edge / pLeaf->nRefs; @@ -948,7 +948,7 @@ float If_CutPowerFlow( If_Man_t * p, If_Cut_t * pCut, If_Obj_t * pRoot ) If_CutForEachLeaf( p, pCut, pLeaf, i ) { Power += pSwitching[pLeaf->Id]; - if ( pLeaf->nRefs == 0 ) + if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) ) Power += If_ObjCutBest(pLeaf)->Power; else if ( p->pPars->fSeqMap ) // seq Power += If_ObjCutBest(pLeaf)->Power / pLeaf->nRefs; diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index b7b7c568..f2dbe3f7 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -51,6 +51,32 @@ static inline int If_WordCountOnes( unsigned uWord ) return (uWord & 0x0000FFFF) + (uWord>>16); } +/**Function************************************************************* + + Synopsis [Counts the number of 1s in the signature.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +float If_CutDelaySpecial( If_Man_t * p, If_Cut_t * pCut, int fCarry ) +{ + static float Pin2Pin[2][3] = { {1.0, 1.0, 1.0}, {1.0, 1.0, 0.0} }; + If_Obj_t * pLeaf; + float DelayCur, Delay = -IF_FLOAT_LARGE; + int i; + assert( pCut->nLeaves <= 3 ); + If_CutForEachLeaf( p, pCut, pLeaf, i ) + { + DelayCur = If_ObjCutBest(pLeaf)->Delay; + Delay = IF_MAX( Delay, Pin2Pin[fCarry][i] + DelayCur ); + } + return Delay; + } + /**Function************************************************************* Synopsis [Finds the best cut for the given node.] @@ -79,6 +105,40 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep else if ( Mode == 1 ) pObj->EstRefs = (float)((2.0 * pObj->EstRefs + pObj->nRefs) / 3.0); } + + // process special cut + if ( p->pDriverCuts && p->pDriverCuts[pObj->Id] ) + { + pCut = If_ObjCutBest(pObj); + if ( pCut->nLeaves == 0 ) + { + pCut->nLeaves = Vec_IntSize( p->pDriverCuts[pObj->Id] ); + Vec_IntForEachEntry( p->pDriverCuts[pObj->Id], k, i ) + pCut->pLeaves[i] = k; + assert( pCut->pLeaves[0] <= pCut->pLeaves[1] ); +// if ( pObj->nRefs > 0 ) +// If_CutAreaRef( p, pCut ); + } + pCut->Delay = If_CutDelaySpecial( p, pCut, pObj->fDriver ); + pCut->Area = (Mode == 2)? 1 : If_CutAreaFlow( p, pCut ); + if ( p->pPars->fEdge ) + pCut->Edge = (Mode == 2)? 3 : If_CutEdgeFlow( p, pCut ); + if ( p->pPars->fPower ) + pCut->Power = (Mode == 2)? 0 : If_CutPowerFlow( p, pCut, pObj ); + + // prepare the cutset + pCutSet = If_ManSetupNodeCutSet( p, pObj ); + // copy best cut + If_CutCopy( p, pCutSet->ppCuts[pCutSet->nCuts++], If_ObjCutBest(pObj) ); + // add the trivial cut to the set + If_ManSetupCutTriv( p, pCutSet->ppCuts[pCutSet->nCuts++], pObj->Id ); + // free the cuts + If_ManDerefNodeCutSet( p, pObj ); + assert( pCutSet->nCuts == 2 ); + return; + } + + // deref the selected cut if ( Mode && pObj->nRefs > 0 ) If_CutAreaDeref( p, If_ObjCutBest(pObj) ); diff --git a/src/map/if/ifUtil.c b/src/map/if/ifUtil.c index da3a4aa5..f752baef 100644 --- a/src/map/if/ifUtil.c +++ b/src/map/if/ifUtil.c @@ -769,6 +769,7 @@ int If_ManCountSpecialPos( If_Man_t * p ) return Counter; } + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// -- cgit v1.2.3