Commit cb7bf6ae by Alan Mishchenko

Improvements to the truth table computation in 'if' package.

parent f416e849
...@@ -353,8 +353,9 @@ static inline void If_CutSetDataInt( If_Cut_t * pCut, int Data ) { * ...@@ -353,8 +353,9 @@ static inline void If_CutSetDataInt( If_Cut_t * pCut, int Data ) { *
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 unsigned * If_CutTruth( If_Cut_t * pCut ) { return pCut->pTruth; } static inline unsigned * If_CutTruth( If_Cut_t * pCut ) { return pCut->pTruth; }
static inline word * If_CutTruthW( If_Cut_t * pCut ) { return (word *)pCut->pTruth; }
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 ? 1 : (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); }
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); }
...@@ -505,8 +506,9 @@ extern void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, I ...@@ -505,8 +506,9 @@ extern void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, I
extern void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut ); extern void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut );
/*=== ifTruth.c ===========================================================*/ /*=== ifTruth.c ===========================================================*/
extern int If_CutTruthMinimize( If_Man_t * p, If_Cut_t * pCut ); extern int If_CutTruthMinimize( If_Man_t * p, If_Cut_t * pCut );
extern int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int fCompl0, int fCompl1 );
extern void If_CutTruthPermute( unsigned * pOut, unsigned * pIn, int nVars, float * pDelays, int * pVars ); extern void If_CutTruthPermute( unsigned * pOut, unsigned * pIn, int nVars, float * pDelays, int * pVars );
extern int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int fCompl0, int fCompl1 );
extern int If_CutComputeTruth2( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int fCompl0, int fCompl1 );
/*=== ifUtil.c ============================================================*/ /*=== ifUtil.c ============================================================*/
extern void If_ManCleanNodeCopy( If_Man_t * p ); extern void If_ManCleanNodeCopy( If_Man_t * p );
extern void If_ManCleanCutData( If_Man_t * p ); extern void If_ManCleanCutData( If_Man_t * p );
......
...@@ -411,8 +411,7 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) ...@@ -411,8 +411,7 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
// set up elementary truth table of the unit cut // set up elementary truth table of the unit cut
if ( p->pPars->fTruth ) if ( p->pPars->fTruth )
{ {
int i, nTruthWords; int i, nTruthWords = If_CutTruthWords(pCut->nLimit);
nTruthWords = pCut->nLimit <= 5 ? 1 : (1 << (pCut->nLimit - 5));
for ( i = 0; i < nTruthWords; i++ ) for ( i = 0; i < nTruthWords; i++ )
If_CutTruth(pCut)[i] = 0xAAAAAAAA; If_CutTruth(pCut)[i] = 0xAAAAAAAA;
} }
......
...@@ -212,8 +212,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -212,8 +212,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if ( p->pPars->fTruth ) if ( p->pPars->fTruth )
{ {
// clock_t clk = clock(); // clock_t clk = clock();
int RetValue = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); // int RetValue = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
int RetValue = If_CutComputeTruth2( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
// p->timeTruth += clock() - clk; // p->timeTruth += clock() - clk;
pCut->fUseless = 0; pCut->fUseless = 0;
if ( p->pPars->pFuncCell && RetValue < 2 ) if ( p->pPars->pFuncCell && RetValue < 2 )
{ {
......
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