From d4fecf91efcd090caa9a5cbfb05059361e84c4ec Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 21 Jan 2008 08:01:00 -0800 Subject: Version abc80121 --- src/map/if/if.h | 11 ++- src/map/if/ifCut.c | 189 ++++++++++++++++++++++++------------------------ src/map/if/ifMan.c | 4 +- src/map/if/ifReduce.c | 5 +- src/map/if/ifUtil.c | 2 +- src/map/pcm/module.make | 0 src/map/ply/module.make | 0 7 files changed, 106 insertions(+), 105 deletions(-) create mode 100644 src/map/pcm/module.make create mode 100644 src/map/ply/module.make (limited to 'src/map') diff --git a/src/map/if/if.h b/src/map/if/if.h index 17040742..07816790 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -326,8 +326,13 @@ static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { r extern int If_ManPerformMapping( If_Man_t * p ); 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 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 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 ); extern float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut ); extern float If_CutEdgeFlow( If_Man_t * p, If_Cut_t * pCut ); extern float If_CutAverageRefs( If_Man_t * p, If_Cut_t * pCut ); @@ -339,12 +344,6 @@ extern float If_CutEdgeDeref( If_Man_t * p, If_Cut_t * pCut ); extern float If_CutEdgeRef( If_Man_t * p, If_Cut_t * pCut ); extern float If_CutEdgeDerefed( If_Man_t * p, If_Cut_t * pCut ); extern float If_CutEdgeRefed( If_Man_t * p, If_Cut_t * pCut ); -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 int If_CutMerge( If_Cut_t * pCut0, If_Cut_t * pCut1, 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 ); -extern void If_ManSortCuts( If_Man_t * p, int Mode ); /*=== ifMan.c =============================================================*/ extern If_Man_t * If_ManStart( If_Par_t * pPars ); extern void If_ManRestart( If_Man_t * p ); diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index 915cedf9..cc842c19 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -311,21 +311,21 @@ int If_CutMerge( If_Cut_t * pCut0, If_Cut_t * pCut1, If_Cut_t * pCut ) SeeAlso [] ***********************************************************************/ -int If_CutCompareDelay( If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) +int If_CutCompareDelay( If_Man_t * p, If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) { If_Cut_t * pC0 = *ppC0; If_Cut_t * pC1 = *ppC1; - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; if ( pC0->nLeaves < pC1->nLeaves ) return -1; if ( pC0->nLeaves > pC1->nLeaves ) return 1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; return 0; } @@ -341,17 +341,17 @@ int If_CutCompareDelay( If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) SeeAlso [] ***********************************************************************/ -int If_CutCompareDelayOld( If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) +int If_CutCompareDelayOld( If_Man_t * p, If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) { If_Cut_t * pC0 = *ppC0; If_Cut_t * pC1 = *ppC1; - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; if ( pC0->nLeaves < pC1->nLeaves ) return -1; @@ -371,13 +371,13 @@ int If_CutCompareDelayOld( If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) SeeAlso [] ***********************************************************************/ -int If_CutCompareArea( If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) +int If_CutCompareArea( If_Man_t * p, If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) { If_Cut_t * pC0 = *ppC0; If_Cut_t * pC1 = *ppC1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; if ( pC0->AveRefs > pC1->AveRefs ) return -1; @@ -387,9 +387,9 @@ int If_CutCompareArea( If_Cut_t ** ppC0, If_Cut_t ** ppC1 ) return -1; if ( pC0->nLeaves > pC1->nLeaves ) return 1; - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; return 0; } @@ -433,13 +433,13 @@ static inline int If_ManSortCompare( If_Man_t * p, If_Cut_t * pC0, If_Cut_t * pC { if ( p->SortMode == 1 ) // area { - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; - if ( pC0->Edge < pC1->Edge - 0.0001 ) + if ( pC0->Edge < pC1->Edge - p->fEpsilon ) return -1; - if ( pC0->Edge > pC1->Edge + 0.0001 ) + if ( pC0->Edge > pC1->Edge + p->fEpsilon ) return 1; if ( pC0->AveRefs > pC1->AveRefs ) return -1; @@ -449,44 +449,44 @@ static inline int If_ManSortCompare( If_Man_t * p, If_Cut_t * pC0, If_Cut_t * pC return -1; if ( pC0->nLeaves > pC1->nLeaves ) return 1; - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; return 0; } if ( p->SortMode == 0 ) // delay { - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; if ( pC0->nLeaves < pC1->nLeaves ) return -1; if ( pC0->nLeaves > pC1->nLeaves ) return 1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; - if ( pC0->Edge < pC1->Edge - 0.0001 ) + if ( pC0->Edge < pC1->Edge - p->fEpsilon ) return -1; - if ( pC0->Edge > pC1->Edge + 0.0001 ) + if ( pC0->Edge > pC1->Edge + p->fEpsilon ) return 1; return 0; } assert( p->SortMode == 2 ); // delay old - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; - if ( pC0->Edge < pC1->Edge - 0.0001 ) + if ( pC0->Edge < pC1->Edge - p->fEpsilon ) return -1; - if ( pC0->Edge > pC1->Edge + 0.0001 ) + if ( pC0->Edge > pC1->Edge + p->fEpsilon ) return 1; if ( pC0->nLeaves < pC1->nLeaves ) return -1; @@ -510,9 +510,9 @@ static inline int If_ManSortCompare_old( If_Man_t * p, If_Cut_t * pC0, If_Cut_t { if ( p->SortMode == 1 ) // area { - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; if ( pC0->AveRefs > pC1->AveRefs ) return -1; @@ -522,36 +522,36 @@ static inline int If_ManSortCompare_old( If_Man_t * p, If_Cut_t * pC0, If_Cut_t return -1; if ( pC0->nLeaves > pC1->nLeaves ) return 1; - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; return 0; } if ( p->SortMode == 0 ) // delay { - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; if ( pC0->nLeaves < pC1->nLeaves ) return -1; if ( pC0->nLeaves > pC1->nLeaves ) return 1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; return 0; } assert( p->SortMode == 2 ); // delay old - if ( pC0->Delay < pC1->Delay - 0.0001 ) + if ( pC0->Delay < pC1->Delay - p->fEpsilon ) return -1; - if ( pC0->Delay > pC1->Delay + 0.0001 ) + if ( pC0->Delay > pC1->Delay + p->fEpsilon ) return 1; - if ( pC0->Area < pC1->Area - 0.0001 ) + if ( pC0->Area < pC1->Area - p->fEpsilon ) return -1; - if ( pC0->Area > pC1->Area + 0.0001 ) + if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; if ( pC0->nLeaves < pC1->nLeaves ) return -1; @@ -644,6 +644,56 @@ void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut ) printf( " }\n" ); } +/**Function************************************************************* + + Synopsis [Moves the cut over the latch.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void If_CutLift( If_Cut_t * pCut ) +{ + unsigned i; + for ( i = 0; i < pCut->nLeaves; i++ ) + { + assert( (pCut->pLeaves[i] & 255) < 255 ); + pCut->pLeaves[i]++; + } +} + +/**Function************************************************************* + + Synopsis [Computes area of the first level.] + + Description [The cut need to be derefed.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void If_CutCopy( If_Man_t * p, If_Cut_t * pCutDest, If_Cut_t * pCutSrc ) +{ + int * pLeaves; + char * pPerm; + unsigned * pTruth; + // save old arrays + pLeaves = pCutDest->pLeaves; + pPerm = pCutDest->pPerm; + pTruth = pCutDest->pTruth; + // copy the cut info + memcpy( pCutDest, pCutSrc, p->nCutBytes ); + // restore the arrays + pCutDest->pLeaves = pLeaves; + pCutDest->pPerm = pPerm; + pCutDest->pTruth = pTruth; +} + + /**Function************************************************************* Synopsis [Computes area flow.] @@ -931,55 +981,6 @@ float If_CutEdgeRefed( If_Man_t * p, If_Cut_t * pCut ) } -/**Function************************************************************* - - Synopsis [Moves the cut over the latch.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void If_CutLift( If_Cut_t * pCut ) -{ - unsigned i; - for ( i = 0; i < pCut->nLeaves; i++ ) - { - assert( (pCut->pLeaves[i] & 255) < 255 ); - pCut->pLeaves[i]++; - } -} - -/**Function************************************************************* - - Synopsis [Computes area of the first level.] - - Description [The cut need to be derefed.] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void If_CutCopy( If_Man_t * p, If_Cut_t * pCutDest, If_Cut_t * pCutSrc ) -{ - int * pLeaves; - char * pPerm; - unsigned * pTruth; - // save old arrays - pLeaves = pCutDest->pLeaves; - pPerm = pCutDest->pPerm; - pTruth = pCutDest->pTruth; - // copy the cut info - memcpy( pCutDest, pCutSrc, p->nCutBytes ); - // restore the arrays - pCutDest->pLeaves = pLeaves; - pCutDest->pPerm = pPerm; - pCutDest->pTruth = pTruth; -} - //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 50ce63e9..977d69c9 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -68,8 +68,8 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) // p->pMemSet = Mem_FixedStart( p->nSetBytes ); // report expected memory usage if ( p->pPars->fVerbose ) - printf( "Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d.\n", - 4 * p->nTruthWords, p->nCutBytes, p->nObjBytes, p->nSetBytes ); + printf( "K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d.\n", + p->pPars->nLutSize, 4 * p->nTruthWords, p->nCutBytes, p->nObjBytes, p->nSetBytes ); // room for temporary truth tables p->puTemp[0] = p->pPars->fTruth? ALLOC( unsigned, 4 * p->nTruthWords ) : NULL; p->puTemp[1] = p->puTemp[0] + p->nTruthWords; diff --git a/src/map/if/ifReduce.c b/src/map/if/ifReduce.c index ab7de609..0912a965 100644 --- a/src/map/if/ifReduce.c +++ b/src/map/if/ifReduce.c @@ -150,6 +150,7 @@ void If_ManImproveNodeExpand( If_Man_t * p, If_Obj_t * pObj, int nLimit, Vec_Ptr int CostBef, CostAft, i; float DelayOld, AreaBef, AreaAft; pCut = If_ObjCutBest(pObj); + pCut->Delay = If_CutDelay( p, pCut ); assert( pCut->Delay <= pObj->Required + p->fEpsilon ); if ( pObj->nRefs == 0 ) return; @@ -449,8 +450,8 @@ int If_ManImproveNodeFaninCompact_int( If_Man_t * p, If_Obj_t * pObj, int nLimit return 1; if ( Vec_PtrSize(vFront) < nLimit && If_ManImproveNodeFaninCompact1(p, pObj, nLimit, vFront, vVisited) ) return 1; - if ( Vec_PtrSize(vFront) < nLimit && If_ManImproveNodeFaninCompact2(p, pObj, nLimit, vFront, vVisited) ) - return 1; +// if ( Vec_PtrSize(vFront) < nLimit && If_ManImproveNodeFaninCompact2(p, pObj, nLimit, vFront, vVisited) ) +// return 1; assert( Vec_PtrSize(vFront) <= nLimit ); return 0; } diff --git a/src/map/if/ifUtil.c b/src/map/if/ifUtil.c index f4fcf94a..3bb39e2f 100644 --- a/src/map/if/ifUtil.c +++ b/src/map/if/ifUtil.c @@ -212,7 +212,7 @@ void If_ManComputeRequired( If_Man_t * p ) Vec_PtrForEachEntry( p->vMapped, pObj, i ) If_CutPropagateRequired( p, If_ObjCutBest(pObj), pObj->Required ); } - + /**Function************************************************************* Synopsis [Computes area, references, and nodes used in the mapping.] diff --git a/src/map/pcm/module.make b/src/map/pcm/module.make new file mode 100644 index 00000000..e69de29b diff --git a/src/map/ply/module.make b/src/map/ply/module.make new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3