summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/base/abci/abc.c58
-rw-r--r--src/map/if/if.h11
-rw-r--r--src/map/if/ifMap.c5
-rw-r--r--src/map/if/ifTime.c17
4 files changed, 80 insertions, 11 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 4de17f26..d99c9c0e 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -15409,7 +15409,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
If_ManSetDefaultPars( pPars );
pPars->pLutLib = (If_LibLut_t *)Abc_FrameReadLibLut();
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRNTDEWSqaflepmrsdbgxyojiktncvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRNTXYDEWSqaflepmrsdbgxyojiktncvh" ) ) != EOF )
{
switch ( c )
{
@@ -15503,6 +15503,28 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->nStructType < 0 || pPars->nStructType > 2 )
goto usage;
break;
+ case 'X':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer 0,1,or 2.\n" );
+ goto usage;
+ }
+ pPars->nAndDelay = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( pPars->nAndArea < 0 )
+ goto usage;
+ break;
+ case 'Y':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-Y\" should be followed by a positive integer 0,1,or 2.\n" );
+ goto usage;
+ }
+ pPars->nAndArea = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( pPars->nAndDelay < 0 )
+ goto usage;
+ break;
case 'D':
if ( globalUtilOptind >= argc )
{
@@ -15876,7 +15898,7 @@ usage:
sprintf(LutSize, "library" );
else
sprintf(LutSize, "%d", pPars->nLutSize );
- Abc_Print( -2, "usage: if [-KCFAGRNT num] [-DEW float] [-S str] [-qarlepmsdbgxyojiktncvh]\n" );
+ Abc_Print( -2, "usage: if [-KCFAGRNTXY num] [-DEW float] [-S str] [-qarlepmsdbgxyojiktncvh]\n" );
Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
@@ -15885,7 +15907,9 @@ usage:
Abc_Print( -2, "\t-G num : the max AND/OR gate size for mapping (0 = unused) [default = %d]\n", pPars->nGateSize );
Abc_Print( -2, "\t-R num : the delay relaxation ratio (num >= 0) [default = %d]\n", pPars->nRelaxRatio );
Abc_Print( -2, "\t-N num : the max size of non-decomposable nodes [default = unused]\n", pPars->nNonDecLimit );
- Abc_Print( -2, "\t-T num : the type of LUT structures [default = any]\n", pPars->nStructType );
+ Abc_Print( -2, "\t-T num : the type of LUT structures [default = any]\n" );
+ Abc_Print( -2, "\t-X num : delay of AND-gate in LUT library units [default = %d]\n", pPars->nAndDelay );
+ Abc_Print( -2, "\t-Y num : area of AND-gate in LUT library units [default = %d]\n", pPars->nAndArea );
Abc_Print( -2, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer );
Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon );
Abc_Print( -2, "\t-W float : sets wire delay between adjects LUTs [default = %f]\n", pPars->WireDelay );
@@ -31884,7 +31908,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
}
pPars->pLutLib = (If_LibLut_t *)pAbc->pLibLut;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTqalepmrsdbgxyofuijkztncvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTXYqalepmrsdbgxyofuijkztncvh" ) ) != EOF )
{
switch ( c )
{
@@ -31967,6 +31991,28 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->nStructType < 0 || pPars->nStructType > 2 )
goto usage;
break;
+ case 'X':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer 0,1,or 2.\n" );
+ goto usage;
+ }
+ pPars->nAndDelay = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( pPars->nAndArea < 0 )
+ goto usage;
+ break;
+ case 'Y':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-Y\" should be followed by a positive integer 0,1,or 2.\n" );
+ goto usage;
+ }
+ pPars->nAndArea = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( pPars->nAndDelay < 0 )
+ goto usage;
+ break;
case 'D':
if ( globalUtilOptind >= argc )
{
@@ -32353,7 +32399,7 @@ usage:
sprintf(LutSize, "library" );
else
sprintf(LutSize, "%d", pPars->nLutSize );
- Abc_Print( -2, "usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgxyofuijkztncvh]\n" );
+ Abc_Print( -2, "usage: &if [-KCFAGRTXY num] [-DEW float] [-S str] [-qarlepmsdbgxyofuijkztncvh]\n" );
Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
@@ -32362,6 +32408,8 @@ usage:
Abc_Print( -2, "\t-G num : the max AND/OR gate size for mapping (0 = unused) [default = %d]\n", pPars->nGateSize );
Abc_Print( -2, "\t-R num : the delay relaxation ratio (num >= 0) [default = %d]\n", pPars->nRelaxRatio );
Abc_Print( -2, "\t-T num : the type of LUT structures [default = any]\n", pPars->nStructType );
+ Abc_Print( -2, "\t-X num : delay of AND-gate in LUT library units [default = %d]\n", pPars->nAndDelay );
+ Abc_Print( -2, "\t-Y num : area of AND-gate in LUT library units [default = %d]\n", pPars->nAndArea );
Abc_Print( -2, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer );
Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon );
Abc_Print( -2, "\t-W float : sets wire delay between adjects LUTs [default = %f]\n", pPars->WireDelay );
diff --git a/src/map/if/if.h b/src/map/if/if.h
index 067ce0ad..8616783b 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -55,7 +55,7 @@ ABC_NAMESPACE_HEADER_START
// a very large number
#define IF_INFINITY 100000000
// the largest possible user cut cost
-#define IF_COST_MAX 8191 // ((1<<13)-1)
+#define IF_COST_MAX 4095 // ((1<<12)-1)
#define IF_BIG_CHAR ((char)120)
@@ -110,6 +110,8 @@ struct If_Par_t_
float Epsilon; // value used in comparison floating point numbers
int nRelaxRatio; // delay relaxation ratio
int nStructType; // type of the structure
+ int nAndDelay; // delay of AND-gate in LUT library units
+ int nAndArea; // area of AND-gate in LUT library units
int fPreprocess; // preprossing
int fArea; // area-oriented mapping
int fFancy; // a fancy feature
@@ -281,10 +283,11 @@ struct If_Cut_t_
int iCutFunc; // TT ID of the cut
int uMaskFunc; // polarity bitmask
unsigned uSign; // cut signature
- unsigned Cost : 13; // the user's cost of the cut (related to IF_COST_MAX)
+ unsigned Cost : 12; // the user's cost of the cut (related to IF_COST_MAX)
unsigned fCompl : 1; // the complemented attribute
unsigned fUser : 1; // using the user's area and delay
- unsigned fUseless: 1; // using the user's area and delay
+ unsigned fUseless: 1; // cannot be used in the mapping
+ unsigned fAndCut : 1; // matched with AND gate
unsigned nLimit : 8; // the maximum number of leaves
unsigned nLeaves : 8; // the number of leaves
int pLeaves[0];
@@ -425,7 +428,7 @@ static inline int If_CutDsdLit( If_Man_t * p, If_Cut_t * pCut ) { r
static inline int If_CutDsdIsCompl( If_Man_t * p, If_Cut_t * pCut ) { return Abc_LitIsCompl( If_CutDsdLit(p, pCut) ); }
static inline char * If_CutDsdPerm( If_Man_t * p, If_Cut_t * pCut ) { return Vec_StrEntryP( p->vTtPerms[pCut->nLeaves], Abc_Lit2Var(pCut->iCutFunc) * Abc_MaxInt(6, pCut->nLeaves) ); }
-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->fAndCut ? p->pPars->nAndArea : (pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0)); }
static inline float If_CutLutDelay( If_LibLut_t * p, int Size, int iPin ) { return p ? (p->fVarPinDelays ? p->pLutDelays[Size][iPin] : p->pLutDelays[Size][0]) : 1.0; }
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index 89e94804..4f0372a6 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -100,6 +100,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
int fFunc0R, fFunc1R;
int i, k, v, iCutDsd, fChange;
int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib || p->pPars->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->pLutStruct != NULL;
+ int fUseAndCut = (p->pPars->nAndDelay > 0) || (p->pPars->nAndArea > 0);
assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );
@@ -189,6 +190,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// check if this cut is contained in any of the available cuts
if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, fSave0 ) )
continue;
+ // check if the cut is a special AND-gate cut
+ pCut->fAndCut = fUseAndCut && pCut->nLeaves == 2 && pCut->pLeaves[0] == pObj->pFanin0->Id && pCut->pLeaves[1] == pObj->pFanin1->Id;
+ assert( pCut->nLeaves != 2 || pCut->pLeaves[0] < pCut->pLeaves[1] );
+ assert( pCut->nLeaves != 2 || pObj->pFanin0->Id < pObj->pFanin1->Id );
// compute the truth table
pCut->iCutFunc = -1;
pCut->fCompl = 0;
diff --git a/src/map/if/ifTime.c b/src/map/if/ifTime.c
index 4211b385..c2ba40e8 100644
--- a/src/map/if/ifTime.c
+++ b/src/map/if/ifTime.c
@@ -98,7 +98,15 @@ float If_CutDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut )
float * pLutDelays;
int i, Shift, Pin2PinDelay;//, iLeaf;
Delay = -IF_FLOAT_LARGE;
- if ( p->pPars->pLutLib )
+ if ( pCut->fAndCut )
+ {
+ If_CutForEachLeaf( p, pCut, pLeaf, i )
+ {
+ DelayCur = If_ObjCutBest(pLeaf)->Delay + p->pPars->nAndDelay;
+ Delay = IF_MAX( Delay, DelayCur );
+ }
+ }
+ else if ( p->pPars->pLutLib )
{
assert( !p->pPars->fLiftLeaves );
pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
@@ -177,7 +185,12 @@ void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut, fl
int i, Pin2PinDelay;//, iLeaf;
assert( !p->pPars->fLiftLeaves );
// compute the pins
- if ( p->pPars->pLutLib )
+ if ( pCut->fAndCut )
+ {
+ If_CutForEachLeaf( p, pCut, pLeaf, i )
+ pLeaf->Required = IF_MIN( pLeaf->Required, ObjRequired - p->pPars->nAndDelay );
+ }
+ else if ( p->pPars->pLutLib )
{
pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
if ( p->pPars->pLutLib->fVarPinDelays )