Commit 5cd91450 by Alan Mishchenko

New feature to optimize delay during mapping.

parent e7d0c9dc
...@@ -289,15 +289,18 @@ int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm ) ...@@ -289,15 +289,18 @@ int If_CutLutBalancePinDelays( If_Man_t * p, If_Cut_t * pCut, char * pPerm )
{ {
char * pCutPerm = If_CutDsdPerm( p, pCut ); char * pCutPerm = If_CutDsdPerm( p, pCut );
int LutSize = p->pPars->pLutStruct[0] - '0'; int LutSize = p->pPars->pLutStruct[0] - '0';
int i, Delay, DelayMax = 0; int i, Delay, DelayMax = -1;
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++ )
{ {
if ( If_CutLeaveNum(pCut) > LutSize && ((pCut->uMaskFunc >> (i << 2)) & 1) ) if ( If_CutLeaveNum(pCut) > LutSize && ((pCut->uMaskFunc >> (i << 1)) & 1) )
pPerm[i] = 2; pPerm[Abc_Lit2Var((int)pCutPerm[i])] = 2;
else else
pPerm[i] = 1; pPerm[Abc_Lit2Var((int)pCutPerm[i])] = 1;
Delay = (int)If_ObjCutBest(If_CutLeaf(p, pCut, Abc_Lit2Var(pCutPerm[i])))->Delay; }
for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
{
Delay = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
DelayMax = Abc_MaxInt( DelayMax, Delay + (int)pPerm[i] ); DelayMax = Abc_MaxInt( DelayMax, Delay + (int)pPerm[i] );
} }
return DelayMax; return DelayMax;
...@@ -335,15 +338,15 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut ) ...@@ -335,15 +338,15 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut )
char * pCutPerm = If_CutDsdPerm( p, pCut ); 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 = -1, 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, Abc_Lit2Var(pCutPerm[i])))->Delay; pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, Abc_Lit2Var((int)pCutPerm[i])))->Delay;
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 << 1));
else if ( DelayMax == pTimes[i] ) else if ( DelayMax == pTimes[i] )
nLeafMax++, uLeafMask |= (1 << (i << 2)); nLeafMax++, uLeafMask |= (1 << (i << 1));
} }
if ( If_CutLeaveNum(pCut) <= LutSize ) if ( If_CutLeaveNum(pCut) <= LutSize )
return DelayMax + 1; return DelayMax + 1;
...@@ -355,9 +358,37 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut ) ...@@ -355,9 +358,37 @@ int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut )
return DelayMax + 1; return DelayMax + 1;
} }
pCut->uMaskFunc = If_DsdManCheckXY( p->pIfDsdMan, If_CutDsdLit(p, pCut), LutSize, 1, 0, 0, 0 ); pCut->uMaskFunc = If_DsdManCheckXY( p->pIfDsdMan, If_CutDsdLit(p, pCut), LutSize, 1, 0, 0, 0 );
if ( pCut->uMaskFunc == 0 )
return -1;
return DelayMax + 2; return DelayMax + 2;
} }
} }
/*
int If_CutLutBalanceEval( If_Man_t * p, If_Cut_t * pCut )
{
char pPerm[16];
int Delay2, Delay = If_CutLutBalanceEvalInt( p, pCut );
if ( Delay == -1 )
return -1;
Delay2 = If_CutLutBalancePinDelays( p, pCut, pPerm );
if ( Delay2 != Delay )
{
int s = 0;
char * pCutPerm = If_CutDsdPerm( p, pCut );
If_DsdManPrintNode( p->pIfDsdMan, If_CutDsdLit(p, pCut) ); Dau_DecPrintSet( pCut->uMaskFunc, pCut->nLeaves, 1 );
Kit_DsdPrintFromTruth( If_CutTruthUR(p, pCut), pCut->nLeaves ); printf( "\n" );
for ( s = 0; s < pCut->nLeaves; s++ )
// printf( "%d ", (int)If_ObjCutBest(If_CutLeaf(p, pCut, Abc_Lit2Var((int)pCutPerm[s])))->Delay );
printf( "%d ", (int)If_ObjCutBest(If_CutLeaf(p, pCut, s))->Delay );
printf( "\n" );
Delay = If_CutLutBalanceEvalInt( p, pCut );
Delay2 = If_CutLutBalancePinDelays( p, pCut, pPerm );
}
return Delay;
}
*/
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
......
...@@ -1676,6 +1676,7 @@ unsigned If_DsdManCheckXY_int( If_DsdMan_t * p, int iDsd, int LutSize, int fDeri ...@@ -1676,6 +1676,7 @@ unsigned If_DsdManCheckXY_int( If_DsdMan_t * p, int iDsd, int LutSize, int fDeri
{ {
If_DsdObj_t * pObj, * pTemp; If_DsdObj_t * pObj, * pTemp;
int i, Mask, iFirst; int i, Mask, iFirst;
unsigned uRes;
pObj = If_DsdVecObj( &p->vObjs, Abc_Lit2Var(iDsd) ); pObj = If_DsdVecObj( &p->vObjs, Abc_Lit2Var(iDsd) );
if ( fVerbose ) if ( fVerbose )
If_DsdManPrintOne( stdout, p, Abc_Lit2Var(iDsd), NULL, 0 ); If_DsdManPrintOne( stdout, p, Abc_Lit2Var(iDsd), NULL, 0 );
...@@ -1694,7 +1695,10 @@ unsigned If_DsdManCheckXY_int( If_DsdMan_t * p, int iDsd, int LutSize, int fDeri ...@@ -1694,7 +1695,10 @@ unsigned If_DsdManCheckXY_int( If_DsdMan_t * p, int iDsd, int LutSize, int fDeri
if ( fVerbose ) if ( fVerbose )
If_DsdManPrintOne( stdout, p, pTemp->Id, NULL, 1 ); If_DsdManPrintOne( stdout, p, pTemp->Id, NULL, 1 );
iFirst = Vec_IntEntry(p->vTemp2, i); iFirst = Vec_IntEntry(p->vTemp2, i);
return If_DsdSign_rec(p, pTemp, &iFirst); uRes = If_DsdSign_rec(p, pTemp, &iFirst);
if ( uRes & uMaskNot )
continue;
return uRes;
} }
If_DsdVecForEachObjVec( p->vTemp1, &p->vObjs, pTemp, i ) If_DsdVecForEachObjVec( p->vTemp1, &p->vObjs, pTemp, i )
if ( (If_DsdObjType(pTemp) == IF_DSD_AND || If_DsdObjType(pTemp) == IF_DSD_XOR) && If_DsdObjFaninNum(pTemp) > 2 && If_DsdObjSuppSize(pTemp) > LutSize ) if ( (If_DsdObjType(pTemp) == IF_DSD_AND || If_DsdObjType(pTemp) == IF_DSD_XOR) && If_DsdObjFaninNum(pTemp) > 2 && If_DsdObjSuppSize(pTemp) > 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