Commit 865526f8 by Alan Mishchenko

New feature to optimize delay during mapping.

parent e855eaa0
...@@ -1187,7 +1187,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p ...@@ -1187,7 +1187,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p
int nVarsS = 0, pVarsS[IF_MAX_FUNC_LUTSIZE]; int nVarsS = 0, pVarsS[IF_MAX_FUNC_LUTSIZE];
unsigned uSetNew, uSetOld; unsigned uSetNew, uSetOld;
int RetValue, RetValue2, k; int RetValue, RetValue2, k;
char * pPerm = If_CutDsdPerm( pIfMan, pCutBest ); char * pPerm;
if ( Vec_IntSize(vLeaves) <= nLutSize ) if ( Vec_IntSize(vLeaves) <= nLutSize )
{ {
RetValue = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 ); RetValue = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 );
...@@ -1208,6 +1208,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p ...@@ -1208,6 +1208,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p
uSetOld = If_DsdManCheckXY( pIfMan->pIfDsdMan, If_CutDsdLit(pIfMan, pCutBest), nLutSize, 1, 0, 1, 0 ); uSetOld = If_DsdManCheckXY( pIfMan->pIfDsdMan, If_CutDsdLit(pIfMan, pCutBest), nLutSize, 1, 0, 1, 0 );
// remap bound set // remap bound set
uSetNew = 0; uSetNew = 0;
pPerm = If_CutDsdPerm( pIfMan, pCutBest );
for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ ) for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ )
{ {
int iVar = Abc_Lit2Var((int)pPerm[k]); int iVar = Abc_Lit2Var((int)pPerm[k]);
......
...@@ -413,6 +413,7 @@ static inline word * If_CutTruthWR( If_Man_t * p, If_Cut_t * pCut ) { r ...@@ -413,6 +413,7 @@ static inline word * If_CutTruthWR( If_Man_t * p, If_Cut_t * pCut ) { r
static inline unsigned * If_CutTruthUR( If_Man_t * p, If_Cut_t * pCut) { return (unsigned *)If_CutTruthWR(p, pCut); } static inline unsigned * If_CutTruthUR( If_Man_t * p, If_Cut_t * pCut) { return (unsigned *)If_CutTruthWR(p, pCut); }
static inline word * If_CutTruthW( If_Man_t * p, If_Cut_t * pCut ) { if ( p->vTtMem == NULL ) return NULL; assert( pCut->iCutFunc >= 0 ); Abc_TtCopy( p->puTempW, If_CutTruthWR(p, pCut), p->nTruth6Words[pCut->nLeaves], If_CutTruthIsCompl(pCut) ); return p->puTempW; } static inline word * If_CutTruthW( If_Man_t * p, If_Cut_t * pCut ) { if ( p->vTtMem == NULL ) return NULL; assert( pCut->iCutFunc >= 0 ); Abc_TtCopy( p->puTempW, If_CutTruthWR(p, pCut), p->nTruth6Words[pCut->nLeaves], If_CutTruthIsCompl(pCut) ); return p->puTempW; }
static inline unsigned * If_CutTruth( If_Man_t * p, If_Cut_t * pCut ) { return (unsigned *)If_CutTruthW(p, pCut); } static inline unsigned * If_CutTruth( If_Man_t * p, If_Cut_t * pCut ) { return (unsigned *)If_CutTruthW(p, pCut); }
static inline int If_CutDsdLit( If_Man_t * p, If_Cut_t * pCut ) { return Abc_Lit2LitL( Vec_IntArray(p->vTtDsds[pCut->nLeaves]), If_CutTruthLit(pCut) ); } static inline int If_CutDsdLit( If_Man_t * p, If_Cut_t * pCut ) { return Abc_Lit2LitL( Vec_IntArray(p->vTtDsds[pCut->nLeaves]), If_CutTruthLit(pCut) ); }
static inline int If_CutDsdIsCompl( If_Man_t * p, If_Cut_t * pCut ) { return Abc_LitIsCompl( If_CutDsdLit(p, pCut) ); } static inline int If_CutDsdIsCompl( If_Man_t * p, If_Cut_t * pCut ) { return Abc_LitIsCompl( If_CutDsdLit(p, pCut) ); }
static inline char * If_CutDsdPerm( If_Man_t * p, If_Cut_t * pCut ) { return Vec_StrEntryP( p->vTtPerms[pCut->nLeaves], Abc_Lit2Var(pCut->iCutFunc) * Abc_MaxInt(6, pCut->nLeaves) ); } static inline char * If_CutDsdPerm( If_Man_t * p, If_Cut_t * pCut ) { return Vec_StrEntryP( p->vTtPerms[pCut->nLeaves], Abc_Lit2Var(pCut->iCutFunc) * Abc_MaxInt(6, pCut->nLeaves) ); }
......
...@@ -287,8 +287,9 @@ int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm ) ...@@ -287,8 +287,9 @@ int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
} }
else else
{ {
char * pCutPerm = If_CutDsdPerm( p, pCut );
int LutSize = p->pPars->pLutStruct[0] - '0'; int LutSize = p->pPars->pLutStruct[0] - '0';
int i, Delay, DelayMax; int i, Delay, DelayMax = 0;
assert( (If_CutLeaveNum(pCut) > LutSize) == (pCut->uMaskFunc > 0) ); assert( (If_CutLeaveNum(pCut) > LutSize) == (pCut->uMaskFunc > 0) );
for ( i = 0; i < If_CutLeaveNum(pCut); i++ ) for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
{ {
...@@ -296,7 +297,7 @@ int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm ) ...@@ -296,7 +297,7 @@ int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
pPerm[i] = 2; pPerm[i] = 2;
else else
pPerm[i] = 1; pPerm[i] = 1;
Delay = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay; Delay = (int)If_ObjCutBest(If_CutLeaf(p, pCut, pCutPerm[i]))->Delay;
DelayMax = Abc_MaxInt( DelayMax, Delay + (int)pPerm[i] ); DelayMax = Abc_MaxInt( DelayMax, Delay + (int)pPerm[i] );
} }
return DelayMax; return DelayMax;
...@@ -330,17 +331,17 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut ) ...@@ -330,17 +331,17 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut )
} }
else else
{ {
char * pCutPerm = If_CutDsdPerm( p, pCut );
int LutSize = p->pPars->pLutStruct[0] - '0'; int LutSize = p->pPars->pLutStruct[0] - '0';
int i, pTimes[IF_MAX_FUNC_LUTSIZE]; int i, pTimes[IF_MAX_FUNC_LUTSIZE];
int DelayMax = 0, nLeafMax = 0; int DelayMax = 0, nLeafMax = 0;
unsigned uLeafMask = 0; unsigned uLeafMask = 0;
for ( i = 0; i < If_CutLeaveNum(pCut); i++ ) for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
{ {
pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay; pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, pCutPerm[i]))->Delay;
assert( DelayMax <= pTimes[i] );
if ( DelayMax < pTimes[i] ) if ( DelayMax < pTimes[i] )
DelayMax = pTimes[i], nLeafMax = 1, uLeafMask = (1 << (i << 2)); DelayMax = pTimes[i], nLeafMax = 1, uLeafMask = (1 << (i << 2));
else else if ( DelayMax == pTimes[i] )
nLeafMax++, uLeafMask |= (1 << (i << 2)); nLeafMax++, uLeafMask |= (1 << (i << 2));
} }
if ( If_CutLeaveNum(pCut) <= LutSize ) if ( If_CutLeaveNum(pCut) <= LutSize )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment