summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-04-05 11:06:35 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-04-05 11:06:35 -0700
commit5608d947eda6635ac6d82f4f144adbfc5170f302 (patch)
treee70ed713d2595b6de6d88c0c7b9c8066fc6b36fe /src/map/if
parent424b86a55673f53ec102687c04d2762b88ad5a47 (diff)
downloadabc-5608d947eda6635ac6d82f4f144adbfc5170f302.tar.gz
abc-5608d947eda6635ac6d82f4f144adbfc5170f302.tar.bz2
abc-5608d947eda6635ac6d82f4f144adbfc5170f302.zip
Preparing new implementation of SOP/DSD balancing in 'if' mapper.
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h3
-rw-r--r--src/map/if/ifDsd.c22
-rw-r--r--src/map/if/ifMap.c48
3 files changed, 48 insertions, 25 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h
index 7437c472..1ca83e78 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -134,6 +134,7 @@ struct If_Par_t_
float WireDelay; // wire delay
// internal parameters
int fDelayOpt; // special delay optimization
+ int fDsdBalance; // special delay optimization
int fUserRecLib; // use recorded library
int fSkipCutFilter;// skip cut filter
int fAreaOnly; // area only mode
@@ -546,6 +547,8 @@ extern int If_DsdManLutSize( If_DsdMan_t * p );
extern int If_DsdManSuppSize( If_DsdMan_t * p, int iDsd );
extern int If_DsdManCheckDec( If_DsdMan_t * p, int iDsd );
extern unsigned If_DsdManCheckXY( If_DsdMan_t * p, int iDsd, int LutSize, int fDerive, int fHighEffort, int fVerbose );
+extern int If_DsdCutBalanceCost( If_Man_t * pIfMan, If_Cut_t * pCut );
+extern int If_DsdCutBalance( void * pGia, If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vLeaves, int fHash );
/*=== ifLib.c =============================================================*/
extern If_LibLut_t * If_LibLutRead( char * FileName );
extern If_LibLut_t * If_LibLutDup( If_LibLut_t * p );
diff --git a/src/map/if/ifDsd.c b/src/map/if/ifDsd.c
index 0d8dc681..055eab84 100644
--- a/src/map/if/ifDsd.c
+++ b/src/map/if/ifDsd.c
@@ -1849,6 +1849,28 @@ void If_DsdManTest()
SeeAlso []
***********************************************************************/
+int If_DsdCutBalanceCost( If_Man_t * pIfMan, If_Cut_t * pCut )
+{
+ return 0;
+}
+int If_DsdCutBalance( void * pGia, If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vLeaves, int fHash )
+{
+ Gia_Man_t * p = (Gia_Man_t *)pGia;
+ return 0;
+}
+
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, int fAdd, int fSpec, int fVerbose )
{
ProgressBar * pProgress = NULL;
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index c5e40dec..2db26927 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -99,6 +99,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_Cut_t * pCut0R, * pCut1R;
int fFunc0R, fFunc1R;
int i, k, v, fChange;
+ int fSave0 = p->pPars->fDelayOpt || p->pPars->fDsdBalance || p->pPars->fUserRecLib;
assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );
@@ -122,12 +123,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if ( !fFirst )
{
// recompute the parameters of the best cut
- if ( p->pPars->fUserRecLib )
- pCut->Delay = If_CutDelayRecCost3(p, pCut, pObj);
- else if(p->pPars->fDelayOpt)
- pCut->Delay = If_CutDelaySopCost(p,pCut);
- else if(p->pPars->nGateSize > 0)
- pCut->Delay = If_CutDelaySop(p,pCut);
+ if ( p->pPars->fDelayOpt )
+ pCut->Delay = If_CutDelaySopCost( p, pCut );
+ else if ( p->pPars->fDsdBalance )
+ pCut->Delay = If_DsdCutBalanceCost( p, pCut );
+ else if ( p->pPars->fUserRecLib )
+ pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj );
+ else if( p->pPars->nGateSize > 0 )
+ pCut->Delay = If_CutDelaySop( p, pCut );
else
pCut->Delay = If_CutDelay( p, pObj, pCut );
// assert( pCut->Delay <= pObj->Required + p->fEpsilon );
@@ -184,7 +187,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
p->nCutsMerged++;
p->nCutsTotal++;
// check if this cut is contained in any of the available cuts
- if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) )
+ if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, fSave0 ) )
continue;
// compute the truth table
pCut->iCutFunc = -1;
@@ -202,7 +205,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
if ( p->pPars->fVerbose )
p->timeCache[4] += Abc_Clock() - clk;
- if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) )
+ if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut, fSave0 ) )
continue;
if ( p->pPars->fUseDsd )
{
@@ -276,19 +279,16 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if ( pCut->Cost == IF_COST_MAX )
continue;
// check if the cut satisfies the required times
-/// if ( p->pPars->pLutStruct )
-/// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
- if ( p->pPars->fUserRecLib )
- pCut->Delay = If_CutDelayRecCost3(p, pCut, pObj);
- else if (p->pPars->fDelayOpt)
- pCut->Delay = If_CutDelaySopCost(p, pCut);
- else if(p->pPars->nGateSize > 0)
- pCut->Delay = If_CutDelaySop(p,pCut);
- else
+ if ( p->pPars->fDelayOpt )
+ pCut->Delay = If_CutDelaySopCost( p, pCut );
+ else if ( p->pPars->fDsdBalance )
+ pCut->Delay = If_DsdCutBalanceCost( p, pCut );
+ else if ( p->pPars->fUserRecLib )
+ pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj );
+ else if( p->pPars->nGateSize > 0 )
+ pCut->Delay = If_CutDelaySop( p, pCut );
+ else
pCut->Delay = If_CutDelay( p, pObj, pCut );
- //if ( pCut->Cost == IF_COST_MAX )
- // continue;
-// Abc_Print( 1, "%.2f ", pCut->Delay );
if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon )
continue;
// compute area of the cut (this area may depend on the application specific cost)
@@ -352,7 +352,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
If_Set_t * pCutSet;
If_Obj_t * pTemp;
If_Cut_t * pCutTemp, * pCut;
- int i;
+ int i, fSave0 = p->pPars->fDelayOpt || p->pPars->fDsdBalance || p->pPars->fUserRecLib;
assert( pObj->pEquiv != NULL );
// prepare
@@ -369,8 +369,6 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
// generate cuts
for ( pTemp = pObj->pEquiv; pTemp; pTemp = pTemp->pEquiv )
{
-// assert( pTemp->nRefs == 0 );
-// assert( p->pPars->fSeqMap || pTemp->pCutSet->nCuts > 0 ); // June 9, 2009
if ( pTemp->pCutSet->nCuts == 0 )
continue;
// go through the cuts of this node
@@ -385,10 +383,10 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
// copy the cut into storage
If_CutCopy( p, pCut, pCutTemp );
// check if this cut is contained in any of the available cuts
- if ( If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) )
+ if ( If_CutFilter( pCutSet, pCut, fSave0 ) )
continue;
// check if the cut satisfies the required times
- assert( pCut->Delay == If_CutDelay( p, pTemp, pCut ) );
+// assert( pCut->Delay == If_CutDelay( p, pTemp, pCut ) );
if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon )
continue;
// set the phase attribute