summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-01-21 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2008-01-21 08:01:00 -0800
commitd4fecf91efcd090caa9a5cbfb05059361e84c4ec (patch)
tree87dfc18934e7460a3be8c7cea0a587756e66aeb2 /src/map/if
parent61850d5942fcff634b16696bf3ca7ee0fc465d1c (diff)
downloadabc-d4fecf91efcd090caa9a5cbfb05059361e84c4ec.tar.gz
abc-d4fecf91efcd090caa9a5cbfb05059361e84c4ec.tar.bz2
abc-d4fecf91efcd090caa9a5cbfb05059361e84c4ec.zip
Version abc80121
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h11
-rw-r--r--src/map/if/ifCut.c189
-rw-r--r--src/map/if/ifMan.c4
-rw-r--r--src/map/if/ifReduce.c5
-rw-r--r--src/map/if/ifUtil.c2
5 files changed, 106 insertions, 105 deletions
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;
@@ -646,6 +646,56 @@ void If_CutPrintTiming( 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;
+}
+
+
+/**Function*************************************************************
+
Synopsis [Computes area flow.]
Description []
@@ -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.]