Commit eb66ce9c by Alan Mishchenko

Changes to LUT mappers.

parent adb3044f
...@@ -15075,7 +15075,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15075,7 +15075,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->fUseDsd ) if ( pPars->fUseDsd )
{ {
pPars->fTruth = 1; pPars->fTruth = 0;
pPars->fCutMin = 1; pPars->fCutMin = 1;
pPars->fExpRed = 0; pPars->fExpRed = 0;
pPars->fUsePerm = 1; pPars->fUsePerm = 1;
...@@ -230,8 +230,6 @@ struct If_Man_t_ ...@@ -230,8 +230,6 @@ struct If_Man_t_
int nCutsCountAll; int nCutsCountAll;
int nCutsUselessAll; int nCutsUselessAll;
int nCuts5, nCuts5a; int nCuts5, nCuts5a;
// Abc_Nam_t * pNamDsd;
int iNamVar;
Dss_Man_t * pDsdMan; Dss_Man_t * pDsdMan;
Vec_Mem_t * vTtMem; // truth table memory and hash table Vec_Mem_t * vTtMem; // truth table memory and hash table
int nBestCutSmall[2]; int nBestCutSmall[2];
...@@ -256,7 +254,8 @@ struct If_Cut_t_ ...@@ -256,7 +254,8 @@ struct If_Cut_t_
float Edge; // the edge flow float Edge; // the edge flow
float Power; // the power flow float Power; // the power flow
float Delay; // delay of the cut float Delay; // delay of the cut
int iCutFunc; // DSD ID of the cut int iCutFunc; // TT ID of the cut
int iCutDsd; // DSD ID of the cut
unsigned uSign; // cut signature unsigned uSign; // cut signature
unsigned Cost : 13; // the user's cost of the cut (related to IF_COST_MAX) unsigned Cost : 13; // the user's cost of the cut (related to IF_COST_MAX)
unsigned fCompl : 1; // the complemented attribute unsigned fCompl : 1; // the complemented attribute
......
...@@ -885,7 +885,12 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ) ...@@ -885,7 +885,12 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
return; return;
} }
if ( (p->pPars->fUseDsd || p->pPars->fUseBat || p->pPars->fEnableCheck07 || p->pPars->fEnableCheck08 || p->pPars->fEnableCheck10 || p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u || p->pPars->pLutStruct || p->pPars->fUserRecLib) && !pCut->fUseless ) if ( !pCut->fUseless &&
(p->pPars->fUseDsd || p->pPars->fUseBat ||
p->pPars->pLutStruct || p->pPars->fUserRecLib ||
p->pPars->fEnableCheck07 || p->pPars->fEnableCheck08 ||
p->pPars->fEnableCheck10 || p->pPars->fEnableCheck75 ||
p->pPars->fEnableCheck75u) )
{ {
If_Cut_t * pFirst = pCutSet->ppCuts[0]; If_Cut_t * pFirst = pCutSet->ppCuts[0];
if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 ) if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 )
......
...@@ -84,13 +84,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) ...@@ -84,13 +84,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p->puTemp[3] = p->puTemp[2] + p->nTruth6Words*2; p->puTemp[3] = p->puTemp[2] + p->nTruth6Words*2;
p->puTempW = p->pPars->fTruth? ABC_ALLOC( word, p->nTruth6Words ) : NULL; p->puTempW = p->pPars->fTruth? ABC_ALLOC( word, p->nTruth6Words ) : NULL;
if ( pPars->fUseDsd ) if ( pPars->fUseDsd )
{
// p->pNamDsd = Abc_NamStart( 1000, 20 );
// p->iNamVar = Abc_NamStrFindOrAdd( p->pNamDsd, "a", NULL );
p->pDsdMan = Dss_ManAlloc( pPars->nLutSize, pPars->nNonDecLimit ); p->pDsdMan = Dss_ManAlloc( pPars->nLutSize, pPars->nNonDecLimit );
p->iNamVar = 2;
}
// create the constant node // create the constant node
p->pConst1 = If_ManSetupObj( p ); p->pConst1 = If_ManSetupObj( p );
p->pConst1->Type = IF_CONST1; p->pConst1->Type = IF_CONST1;
...@@ -436,14 +430,11 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) ...@@ -436,14 +430,11 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut->nLeaves = 1; pCut->nLeaves = 1;
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] );
if ( p->pPars->fUseDsd )
{
pCut->iCutFunc = p->iNamVar;
pCut->pPerm[0] = 0;
}
// set up elementary truth table of the unit cut
pCut->iCutFunc = p->pPars->fTruth ? 2 : -1; pCut->iCutFunc = p->pPars->fTruth ? 2 : -1;
pCut->iCutDsd = p->pPars->fUseDsd ? 2 : -1;
assert( pCut->pLeaves[0] < p->vObjs->nSize ); assert( pCut->pLeaves[0] < p->vObjs->nSize );
if ( p->pPars->fUseDsd )
pCut->pPerm[0] = 0;
} }
/**Function************************************************************* /**Function*************************************************************
......
...@@ -186,6 +186,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -186,6 +186,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_CutCopy( p, pCutSet->ppCuts[pCutSet->nCuts++], pCut ); If_CutCopy( p, pCutSet->ppCuts[pCutSet->nCuts++], pCut );
} }
if ( pObj->Id == 153 )
{
int s = 0;
}
// generate cuts // generate cuts
If_ObjForEachCut( pObj->pFanin0, pCut0, i ) If_ObjForEachCut( pObj->pFanin0, pCut0, i )
If_ObjForEachCut( pObj->pFanin1, pCut1, k ) If_ObjForEachCut( pObj->pFanin1, pCut1, k )
...@@ -211,14 +215,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -211,14 +215,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// compute the truth table // compute the truth table
pCut->fCompl = 0; pCut->fCompl = 0;
pCut->iCutFunc = -1; pCut->iCutFunc = -1;
pCut->iCutDsd = -1;
if ( p->pPars->fTruth ) if ( p->pPars->fTruth )
{ {
// abctime clk = Abc_Clock(); // abctime clk = Abc_Clock();
int RetValue = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
// p->timeTruth += Abc_Clock() - clk; // p->timeTruth += Abc_Clock() - clk;
pCut->fUseless = 0; pCut->fUseless = 0;
if ( p->pPars->pFuncCell && RetValue < 2 ) if ( p->pPars->pFuncCell )
{ {
assert( pCut->nLimit >= 4 && pCut->nLimit <= 16 ); assert( pCut->nLimit >= 4 && pCut->nLimit <= 16 );
pCut->fUseless = !p->pPars->pFuncCell( p, If_CutTruth(p, pCut), pCut->nLimit, pCut->nLeaves, p->pPars->pLutStruct ); pCut->fUseless = !p->pPars->pFuncCell( p, If_CutTruth(p, pCut), pCut->nLimit, pCut->nLeaves, p->pPars->pLutStruct );
...@@ -253,13 +257,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -253,13 +257,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
} }
if ( p->pPars->fUseDsd ) if ( p->pPars->fUseDsd )
{ {
if ( pCut0->iCutFunc < 0 || pCut1->iCutFunc < 0 ) int j, iDsd[2] = { Abc_LitNotCond(pCut0->iCutDsd, pObj->fCompl0), Abc_LitNotCond(pCut1->iCutDsd, pObj->fCompl1) };
pCut->iCutFunc = -1;
else
{
int j, iDsd[2] = { Abc_LitNotCond(pCut0->iCutFunc, pObj->fCompl0), Abc_LitNotCond(pCut1->iCutFunc, pObj->fCompl1) };
int nFans[2] = { pCut0->nLeaves, pCut1->nLeaves }; int nFans[2] = { pCut0->nLeaves, pCut1->nLeaves };
int Fans[2][DAU_MAX_VAR], * pFans[2] = { Fans[0], Fans[1] }; int Fans[2][DAU_MAX_VAR], * pFans[2] = { Fans[0], Fans[1] };
assert( pCut0->iCutDsd >= 0 && pCut1->iCutDsd >= 0 );
// create fanins // create fanins
for ( j = 0; j < (int)pCut0->nLeaves; j++ ) for ( j = 0; j < (int)pCut0->nLeaves; j++ )
pFans[0][j] = Abc_Lit2LitV( p->pPerm[0], (int)pCut0->pPerm[j] ); pFans[0][j] = Abc_Lit2LitV( p->pPerm[0], (int)pCut0->pPerm[j] );
...@@ -273,9 +274,8 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -273,9 +274,8 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
ABC_SWAP( int *, pFans[0], pFans[1] ); ABC_SWAP( int *, pFans[0], pFans[1] );
} }
// derive new DSD // derive new DSD
pCut->iCutFunc = Dss_ManMerge( p->pDsdMan, iDsd, nFans, pFans, p->uSharedMask, pCut->nLimit, (unsigned char *)pCut->pPerm, If_CutTruthW(p, pCut) ); pCut->iCutDsd = Dss_ManMerge( p->pDsdMan, iDsd, nFans, pFans, p->uSharedMask, pCut->nLimit, (unsigned char *)pCut->pPerm, If_CutTruthW(p, pCut) );
} if ( pCut->iCutDsd < 0 )
if ( pCut->iCutFunc < 0 )
{ {
pCut->fUseless = 1; pCut->fUseless = 1;
p->nCutsUselessAll++; p->nCutsUselessAll++;
......
...@@ -981,7 +981,7 @@ Dss_Man_t * Dss_ManAlloc( int nVars, int nNonDecLimit ) ...@@ -981,7 +981,7 @@ Dss_Man_t * Dss_ManAlloc( int nVars, int nNonDecLimit )
p->vCopies = Vec_IntAlloc( 32 ); p->vCopies = Vec_IntAlloc( 32 );
p->pTtElems = Dss_ManTtElems(); p->pTtElems = Dss_ManTtElems();
p->pMemEnts = Mem_FlexStart(); p->pMemEnts = Mem_FlexStart();
Dss_ManCacheAlloc( p ); // Dss_ManCacheAlloc( p );
return p; return p;
} }
void Dss_ManFree( Dss_Man_t * p ) void Dss_ManFree( Dss_Man_t * p )
......
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