summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-04-14 09:06:14 -0500
committerAlan Mishchenko <alanmi@berkeley.edu>2014-04-14 09:06:14 -0500
commit02cf86939178ce0f95b98a4c7b432d4375a872e5 (patch)
tree2050cb947436114aa3fd7f4edb0d66bbb3109d38 /src/map/if
parent5cd9145046219f25d6d2ba2d746fcd7bb9531ef2 (diff)
downloadabc-02cf86939178ce0f95b98a4c7b432d4375a872e5.tar.gz
abc-02cf86939178ce0f95b98a4c7b432d4375a872e5.tar.bz2
abc-02cf86939178ce0f95b98a4c7b432d4375a872e5.zip
Changes in the LUT mapper data-structures.
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h6
-rw-r--r--src/map/if/ifCut.c28
-rw-r--r--src/map/if/ifDec16.c3
-rw-r--r--src/map/if/ifDelay.c5
-rw-r--r--src/map/if/ifDsd.c4
-rw-r--r--src/map/if/ifMan.c24
-rw-r--r--src/map/if/ifTime.c5
7 files changed, 16 insertions, 59 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h
index cd1f7b8f..6807e6ad 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -282,8 +282,7 @@ struct If_Cut_t_
unsigned fUseless: 1; // using the user's area and delay
unsigned nLimit : 8; // the maximum number of leaves
unsigned nLeaves : 8; // the number of leaves
- int * pLeaves; // array of fanins
- char * pPerm; // permutation
+ int pLeaves[0];
};
// set of priority cut
@@ -390,6 +389,9 @@ static inline unsigned If_CutSuppMask( If_Cut_t * pCut ) { r
static inline int If_CutTruthWords( int nVarsMax ) { return nVarsMax <= 5 ? 2 : (1 << (nVarsMax - 5)); }
static inline int If_CutPermWords( int nVarsMax ) { return nVarsMax / sizeof(int) + ((nVarsMax % sizeof(int)) > 0); }
static inline int If_CutLeafBit( If_Cut_t * pCut, int i ) { return (pCut->uMaskFunc >> i) & 1; }
+static inline char * If_CutPerm( If_Cut_t * pCut ) { return (char *)(pCut->pLeaves + pCut->nLeaves); }
+static inline void If_CutCopy( If_Man_t * p, If_Cut_t * pDst, If_Cut_t * pSrc ) { memcpy( pDst, pSrc, p->nCutBytes ); }
+static inline void If_CutSetup( If_Man_t * p, If_Cut_t * pCut ) { memset(pCut, 0, p->nCutBytes); pCut->nLimit = p->pPars->nLutSize; }
static inline If_Cut_t * If_ObjCutBest( If_Obj_t * pObj ) { return &pObj->CutBest; }
static inline unsigned If_ObjCutSign( unsigned ObjId ) { return (1 << (ObjId % 31)); }
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index a4c0fd5d..fee46261 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -905,34 +905,6 @@ void If_CutLift( If_Cut_t * pCut )
}
}
-/**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*************************************************************
diff --git a/src/map/if/ifDec16.c b/src/map/if/ifDec16.c
index 21346ffb..22de91ba 100644
--- a/src/map/if/ifDec16.c
+++ b/src/map/if/ifDec16.c
@@ -2141,10 +2141,11 @@ float If_CutDelayLutStruct( If_Man_t * p, If_Cut_t * pCut, char * pStr, float Wi
// consider easy case
if ( nLeaves <= Abc_MaxInt( nLutLeaf, nLutRoot ) )
{
+ char * pPerm = If_CutPerm( pCut );
assert( nLeaves <= 6 );
for ( i = 0; i < nLeaves; i++ )
{
- pCut->pPerm[i] = 1;
+ pPerm[i] = 1;
G1.pVars[i] = i;
}
G1.nVars = nLeaves;
diff --git a/src/map/if/ifDelay.c b/src/map/if/ifDelay.c
index 8873080d..8eb2101d 100644
--- a/src/map/if/ifDelay.c
+++ b/src/map/if/ifDelay.c
@@ -62,6 +62,7 @@ static inline int If_CutMaxCubeSize( Vec_Int_t * vCover, int nVars )
}
int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut )
{
+ char * pPerm = If_CutPerm( pCut );
// delay is calculated using 1+log2(NumFanins)
static double GateDelays[20] = { 1.00, 1.00, 2.00, 2.58, 3.00, 3.32, 3.58, 3.81, 4.00, 4.17, 4.32, 4.46, 4.58, 4.70, 4.81, 4.91, 5.00, 5.09, 5.17, 5.25 };
Vec_Int_t * vCover;
@@ -90,7 +91,7 @@ int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut )
Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + 0.5);
DelayMax = 0;
If_CutForEachLeaf( p, pCut, pLeaf, i )
- DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pCut->pPerm[i] = (char)Delay) );
+ DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pPerm[i] = (char)Delay) );
}
else
{
@@ -98,7 +99,7 @@ int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut )
Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + GateDelays[nLitMax] + 0.5);
DelayMax = 0;
If_CutForEachLeaf( p, pCut, pLeaf, i )
- DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pCut->pPerm[i] = (char)Delay) );
+ DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pPerm[i] = (char)Delay) );
}
return DelayMax;
}
diff --git a/src/map/if/ifDsd.c b/src/map/if/ifDsd.c
index c98342a6..cc90b6cd 100644
--- a/src/map/if/ifDsd.c
+++ b/src/map/if/ifDsd.c
@@ -1919,7 +1919,7 @@ int If_CutDsdBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
int i, Delay, nSupp = 0, pTimes[IF_MAX_FUNC_LUTSIZE];
for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
- Delay = If_CutDsdBalancePinDelays_rec( p->pIfDsdMan, Abc_Lit2Var(If_CutDsdLit(p, pCut)), pTimes, &Result, &nSupp, If_CutLeaveNum(pCut), pCut->pPerm );
+ Delay = If_CutDsdBalancePinDelays_rec( p->pIfDsdMan, Abc_Lit2Var(If_CutDsdLit(p, pCut)), pTimes, &Result, &nSupp, If_CutLeaveNum(pCut), If_CutDsdPerm(p, pCut) );
assert( nSupp == If_CutLeaveNum(pCut) );
If_CutPinDelayTranslate( Result, If_CutLeaveNum(pCut), pPerm );
return Delay;
@@ -2033,7 +2033,7 @@ int If_CutDsdBalanceEval( If_Man_t * p, If_Cut_t * pCut, Vec_Int_t * vAig )
int Delay, Area = 0;
for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
- Delay = If_CutDsdBalanceEvalInt( p->pIfDsdMan, If_CutDsdLit(p, pCut), pTimes, vAig, &Area, pCut->pPerm );
+ Delay = If_CutDsdBalanceEvalInt( p->pIfDsdMan, If_CutDsdLit(p, pCut), pTimes, vAig, &Area, If_CutDsdPerm(p, pCut) );
pCut->Cost = Area;
return Delay;
}
diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c
index c13fc57a..633f7695 100644
--- a/src/map/if/ifMan.c
+++ b/src/map/if/ifMan.c
@@ -419,26 +419,6 @@ void If_ManCreateChoice( If_Man_t * p, If_Obj_t * pObj )
/**Function*************************************************************
- Synopsis [Prepares memory for one cut.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void If_ManSetupCut( If_Man_t * p, If_Cut_t * pCut )
-{
- memset( pCut, 0, sizeof(If_Cut_t) );
- pCut->nLimit = p->pPars->nLutSize;
- pCut->pLeaves = (int *)(pCut + 1);
- if ( p->pPars->fUsePerm )
- pCut->pPerm = (char *)(pCut->pLeaves + p->pPars->nLutSize);
-}
-
-/**Function*************************************************************
-
Synopsis [Prepares memory for one cutset.]
Description []
@@ -459,7 +439,7 @@ void If_ManSetupSet( If_Man_t * p, If_Set_t * pSet )
for ( i = 0; i <= pSet->nCutsMax; i++ )
{
pSet->ppCuts[i] = (If_Cut_t *)(pArray + i * p->nCutBytes);
- If_ManSetupCut( p, pSet->ppCuts[i] );
+ If_CutSetup( p, pSet->ppCuts[i] );
}
// pArray += (pSet->nCutsMax + 1) * p->nCutBytes;
// assert( ((char *)pArray) - ((char *)pSet) == p->nSetBytes );
@@ -505,7 +485,7 @@ If_Obj_t * If_ManSetupObj( If_Man_t * p )
// get memory for the object
pObj = (If_Obj_t *)Mem_FixedEntryFetch( p->pMemObj );
memset( pObj, 0, sizeof(If_Obj_t) );
- If_ManSetupCut( p, &pObj->CutBest );
+ If_CutSetup( p, &pObj->CutBest );
// assign ID and save
pObj->Id = Vec_PtrSize(p->vObjs);
Vec_PtrPush( p->vObjs, pObj );
diff --git a/src/map/if/ifTime.c b/src/map/if/ifTime.c
index 9647fd76..3193c8b0 100644
--- a/src/map/if/ifTime.c
+++ b/src/map/if/ifTime.c
@@ -92,6 +92,7 @@ float If_CutDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut )
{
static int pPinPerm[IF_MAX_LUTSIZE];
static float pPinDelays[IF_MAX_LUTSIZE];
+ char * pPerm = If_CutPerm( pCut );
If_Obj_t * pLeaf;
float Delay, DelayCur;
float * pLutDelays;
@@ -127,7 +128,7 @@ float If_CutDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut )
assert( !p->pPars->fLiftLeaves );
If_CutForEachLeaf( p, pCut, pLeaf, i )
{
- Pin2PinDelay = pCut->pPerm ? (pCut->pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pCut->pPerm[i]) : 1;
+ Pin2PinDelay = pPerm ? (pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pPerm[i]) : 1;
DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)Pin2PinDelay;
Delay = IF_MAX( Delay, DelayCur );
}
@@ -218,7 +219,7 @@ void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut, fl
assert( Delay == (int)pCut->Delay );
}
else
- pPerm = pCut->pPerm;
+ pPerm = If_CutPerm(pCut);
If_CutForEachLeaf( p, pCut, pLeaf, i )
{
Pin2PinDelay = pPerm ? (pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pPerm[i]) : 1;