Enabling mapping into multi-input AND/OR gates.

This commit is contained in:
Alan Mishchenko
2012-03-27 20:15:02 -07:00
parent 08253a50eb
commit a21f2986aa
8 changed files with 274 additions and 23 deletions
+3
View File
@@ -95,6 +95,7 @@ struct If_Par_t_
int nCutsMax; // the max number of cuts
int nFlowIters; // the number of iterations of area recovery
int nAreaIters; // the number of iterations of area recovery
int nGateSize; // the max size of the AND/OR gate to map into
float DelayTarget; // delay target
float Epsilon; // value used in comparison floating point numbers
int fPreprocess; // preprossing
@@ -153,6 +154,7 @@ struct If_Lib_t_
// manager
struct If_Man_t_
{
char * pName;
// mapping parameters
If_Par_t * pPars;
// mapping nodes
@@ -487,6 +489,7 @@ extern int If_ManPerformMappingSeq( If_Man_t * p );
/*=== ifTime.c ============================================================*/
extern int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut );
extern int If_CutDelaySopCost2( If_Man_t * p, If_Cut_t * pCut );
extern int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut );
extern Vec_Wrd_t * If_CutDelaySopArray( If_Man_t * p, If_Cut_t * pCut );
extern float If_CutDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut );
extern void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut, float Required );
+21 -4
View File
@@ -139,12 +139,29 @@ int If_ManPerformMappingComb( If_Man_t * p )
// Abc_Print( 1, "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) );
s_MappingTime = clock() - clkTotal;
// Abc_Print( 1, "Special POs = %d.\n", If_ManCountSpecialPos(p) );
/*
{
extern int If_CutGetCones( If_Man_t * p );
extern int If_CutCountTotalFanins( If_Man_t * p );
// If_CutGetCones( p );
// If_CutCountTotalFanins( p );
static char * pLastName = NULL;
FILE * pTable = fopen( "fpga/ucsb/stats.txt", "a+" );
if ( pLastName == NULL || strcmp(pLastName, p->pName) )
{
fprintf( pTable, "\n" );
fprintf( pTable, "%s ", p->pName );
fprintf( pTable, "%d ", If_ManCiNum(p) );
fprintf( pTable, "%d ", If_ManCoNum(p) );
fprintf( pTable, "%d ", If_ManAndNum(p) );
ABC_FREE( pLastName );
pLastName = Abc_UtilStrsav( p->pName );
}
fprintf( pTable, "%d ", (int)p->AreaGlo );
fprintf( pTable, "%d ", (int)p->RequiredGlo );
fclose( pTable );
}
*/
return 1;
}
+1
View File
@@ -178,6 +178,7 @@ void If_ManStop( If_Man_t * p )
ABC_FREE( p->pHashTable[1] );
if ( p->pMemEntries )
Mem_FixedStop( p->pMemEntries, 0 );
ABC_FREE( p->pName );
ABC_FREE( p );
}
+4 -10
View File
@@ -155,15 +155,12 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// 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->fUserRecLib )
pCut->Delay = If_CutDelayRecCost(p, pCut, pObj);
else if(p->pPars->fDelayOpt)
{
// pCut->Delay = If_CutDelaySopCost(p,pCut);
// pCut->Delay = If_CutDelaySopCost2(p,pCut);
pCut->Delay = If_CutDelaySopCost(p,pCut);
}
else if(p->pPars->nGateSize > 0)
pCut->Delay = If_CutDelaySop(p,pCut);
else
pCut->Delay = If_CutDelay( p, pObj, pCut );
// assert( pCut->Delay <= pObj->Required + p->fEpsilon );
@@ -230,15 +227,12 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// 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->fUserRecLib )
pCut->Delay = If_CutDelayRecCost(p, pCut, pObj);
else if (p->pPars->fDelayOpt)
{
// pCut->Delay = If_CutDelaySopCost(p, pCut);
// pCut->Delay = If_CutDelaySopCost2(p, pCut);
pCut->Delay = If_CutDelaySopCost(p, pCut);
}
else if(p->pPars->nGateSize > 0)
pCut->Delay = If_CutDelaySop(p,pCut);
else
pCut->Delay = If_CutDelay( p, pObj, pCut );
//if ( pCut->Cost == IF_COST_MAX )
+69
View File
@@ -545,6 +545,75 @@ int If_CutDelaySopCost2( If_Man_t * p, If_Cut_t * pCut )
/**Function*************************************************************
Synopsis [Computes the SOP delay using balanced AND decomposition.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline int If_CutMaxCubeSize( Vec_Int_t * vCover, int nVars )
{
int i, k, Entry, Literal, Count, CountMax = 0;
Vec_IntForEachEntry( vCover, Entry, i )
{
Count = 0;
for ( k = 0; k < nVars; k++ )
{
Literal = (3 & (Entry >> (k << 1)));
if ( Literal == 1 || Literal == 2 )
Count++;
}
CountMax = Abc_MaxInt( CountMax, Count );
}
return CountMax;
}
int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut )
{
// delay is calculated using 1+log2(NumFanins)
static double GateDelays[20] = { 1.00, 1.00, 2.00, 2.58, 3.00, 3.32, 3.58, 3.81, 4.00, 4.17, 4.32, 4.46, 4.58, 4.70, 4.81, 4.91, 5.00, 5.09, 5.17, 5.25 };
If_Obj_t * pLeaf;
int Delay, DelayMax;
int i, nLitMax, RetValue;
// mark cut as a user cut
pCut->fUser = 1;
if ( p->vCover == NULL )
p->vCover = Vec_IntAlloc(0);
RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), p->vCover, 1 );
if ( RetValue == -1 )
return ABC_INFINITY;
assert( RetValue == 0 || RetValue == 1 );
// mark the output as complemented
// vAnds = If_CutDelaySopAnds( p, pCut, p->vCover, RetValue ^ pCut->fCompl );
if ( Vec_IntSize(p->vCover) > p->pPars->nGateSize )
return ABC_INFINITY;
// set the area cost
assert( If_CutLeaveNum(pCut) >= 0 && If_CutLeaveNum(pCut) <= 16 );
// compute the gate delay
nLitMax = If_CutMaxCubeSize( p->vCover, If_CutLeaveNum(pCut) );
if ( Vec_IntSize(p->vCover) < 2 )
{
pCut->Cost = Vec_IntSize(p->vCover);
Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + 0.5);
DelayMax = 0;
If_CutForEachLeaf( p, pCut, pLeaf, i )
DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pCut->pPerm[i] = (char)Delay) );
}
else
{
pCut->Cost = Vec_IntSize(p->vCover) + 1;
Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + GateDelays[nLitMax] + 0.5);
DelayMax = 0;
If_CutForEachLeaf( p, pCut, pLeaf, i )
DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pCut->pPerm[i] = (char)Delay) );
}
return DelayMax;
}
/**Function*************************************************************
Synopsis [Computes delay.]