From 651a32cdc379d2341c631b719ed9af16ce5a66c9 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 11 Apr 2008 08:01:00 -0700 Subject: Version abc80411 --- src/map/if/if.h | 6 ++++-- src/map/if/ifCut.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++- src/map/if/ifLib.c | 31 ++++++++++++++++++++++++++ src/map/if/ifMap.c | 2 +- src/map/if/ifReduce.c | 1 + 5 files changed, 96 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/if/if.h b/src/map/if/if.h index e0b9584d..8cf5c0e8 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -246,7 +246,6 @@ static inline int If_ObjIsConst1( If_Obj_t * pObj ) { r static inline int If_ObjIsCi( If_Obj_t * pObj ) { return pObj->Type == IF_CI; } static inline int If_ObjIsCo( If_Obj_t * pObj ) { return pObj->Type == IF_CO; } static inline int If_ObjIsTerm( If_Obj_t * pObj ) { return pObj->Type == IF_CI || pObj->Type == IF_CO; } -//static inline int If_ObjIsPi( If_Obj_t * pObj ) { return If_ObjIsCi(pObj) && pObj->pFanin0 == NULL; } static inline int If_ObjIsLatch( If_Obj_t * pObj ) { return If_ObjIsCi(pObj) && pObj->pFanin0 != NULL; } static inline int If_ObjIsAnd( If_Obj_t * pObj ) { return pObj->Type == IF_AND; } @@ -343,8 +342,10 @@ extern int If_ManPerformMappingComb( If_Man_t * p ); /*=== ifCut.c ============================================================*/ extern int If_CutFilter( If_Set_t * pCutSet, If_Cut_t * pCut ); extern void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ); +extern void If_CutOrder( If_Cut_t * pCut ); extern int If_CutMerge( If_Cut_t * pCut0, If_Cut_t * pCut1, If_Cut_t * pCut ); -extern void If_CutPrint( If_Man_t * p, If_Cut_t * pCut ); +extern int If_CutCheck( If_Cut_t * pCut ); +extern void If_CutPrint( If_Cut_t * pCut ); extern void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut ); extern void If_CutLift( If_Cut_t * pCut ); extern void If_CutCopy( If_Man_t * p, If_Cut_t * pCutDest, If_Cut_t * pCutSrc ); @@ -365,6 +366,7 @@ extern If_Lib_t * If_LutLibDup( If_Lib_t * p ); extern void If_LutLibFree( If_Lib_t * pLutLib ); extern void If_LutLibPrint( If_Lib_t * pLutLib ); extern int If_LutLibDelaysAreDiscrete( If_Lib_t * pLutLib ); +extern int If_LutLibDelaysAreDifferent( If_Lib_t * pLutLib ); extern If_Lib_t * If_SetSimpleLutLib( int nLutSize ); extern float If_LutLibFastestPinDelay( If_Lib_t * p ); extern float If_LutLibSlowestPinDelay( If_Lib_t * p ); diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index 08653d95..afaae239 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -297,6 +297,7 @@ int If_CutMerge( If_Cut_t * pCut0, If_Cut_t * pCut1, If_Cut_t * pCut ) return 0; } pCut->uSign = pCut0->uSign | pCut1->uSign; + assert( If_CutCheck( pCut ) ); return 1; } @@ -603,6 +604,63 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ) pCutSet->nCuts++; } +/**Function************************************************************* + + Synopsis [Orders the leaves of the cut.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void If_CutOrder( If_Cut_t * pCut ) +{ + int i, Temp, fChanges; + do { + fChanges = 0; + for ( i = 0; i < (int)pCut->nLeaves - 1; i++ ) + { + assert( pCut->pLeaves[i] != pCut->pLeaves[i+1] ); + if ( pCut->pLeaves[i] <= pCut->pLeaves[i+1] ) + continue; + Temp = pCut->pLeaves[i]; + pCut->pLeaves[i] = pCut->pLeaves[i+1]; + pCut->pLeaves[i+1] = Temp; + fChanges = 1; + } + } while ( fChanges ); +} + +/**Function************************************************************* + + Synopsis [Checks correctness of the cut.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutCheck( If_Cut_t * pCut ) +{ + int i; + assert( pCut->nLeaves <= pCut->nLimit ); + for ( i = 1; i < (int)pCut->nLeaves; i++ ) + { + if ( pCut->pLeaves[i-1] >= pCut->pLeaves[i] ) + { + printf( "If_CutCheck(): Cut has wrong ordering of inputs.\n" ); + return 0; + } + assert( pCut->pLeaves[i-1] < pCut->pLeaves[i] ); + } + return 1; +} + + /**Function************************************************************* Synopsis [Prints one cut.] @@ -614,7 +672,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ) SeeAlso [] ***********************************************************************/ -void If_CutPrint( If_Man_t * p, If_Cut_t * pCut ) +void If_CutPrint( If_Cut_t * pCut ) { unsigned i; printf( "{" ); diff --git a/src/map/if/ifLib.c b/src/map/if/ifLib.c index 455f43d9..b3e6ad4c 100644 --- a/src/map/if/ifLib.c +++ b/src/map/if/ifLib.c @@ -226,6 +226,37 @@ int If_LutLibDelaysAreDiscrete( If_Lib_t * pLutLib ) return 1; } +/**Function************************************************************* + + Synopsis [Returns 1 if the delays are discrete.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_LutLibDelaysAreDifferent( If_Lib_t * pLutLib ) +{ + int i, k; + float Delay = pLutLib->pLutDelays[1][0]; + if ( pLutLib->fVarPinDelays ) + { + for ( i = 2; i <= pLutLib->LutMax; i++ ) + for ( k = 0; k < i; k++ ) + if ( pLutLib->pLutDelays[i][k] != Delay ) + return 1; + } + else + { + for ( i = 2; i <= pLutLib->LutMax; i++ ) + if ( pLutLib->pLutDelays[i][0] != Delay ) + return 1; + } + return 0; +} + /**Function************************************************************* Synopsis [Sets simple LUT library.] diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index 5f06b0e9..74557a54 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -88,7 +88,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep { // recompute the parameters of the best cut pCut->Delay = If_CutDelay( p, pCut ); -// assert( pCut->Delay <= pObj->Required + p->fEpsilon ); + assert( pCut->Delay <= pObj->Required + p->fEpsilon ); pCut->Area = (Mode == 2)? If_CutAreaDerefed( p, pCut ) : If_CutAreaFlow( p, pCut ); if ( p->pPars->fEdge ) pCut->Edge = (Mode == 2)? If_CutEdgeDerefed( p, pCut ) : If_CutEdgeFlow( p, pCut ); diff --git a/src/map/if/ifReduce.c b/src/map/if/ifReduce.c index 0912a965..fd1af0d7 100644 --- a/src/map/if/ifReduce.c +++ b/src/map/if/ifReduce.c @@ -263,6 +263,7 @@ void If_ManImproveNodeUpdate( If_Man_t * p, If_Obj_t * pObj, Vec_Ptr_t * vFront pCut->nLeaves = Vec_PtrSize(vFront); Vec_PtrForEachEntry( vFront, pFanin, i ) pCut->pLeaves[i] = pFanin->Id; + If_CutOrder( pCut ); // ref the new cut If_CutAreaRef( p, pCut ); } -- cgit v1.2.3