mirror of https://github.com/YosysHQ/abc.git
Changes to the matching procedure.
This commit is contained in:
parent
ff4c674dd7
commit
e6e6a3cf9e
|
|
@ -903,8 +903,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
|||
}
|
||||
*/
|
||||
{
|
||||
// extern void If_CluTest();
|
||||
// If_CluTest();
|
||||
extern void If_CluTest();
|
||||
If_CluTest();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -13252,7 +13252,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pPars->fCutMin = 1;
|
||||
}
|
||||
|
||||
if ( pPars->fEnableCheck07 + pPars->fEnableCheck08 + pPars->fEnableCheck10 > 1 )
|
||||
if ( pPars->fEnableCheck07 + pPars->fEnableCheck08 + pPars->fEnableCheck10 + (pPars->pLutStruct != NULL) > 1 )
|
||||
{
|
||||
Abc_Print( -1, "Only one additional check can be performed at the same time.\n" );
|
||||
return 1;
|
||||
|
|
@ -13287,6 +13287,16 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pPars->pFuncCell = If_CutPerformCheck10;
|
||||
pPars->fCutMin = 1;
|
||||
}
|
||||
if ( pPars->pLutStruct )
|
||||
{
|
||||
if ( pPars->nLutSize < 6 || pPars->nLutSize > 11 )
|
||||
{
|
||||
Abc_Print( -1, "This feature only works for {6,7,8,9,10,11}-LUTs.\n" );
|
||||
return 1;
|
||||
}
|
||||
pPars->pFuncCell = If_CutPerformCheck16;
|
||||
pPars->fCutMin = 1;
|
||||
}
|
||||
|
||||
// enable truth table computation if cut minimization is selected
|
||||
if ( pPars->fCutMin )
|
||||
|
|
@ -13303,7 +13313,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pPars->fUsePerm = 1;
|
||||
pPars->pLutLib = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
// modify for LUT structures
|
||||
if ( pPars->pLutStruct )
|
||||
{
|
||||
|
|
@ -13317,7 +13327,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pPars->fUsePerm = 1;
|
||||
pPars->pLutLib = NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
// complain if truth tables are requested but the cut size is too large
|
||||
if ( pPars->fTruth && pPars->nLutSize > IF_MAX_FUNC_LUTSIZE )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ struct If_Par_t_
|
|||
float * pTimesReq; // required times
|
||||
int (* pFuncCost) (If_Cut_t *); // procedure to compute the user's cost of a cut
|
||||
int (* pFuncUser) (If_Man_t *, If_Obj_t *, If_Cut_t *); // procedure called for each cut when cut computation is finished
|
||||
int (* pFuncCell) (unsigned *, int, int); // procedure called for cut functions
|
||||
int (* pFuncCell) (unsigned *, int, int, char *); // procedure called for cut functions
|
||||
void * pReoMan; // reordering manager
|
||||
};
|
||||
|
||||
|
|
@ -184,7 +184,10 @@ struct If_Man_t_
|
|||
If_Set_t * pFreeList; // the list of free cutsets
|
||||
int nSmallSupp; // the small support
|
||||
int nCutsTotal;
|
||||
int nCutsUseless;
|
||||
int nCutsUseless[32];
|
||||
int nCutsCount[32];
|
||||
int nCutsCountAll;
|
||||
int nCutsUselessAll;
|
||||
// timing manager
|
||||
Tim_Man_t * pManTim;
|
||||
Vec_Int_t * vCoAttrs; // CO attributes 0=optimize; 1=keep; 2=relax
|
||||
|
|
@ -413,9 +416,10 @@ extern float If_CutPowerRef( If_Man_t * p, If_Cut_t * pCut, If_Obj_t *
|
|||
extern float If_CutPowerDerefed( If_Man_t * p, If_Cut_t * pCut, If_Obj_t * pRoot );
|
||||
extern float If_CutPowerRefed( If_Man_t * p, If_Cut_t * pCut, If_Obj_t * pRoot );
|
||||
/*=== ifDec.c =============================================================*/
|
||||
extern int If_CutPerformCheck07( unsigned * pTruth, int nVars, int nLeaves );
|
||||
extern int If_CutPerformCheck08( unsigned * pTruth, int nVars, int nLeaves );
|
||||
extern int If_CutPerformCheck10( unsigned * pTruth, int nVars, int nLeaves );
|
||||
extern int If_CutPerformCheck07( unsigned * pTruth, int nVars, int nLeaves, char * pStr );
|
||||
extern int If_CutPerformCheck08( unsigned * pTruth, int nVars, int nLeaves, char * pStr );
|
||||
extern int If_CutPerformCheck10( unsigned * pTruth, int nVars, int nLeaves, char * pStr );
|
||||
extern int If_CutPerformCheck16( unsigned * pTruth, int nVars, int nLeaves, char * pStr );
|
||||
extern float If_CutDelayLutStruct( If_Man_t * p, If_Cut_t * pCut, char * pStr, float WireDelay );
|
||||
/*=== ifLib.c =============================================================*/
|
||||
extern If_Lib_t * If_LutLibRead( char * FileName );
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
|
|||
return;
|
||||
}
|
||||
|
||||
if ( (p->pPars->fUseBat || p->pPars->fEnableCheck07 || p->pPars->fEnableCheck08 || p->pPars->fEnableCheck10) && !pCut->fUseless )
|
||||
if ( (p->pPars->fUseBat || p->pPars->fEnableCheck07 || p->pPars->fEnableCheck08 || p->pPars->fEnableCheck10 || p->pPars->pLutStruct) && !pCut->fUseless )
|
||||
{
|
||||
If_Cut_t * pFirst = pCutSet->ppCuts[0];
|
||||
if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 )
|
||||
|
|
|
|||
|
|
@ -673,9 +673,9 @@ int If_Dec7PickBestMux( word t[2], word c0r[2], word c1r[2] )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int If_CutPerformCheck07( unsigned * pTruth, int nVars, int nLeaves )
|
||||
int If_CutPerformCheck07( unsigned * pTruth, int nVars, int nLeaves, char * pStr )
|
||||
{
|
||||
int fDerive = 1;
|
||||
int fDerive = 0;
|
||||
if ( nLeaves < 6 )
|
||||
return 1;
|
||||
if ( nLeaves == 6 )
|
||||
|
|
@ -685,7 +685,10 @@ int If_CutPerformCheck07( unsigned * pTruth, int nVars, int nLeaves )
|
|||
return 1;
|
||||
z = If_Dec6Perform( t, fDerive );
|
||||
if ( fDerive && z )
|
||||
{
|
||||
// If_DecPrintConfig( z );
|
||||
If_Dec6Verify( t, z );
|
||||
}
|
||||
return z != 0;
|
||||
}
|
||||
if ( nLeaves == 7 )
|
||||
|
|
@ -698,8 +701,6 @@ int If_CutPerformCheck07( unsigned * pTruth, int nVars, int nLeaves )
|
|||
z = If_Dec7Perform( t, fDerive );
|
||||
if ( fDerive && z )
|
||||
If_Dec7Verify( t, z );
|
||||
|
||||
|
||||
return z != 0;
|
||||
}
|
||||
assert( 0 );
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ printf( "\n" );
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int If_CutPerformCheck08( unsigned * pTruth, int nVars, int nLeaves )
|
||||
int If_CutPerformCheck08( unsigned * pTruth, int nVars, int nLeaves, char * pStr )
|
||||
{
|
||||
int nSupp, fDerive = 0;
|
||||
word z[2] = {0}, pF[16];
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ printf( "\n" );
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int If_CutPerformCheck10( unsigned * pTruth, int nVars, int nLeaves )
|
||||
int If_CutPerformCheck10( unsigned * pTruth, int nVars, int nLeaves, char * pStr )
|
||||
{
|
||||
int nSupp, fDerive = 0;
|
||||
word z[2] = {0}, pF[16];
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -127,8 +127,15 @@ void If_ManRestart( If_Man_t * p )
|
|||
***********************************************************************/
|
||||
void If_ManStop( If_Man_t * p )
|
||||
{
|
||||
if ( p->nCutsUseless && p->pPars->fVerbose )
|
||||
Abc_Print( 1, "Useless cuts = %7d (out of %7d) (%6.2f %%)\n", p->nCutsUseless, p->nCutsTotal, 100.0*p->nCutsUseless/(p->nCutsTotal+1) );
|
||||
// if ( p->nCutsUselessAll && p->pPars->fVerbose )
|
||||
if ( p->nCutsUselessAll )
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i <= 16; i++ )
|
||||
if ( p->nCutsUseless[i] )
|
||||
Abc_Print( 1, "Useless cuts %2d = %7d (out of %7d) (%6.2f %%)\n", i, p->nCutsUseless[i], p->nCutsCount[i], 100.0*p->nCutsUseless[i]/(p->nCutsCount[i]+1) );
|
||||
Abc_Print( 1, "Useless cuts all = %7d (out of %7d) (%6.2f %%)\n", p->nCutsUselessAll, p->nCutsCountAll, 100.0*p->nCutsUselessAll/(p->nCutsCountAll+1) );
|
||||
}
|
||||
// Abc_PrintTime( 1, "Truth", p->timeTruth );
|
||||
// Abc_Print( 1, "Small support = %d.\n", p->nSmallSupp );
|
||||
Vec_IntFreeP( &p->vCoAttrs );
|
||||
|
|
|
|||
|
|
@ -153,9 +153,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
|
|||
if ( pCut->nLeaves > 0 )
|
||||
{
|
||||
// recompute the parameters of the best cut
|
||||
if ( p->pPars->pLutStruct )
|
||||
pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
|
||||
else if ( p->pPars->fDelayOpt )
|
||||
/// if ( p->pPars->pLutStruct )
|
||||
/// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
|
||||
// else if ( p->pPars->fDelayOpt )
|
||||
if ( p->pPars->fDelayOpt )
|
||||
pCut->Delay = If_CutDelaySopCost( p, pCut );
|
||||
else
|
||||
pCut->Delay = If_CutDelay( p, pObj, pCut );
|
||||
|
|
@ -205,9 +206,12 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
|
|||
pCut->fUseless = 0;
|
||||
if ( p->pPars->pFuncCell && RetValue < 2 )
|
||||
{
|
||||
assert( pCut->nLimit >= 4 && pCut->nLimit <= 10 );
|
||||
pCut->fUseless = !p->pPars->pFuncCell( If_CutTruth(pCut), pCut->nLimit, pCut->nLeaves );
|
||||
p->nCutsUseless += pCut->fUseless;
|
||||
assert( pCut->nLimit >= 4 && pCut->nLimit <= 16 );
|
||||
pCut->fUseless = !p->pPars->pFuncCell( If_CutTruth(pCut), pCut->nLimit, pCut->nLeaves, p->pPars->pLutStruct );
|
||||
p->nCutsUselessAll += pCut->fUseless;
|
||||
p->nCutsUseless[pCut->nLeaves] += pCut->fUseless;
|
||||
p->nCutsCountAll++;
|
||||
p->nCutsCount[pCut->nLeaves]++;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -217,9 +221,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
|
|||
if ( pCut->Cost == IF_COST_MAX )
|
||||
continue;
|
||||
// check if the cut satisfies the required times
|
||||
if ( p->pPars->pLutStruct )
|
||||
pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
|
||||
else if ( p->pPars->fDelayOpt )
|
||||
/// if ( p->pPars->pLutStruct )
|
||||
/// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
|
||||
// else if ( p->pPars->fDelayOpt )
|
||||
if ( p->pPars->fDelayOpt )
|
||||
pCut->Delay = If_CutDelaySopCost( p, pCut );
|
||||
else
|
||||
pCut->Delay = If_CutDelay( p, pObj, pCut );
|
||||
|
|
|
|||
Loading…
Reference in New Issue