mirror of https://github.com/YosysHQ/abc.git
Adding on-the-fly truth-table minimization.
This commit is contained in:
parent
334911a116
commit
490e84c4bc
|
|
@ -177,6 +177,7 @@ struct If_Man_t_
|
||||||
int nCutsUsed; // the number of cuts currently used
|
int nCutsUsed; // the number of cuts currently used
|
||||||
int nCutsMerged; // the total number of cuts merged
|
int nCutsMerged; // the total number of cuts merged
|
||||||
unsigned * puTemp[4]; // used for the truth table computation
|
unsigned * puTemp[4]; // used for the truth table computation
|
||||||
|
If_Cut_t * pCutTemp; // temporary cut
|
||||||
int SortMode; // one of the three sorting modes
|
int SortMode; // one of the three sorting modes
|
||||||
int fNextRound; // set to 1 after the first round
|
int fNextRound; // set to 1 after the first round
|
||||||
int nChoices; // the number of choice nodes
|
int nChoices; // the number of choice nodes
|
||||||
|
|
@ -495,6 +496,7 @@ extern float If_CutDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pC
|
||||||
extern void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut, float Required );
|
extern void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut, float Required );
|
||||||
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_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int fCompl0, int fCompl1 );
|
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 );
|
||||||
/*=== ifUtil.c ============================================================*/
|
/*=== ifUtil.c ============================================================*/
|
||||||
|
|
|
||||||
|
|
@ -2040,6 +2040,23 @@ int If_CutPerformCheck16( If_Man_t * p, unsigned * pTruth, int nVars, int nLeave
|
||||||
{
|
{
|
||||||
If_Grp_t G1 = {0};//, G3 = {0};
|
If_Grp_t G1 = {0};//, G3 = {0};
|
||||||
int i, nLutLeaf, nLutLeaf2, nLutRoot, Length;
|
int i, nLutLeaf, nLutLeaf2, nLutRoot, Length;
|
||||||
|
// if cutmin is disabled, minimize the cut
|
||||||
|
if ( !p->pPars->fCutMin && If_CluSupportSize((word *)pTruth, nVars) < nLeaves )
|
||||||
|
{
|
||||||
|
If_Cut_t * pCut = p->pCutTemp;
|
||||||
|
pCut->nLimit = nVars;
|
||||||
|
pCut->nLeaves = nLeaves;
|
||||||
|
pCut->pLeaves = (int *)(pCut + 1);
|
||||||
|
for ( i = 0; i < nLeaves; i++ )
|
||||||
|
pCut->pLeaves[i] = i;
|
||||||
|
pCut->pTruth = (unsigned *)pCut->pLeaves + pCut->nLimit + p->nPermWords;
|
||||||
|
If_CluCopy( (word *)If_CutTruth(pCut), (word *)pTruth, nVars );
|
||||||
|
if ( If_CutTruthMinimize( p, pCut ) >= 2 )
|
||||||
|
return 0;
|
||||||
|
nLeaves = pCut->nLeaves;
|
||||||
|
If_CluCopy( (word *)pTruth, (word *)If_CutTruth(pCut), nVars );
|
||||||
|
}
|
||||||
|
|
||||||
// quit if parameters are wrong
|
// quit if parameters are wrong
|
||||||
Length = strlen(pStr);
|
Length = strlen(pStr);
|
||||||
if ( Length != 2 && Length != 3 )
|
if ( Length != 2 && Length != 3 )
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,8 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
|
||||||
p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
|
p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
|
||||||
p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
|
p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
|
||||||
p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
|
p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
|
||||||
|
p->pCutTemp = (If_Cut_t *)ABC_ALLOC( char, p->nCutBytes );
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
@ -160,6 +162,7 @@ void If_ManStop( If_Man_t * p )
|
||||||
ABC_FREE( p->pMemCi );
|
ABC_FREE( p->pMemCi );
|
||||||
ABC_FREE( p->pMemAnd );
|
ABC_FREE( p->pMemAnd );
|
||||||
ABC_FREE( p->puTemp[0] );
|
ABC_FREE( p->puTemp[0] );
|
||||||
|
ABC_FREE( p->pCutTemp );
|
||||||
// free pars memory
|
// free pars memory
|
||||||
if ( p->pPars->pTimesArr )
|
if ( p->pPars->pTimesArr )
|
||||||
ABC_FREE( p->pPars->pTimesArr );
|
ABC_FREE( p->pPars->pTimesArr );
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ ABC_NAMESPACE_IMPL_START
|
||||||
/// DECLARATIONS ///
|
/// DECLARATIONS ///
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static int If_CutTruthMinimize( If_Man_t * p, If_Cut_t * pCut );
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
/// FUNCTION DEFINITIONS ///
|
/// FUNCTION DEFINITIONS ///
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue