summaryrefslogtreecommitdiffstats
path: root/src/map/if/ifCut.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2006-12-09 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2006-12-09 08:01:00 -0800
commitb9abf9c00c02feb52a2c796199343acebe20d8ef (patch)
treede4ad845520c09f876309d89a60e13831360ad70 /src/map/if/ifCut.c
parent4cf99cae95c629b31d6d89c5dcea2eeb17654c85 (diff)
downloadabc-b9abf9c00c02feb52a2c796199343acebe20d8ef.tar.gz
abc-b9abf9c00c02feb52a2c796199343acebe20d8ef.tar.bz2
abc-b9abf9c00c02feb52a2c796199343acebe20d8ef.zip
Version abc61209
Diffstat (limited to 'src/map/if/ifCut.c')
-rw-r--r--src/map/if/ifCut.c81
1 files changed, 58 insertions, 23 deletions
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index 56e354ce..06a020a6 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -96,7 +96,9 @@ int If_CutFilter( If_Man_t * p, If_Cut_t * pCut )
pTemp = p->ppCuts[i];
if ( pTemp->nLeaves > pCut->nLeaves )
{
-// continue;
+ // do not fiter the first cut
+ if ( i == 0 )
+ continue;
// skip the non-contained cuts
if ( (pTemp->uSign & pCut->uSign) != pCut->uSign )
continue;
@@ -368,6 +370,10 @@ int If_CutCompareArea( If_Cut_t ** ppC0, If_Cut_t ** ppC1 )
return -1;
if ( pC0->Area > pC1->Area + 0.0001 )
return 1;
+ if ( pC0->AveRefs > pC1->AveRefs )
+ return -1;
+ if ( pC0->AveRefs < pC1->AveRefs )
+ return 1;
if ( pC0->nLeaves < pC1->nLeaves )
return -1;
if ( pC0->nLeaves > pC1->nLeaves )
@@ -403,7 +409,7 @@ void If_ManSortCuts( If_Man_t * p, int Mode )
/**Function*************************************************************
- Synopsis [Computes delay.]
+ Synopsis [Computes area flow.]
Description []
@@ -412,21 +418,29 @@ void If_ManSortCuts( If_Man_t * p, int Mode )
SeeAlso []
***********************************************************************/
-float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
+float If_CutFlow( If_Man_t * p, If_Cut_t * pCut )
{
If_Obj_t * pLeaf;
- float Delay;
+ float Flow;
int i;
assert( pCut->nLeaves > 1 );
- Delay = -IF_FLOAT_LARGE;
+ Flow = If_CutLutArea(p, pCut);
If_CutForEachLeaf( p, pCut, pLeaf, i )
- Delay = IF_MAX( Delay, If_ObjCutBest(pLeaf)->Delay );
- return Delay + If_CutLutDelay(p, pCut);
+ {
+ if ( pLeaf->nRefs == 0 )
+ Flow += If_ObjCutBest(pLeaf)->Area;
+ else
+ {
+ assert( pLeaf->EstRefs > p->fEpsilon );
+ Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
+ }
+ }
+ return Flow;
}
/**Function*************************************************************
- Synopsis [Computes area flow.]
+ Synopsis [Average number of references of the leaves.]
Description []
@@ -435,24 +449,15 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
SeeAlso []
***********************************************************************/
-float If_CutFlow( If_Man_t * p, If_Cut_t * pCut )
+float If_CutAverageRefs( If_Man_t * p, If_Cut_t * pCut )
{
If_Obj_t * pLeaf;
- float Flow;
- int i;
+ int nRefsTotal, i;
assert( pCut->nLeaves > 1 );
- Flow = If_CutLutArea(p, pCut);
+ nRefsTotal = 0;
If_CutForEachLeaf( p, pCut, pLeaf, i )
- {
- if ( pLeaf->nRefs == 0 )
- Flow += If_ObjCutBest(pLeaf)->Area;
- else
- {
- assert( pLeaf->EstRefs > p->fEpsilon );
- Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
- }
- }
- return Flow;
+ nRefsTotal += pLeaf->nRefs;
+ return ((float)nRefsTotal)/pCut->nLeaves;
}
/**Function*************************************************************
@@ -531,6 +536,27 @@ void If_CutPrint( If_Man_t * p, If_Cut_t * pCut )
/**Function*************************************************************
+ Synopsis [Prints one cut.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut )
+{
+ If_Obj_t * pLeaf;
+ unsigned i;
+ printf( "{" );
+ If_CutForEachLeaf( p, pCut, pLeaf, i )
+ printf( " %d(%.2f/%.2f)", pLeaf->Id, If_ObjCutBest(pLeaf)->Delay, pLeaf->Required );
+ printf( " }\n" );
+}
+
+/**Function*************************************************************
+
Synopsis [Computes area of the first level.]
Description [The cut need to be derefed.]
@@ -585,15 +611,24 @@ float If_CutAreaRefed( If_Man_t * p, If_Cut_t * pCut, int nLevels )
void If_CutCopy( 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
*pCutDest = *pCutSrc;
+ // restore the arrays
pCutDest->pLeaves = pLeaves;
+ pCutDest->pPerm = pPerm;
pCutDest->pTruth = pTruth;
+ // copy the array data
memcpy( pCutDest->pLeaves, pCutSrc->pLeaves, sizeof(int) * pCutSrc->nLeaves );
+ if ( pCutSrc->pPerm )
+ memcpy( pCutDest->pPerm, pCutSrc->pPerm, sizeof(unsigned) * If_CutPermWords(pCutSrc->nLimit) );
if ( pCutSrc->pTruth )
- memcpy( pCutDest->pTruth, pCutSrc->pTruth, sizeof(unsigned) * If_CutTruthWords(pCutSrc->nLimit) );
+ memcpy( pCutDest->pTruth, pCutSrc->pTruth, sizeof(unsigned) * If_CutTruthWords(pCutSrc->nLimit) );
}
////////////////////////////////////////////////////////////////////////