Commit e855eaa0 by Alan Mishchenko

Improvements to DSD in technology mapping.

parent 80110cc3
...@@ -1187,6 +1187,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p ...@@ -1187,6 +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 );
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 );
...@@ -1209,7 +1210,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p ...@@ -1209,7 +1210,7 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p
uSetNew = 0; uSetNew = 0;
for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ ) for ( k = 0; k < If_CutLeaveNum(pCutBest); k++ )
{ {
int iVar = Abc_Lit2Var((int)pCutBest->pPerm[k]); int iVar = Abc_Lit2Var((int)pPerm[k]);
int Value = ((uSetOld >> (k << 1)) & 3); int Value = ((uSetOld >> (k << 1)) & 3);
if ( Value == 1 ) if ( Value == 1 )
uSetNew |= (1 << (2*iVar)); uSetNew |= (1 << (2*iVar));
......
...@@ -15127,7 +15127,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15127,7 +15127,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fTruth = 1; pPars->fTruth = 1;
pPars->fCutMin = 1; pPars->fCutMin = 1;
pPars->fExpRed = 0; pPars->fExpRed = 0;
pPars->fUsePerm = pPars->fDsdBalance; pPars->fUsePerm = 0;
pPars->fUseDsd = pPars->fDsdBalance; pPars->fUseDsd = pPars->fDsdBalance;
pPars->pLutLib = NULL; pPars->pLutLib = NULL;
} }
...@@ -15147,7 +15147,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15147,7 +15147,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fTruth = 1; pPars->fTruth = 1;
pPars->fCutMin = 1; pPars->fCutMin = 1;
pPars->fExpRed = 0; pPars->fExpRed = 0;
pPars->fUsePerm = pPars->fUseDsd; pPars->fUsePerm = 0;
} }
if ( pPars->fUseDsd ) if ( pPars->fUseDsd )
...@@ -29882,7 +29882,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -29882,7 +29882,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fCutMin = 1; pPars->fCutMin = 1;
pPars->fExpRed = 0; pPars->fExpRed = 0;
pPars->fUsePerm = pPars->fDsdBalance; pPars->fUsePerm = pPars->fDsdBalance;
pPars->fUseDsd = pPars->fDsdBalance; pPars->fUseDsd = 0;
pPars->pLutLib = NULL; pPars->pLutLib = NULL;
} }
// modify for delay optimization // modify for delay optimization
...@@ -29901,7 +29901,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -29901,7 +29901,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fTruth = 1; pPars->fTruth = 1;
pPars->fCutMin = 1; pPars->fCutMin = 1;
pPars->fExpRed = 0; pPars->fExpRed = 0;
pPars->fUsePerm = pPars->fUseDsd; pPars->fUsePerm = 0;
} }
if ( pPars->fUseDsd ) if ( pPars->fUseDsd )
...@@ -385,6 +385,7 @@ static inline void If_ObjSetChoice( If_Obj_t * pObj, If_Obj_t * pEqu ) { p ...@@ -385,6 +385,7 @@ static inline void If_ObjSetChoice( If_Obj_t * pObj, If_Obj_t * pEqu ) { p
static inline int If_CutLeaveNum( If_Cut_t * pCut ) { return pCut->nLeaves; } static inline int If_CutLeaveNum( If_Cut_t * pCut ) { return pCut->nLeaves; }
static inline int * If_CutLeaves( If_Cut_t * pCut ) { return pCut->pLeaves; } static inline int * If_CutLeaves( If_Cut_t * pCut ) { return pCut->pLeaves; }
static inline If_Obj_t * If_CutLeaf( If_Man_t * p, If_Cut_t * pCut, int i ) { assert(i >= 0 && i < (int)pCut->nLeaves); return If_ManObj(p, pCut->pLeaves[i]); }
static inline unsigned If_CutSuppMask( If_Cut_t * pCut ) { return (~(unsigned)0) >> (32-pCut->nLeaves); } static inline unsigned If_CutSuppMask( If_Cut_t * pCut ) { return (~(unsigned)0) >> (32-pCut->nLeaves); }
static inline int If_CutTruthWords( int nVarsMax ) { return nVarsMax <= 5 ? 2 : (1 << (nVarsMax - 5)); } 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_CutPermWords( int nVarsMax ) { return nVarsMax / sizeof(int) + ((nVarsMax % sizeof(int)) > 0); }
...@@ -413,8 +414,8 @@ static inline unsigned * If_CutTruthUR( If_Man_t * p, If_Cut_t * pCut) { r ...@@ -413,8 +414,8 @@ static inline unsigned * If_CutTruthUR( If_Man_t * p, If_Cut_t * pCut) { r
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 If_Obj_t * If_CutLeaf( If_Man_t * p, If_Cut_t * pCut, int i ) { assert(i >= 0 && i < (int)pCut->nLeaves); return If_ManObj(p, pCut->pLeaves[i]); } 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 float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { return pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0); } static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { return pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0); }
static inline float If_CutLutDelay( If_LibLut_t * p, int Size, int iPin ) { return p ? (p->fVarPinDelays ? p->pLutDelays[Size][iPin] : p->pLutDelays[Size][0]) : 1.0; } static inline float If_CutLutDelay( If_LibLut_t * p, int Size, int iPin ) { return p ? (p->fVarPinDelays ? p->pLutDelays[Size][iPin] : p->pLutDelays[Size][0]) : 1.0; }
......
...@@ -484,11 +484,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) ...@@ -484,11 +484,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId; pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId;
pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] ); pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
pCut->iCutFunc = p->pPars->fUseTtPerm ? 3 : (p->pPars->fTruth ? 2: -1); pCut->iCutFunc = p->pPars->fUseTtPerm ? 3 : (p->pPars->fTruth ? 2: -1);
// pCut->iCutDsd = p->pPars->fUseTtPerm ? 0 : (p->pPars->fUseDsd ? 2: -1);
pCut->uMaskFunc = 0; pCut->uMaskFunc = 0;
assert( pCut->pLeaves[0] < p->vObjs->nSize ); assert( pCut->pLeaves[0] < p->vObjs->nSize );
if ( p->pPars->fUseDsd )
pCut->pPerm[0] = 0;
} }
/**Function************************************************************* /**Function*************************************************************
......
...@@ -98,7 +98,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -98,7 +98,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_Cut_t * pCut0, * pCut1, * pCut; If_Cut_t * pCut0, * pCut1, * pCut;
If_Cut_t * pCut0R, * pCut1R; If_Cut_t * pCut0R, * pCut1R;
int fFunc0R, fFunc1R; int fFunc0R, fFunc1R;
int i, k, v, fChange; int i, k, v, iCutDsd, fChange;
int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib; int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib;
assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 ); assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 ); assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );
...@@ -191,7 +191,6 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -191,7 +191,6 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
continue; continue;
// compute the truth table // compute the truth table
pCut->iCutFunc = -1; pCut->iCutFunc = -1;
// pCut->iCutDsd = -1;
pCut->fCompl = 0; pCut->fCompl = 0;
if ( p->pPars->fTruth ) if ( p->pPars->fTruth )
{ {
...@@ -211,26 +210,19 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -211,26 +210,19 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
{ {
extern void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd ); extern void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd );
int truthId = Abc_Lit2Var(pCut->iCutFunc); int truthId = Abc_Lit2Var(pCut->iCutFunc);
if ( Vec_IntSize(p->vTtDsds[pCut->nLeaves]) <= truthId || Vec_IntEntry(p->vTtDsds[pCut->nLeaves], truthId) == -1 ) if ( truthId >= Vec_IntSize(p->vTtDsds[pCut->nLeaves]) || Vec_IntEntry(p->vTtDsds[pCut->nLeaves], truthId) == -1 )
{ {
int iCutDsd = If_DsdManCompute( p->pIfDsdMan, If_CutTruthWR(p, pCut), pCut->nLeaves, (unsigned char *)pCut->pPerm, p->pPars->pLutStruct ); while ( truthId >= Vec_IntSize(p->vTtDsds[pCut->nLeaves]) )
while ( Vec_IntSize(p->vTtDsds[pCut->nLeaves]) <= truthId )
{ {
Vec_IntPush( p->vTtDsds[pCut->nLeaves], -1 ); Vec_IntPush( p->vTtDsds[pCut->nLeaves], -1 );
for ( v = 0; v < Abc_MaxInt(6, pCut->nLeaves); v++ ) for ( v = 0; v < Abc_MaxInt(6, pCut->nLeaves); v++ )
Vec_StrPush( p->vTtPerms[pCut->nLeaves], IF_BIG_CHAR ); Vec_StrPush( p->vTtPerms[pCut->nLeaves], IF_BIG_CHAR );
} }
iCutDsd = If_DsdManCompute( p->pIfDsdMan, If_CutTruthWR(p, pCut), pCut->nLeaves, (unsigned char *)If_CutDsdPerm(p, pCut), p->pPars->pLutStruct );
Vec_IntWriteEntry( p->vTtDsds[pCut->nLeaves], truthId, iCutDsd ); Vec_IntWriteEntry( p->vTtDsds[pCut->nLeaves], truthId, iCutDsd );
for ( v = 0; v < (int)pCut->nLeaves; v++ )
Vec_StrWriteEntry( p->vTtPerms[pCut->nLeaves], truthId * Abc_MaxInt(6, pCut->nLeaves) + v, (char)pCut->pPerm[v] );
} }
else assert( If_DsdManSuppSize(p->pIfDsdMan, If_CutDsdLit(p, pCut)) == (int)pCut->nLeaves );
{ //If_ManCacheRecord( p, If_CutDsdLit(p, pCut0), If_CutDsdLit(p, pCut1), nShared, If_CutDsdLit(p, pCut) );
assert( If_DsdManSuppSize(p->pIfDsdMan, If_CutDsdLit(p, pCut)) == (int)pCut->nLeaves );
for ( v = 0; v < (int)pCut->nLeaves; v++ )
pCut->pPerm[v] = (unsigned char)Vec_StrEntry( p->vTtPerms[pCut->nLeaves], truthId * Abc_MaxInt(6, pCut->nLeaves) + v );
}
// If_ManCacheRecord( p, If_CutDsdLit(p, pCut0), If_CutDsdLit(p, pCut1), nShared, If_CutDsdLit(p, pCut) );
} }
// run user functions // run user functions
pCut->fUseless = 0; pCut->fUseless = 0;
......
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