From eb66ce9c3133f8149959c84a9ab71faa6249870d Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 17 Feb 2014 12:19:42 -0800 Subject: Changes to LUT mappers. --- src/map/if/if.h | 5 ++--- src/map/if/ifCut.c | 7 ++++++- src/map/if/ifMan.c | 15 +++------------ src/map/if/ifMap.c | 48 ++++++++++++++++++++++++------------------------ 4 files changed, 35 insertions(+), 40 deletions(-) (limited to 'src/map') diff --git a/src/map/if/if.h b/src/map/if/if.h index 26d582db..3c844a8b 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -230,8 +230,6 @@ struct If_Man_t_ int nCutsCountAll; int nCutsUselessAll; int nCuts5, nCuts5a; -// Abc_Nam_t * pNamDsd; - int iNamVar; Dss_Man_t * pDsdMan; Vec_Mem_t * vTtMem; // truth table memory and hash table int nBestCutSmall[2]; @@ -256,7 +254,8 @@ struct If_Cut_t_ float Edge; // the edge flow float Power; // the power flow 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 Cost : 13; // the user's cost of the cut (related to IF_COST_MAX) unsigned fCompl : 1; // the complemented attribute diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index 9d84a496..65627dc2 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -885,7 +885,12 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ) 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 ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 ) diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 3034df67..6334505b 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -84,13 +84,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) p->puTemp[3] = p->puTemp[2] + p->nTruth6Words*2; p->puTempW = p->pPars->fTruth? ABC_ALLOC( word, p->nTruth6Words ) : NULL; 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->iNamVar = 2; - } - // create the constant node p->pConst1 = If_ManSetupObj( p ); p->pConst1->Type = IF_CONST1; @@ -436,14 +430,11 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) pCut->nLeaves = 1; pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId; pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] ); + pCut->iCutFunc = p->pPars->fTruth ? 2 : -1; + pCut->iCutDsd = p->pPars->fUseDsd ? 2 : -1; + assert( pCut->pLeaves[0] < p->vObjs->nSize ); 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; - assert( pCut->pLeaves[0] < p->vObjs->nSize ); } /**Function************************************************************* diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index d8f8785f..8342e118 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -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 ( pObj->Id == 153 ) + { + int s = 0; + } // generate cuts If_ObjForEachCut( pObj->pFanin0, pCut0, i ) 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 // compute the truth table pCut->fCompl = 0; pCut->iCutFunc = -1; + pCut->iCutDsd = -1; if ( p->pPars->fTruth ) { // 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; - pCut->fUseless = 0; - if ( p->pPars->pFuncCell && RetValue < 2 ) + if ( p->pPars->pFuncCell ) { assert( pCut->nLimit >= 4 && pCut->nLimit <= 16 ); pCut->fUseless = !p->pPars->pFuncCell( p, If_CutTruth(p, pCut), pCut->nLimit, pCut->nLeaves, p->pPars->pLutStruct ); @@ -253,29 +257,25 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep } if ( p->pPars->fUseDsd ) { - if ( pCut0->iCutFunc < 0 || pCut1->iCutFunc < 0 ) - pCut->iCutFunc = -1; - else + int j, iDsd[2] = { Abc_LitNotCond(pCut0->iCutDsd, pObj->fCompl0), Abc_LitNotCond(pCut1->iCutDsd, pObj->fCompl1) }; + int nFans[2] = { pCut0->nLeaves, pCut1->nLeaves }; + int Fans[2][DAU_MAX_VAR], * pFans[2] = { Fans[0], Fans[1] }; + assert( pCut0->iCutDsd >= 0 && pCut1->iCutDsd >= 0 ); + // create fanins + for ( j = 0; j < (int)pCut0->nLeaves; j++ ) + pFans[0][j] = Abc_Lit2LitV( p->pPerm[0], (int)pCut0->pPerm[j] ); + for ( j = 0; j < (int)pCut1->nLeaves; j++ ) + pFans[1][j] = Abc_Lit2LitV( p->pPerm[1], (int)pCut1->pPerm[j] ); + // canonicize + if ( iDsd[0] > iDsd[1] ) { - int j, iDsd[2] = { Abc_LitNotCond(pCut0->iCutFunc, pObj->fCompl0), Abc_LitNotCond(pCut1->iCutFunc, pObj->fCompl1) }; - int nFans[2] = { pCut0->nLeaves, pCut1->nLeaves }; - int Fans[2][DAU_MAX_VAR], * pFans[2] = { Fans[0], Fans[1] }; - // create fanins - for ( j = 0; j < (int)pCut0->nLeaves; j++ ) - pFans[0][j] = Abc_Lit2LitV( p->pPerm[0], (int)pCut0->pPerm[j] ); - for ( j = 0; j < (int)pCut1->nLeaves; j++ ) - pFans[1][j] = Abc_Lit2LitV( p->pPerm[1], (int)pCut1->pPerm[j] ); - // canonicize - if ( iDsd[0] > iDsd[1] ) - { - ABC_SWAP( int, iDsd[0], iDsd[1] ); - ABC_SWAP( int, nFans[0], nFans[1] ); - ABC_SWAP( int *, pFans[0], pFans[1] ); - } - // derive new DSD - pCut->iCutFunc = Dss_ManMerge( p->pDsdMan, iDsd, nFans, pFans, p->uSharedMask, pCut->nLimit, (unsigned char *)pCut->pPerm, If_CutTruthW(p, pCut) ); + ABC_SWAP( int, iDsd[0], iDsd[1] ); + ABC_SWAP( int, nFans[0], nFans[1] ); + ABC_SWAP( int *, pFans[0], pFans[1] ); } - if ( pCut->iCutFunc < 0 ) + // derive new DSD + 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 ) { pCut->fUseless = 1; p->nCutsUselessAll++; -- cgit v1.2.3