Commit 04be8af5 by Alan Mishchenko

Important bug fixes in standard-cell library handling and mapper &nf.

parent cb439f2e
......@@ -103,7 +103,7 @@ Hop_Obj_t * Amap_ParseFormulaOper( Hop_Man_t * pMan, Vec_Ptr_t * pStackFn, int O
SeeAlso []
***********************************************************************/
Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVarNames, Hop_Man_t * pMan )
Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVarNames, Hop_Man_t * pMan, char * pGateName )
{
char * pFormula;
Vec_Ptr_t * pStackFn;
......@@ -278,7 +278,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
}
if ( !fFound )
{
fprintf( pOutput, "Amap_ParseFormula(): The parser cannot find var \"%s\" in the input var list.\n", pTemp );
fprintf( pOutput, "Amap_ParseFormula(): The parser cannot find var \"%s\" in the input var list of gate \"%s\".\n", pTemp, pGateName );
Flag = AMAP_EQN_FLAG_ERROR;
break;
}
......@@ -428,7 +428,7 @@ int Amap_LibParseEquations( Amap_Lib_t * p, int fVerbose )
Vec_PtrClear( vNames );
Amap_GateForEachPin( pGate, pPin )
Vec_PtrPush( vNames, pPin->pName );
pObj = Amap_ParseFormula( stdout, pGate->pForm, vNames, pMan );
pObj = Amap_ParseFormula( stdout, pGate->pForm, vNames, pMan, pGate->pName );
if ( pObj == NULL )
break;
pTruth = Hop_ManConvertAigToTruth( pMan, pObj, pGate->nPins, vTruth, 0 );
......
......@@ -36,6 +36,7 @@ ABC_NAMESPACE_IMPL_START
// these symbols (and no other) can appear in the formulas
#define AMAP_SYMB_AND '*'
#define AMAP_SYMB_AND2 '&'
#define AMAP_SYMB_OR1 '+'
#define AMAP_SYMB_OR2 '|'
#define AMAP_SYMB_XOR '^'
......@@ -236,7 +237,7 @@ int Amap_GateCollectNames( Aig_MmFlex_t * pMem, char * pForm, char * pPinNames[]
for ( pTemp = Buffer; *pTemp; pTemp++ )
if ( *pTemp == AMAP_SYMB_AND || *pTemp == AMAP_SYMB_OR1 || *pTemp == AMAP_SYMB_OR2
|| *pTemp == AMAP_SYMB_XOR || *pTemp == AMAP_SYMB_NOT || *pTemp == AMAP_SYMB_OPEN
|| *pTemp == AMAP_SYMB_CLOSE || *pTemp == AMAP_SYMB_AFTNOT )
|| *pTemp == AMAP_SYMB_CLOSE || *pTemp == AMAP_SYMB_AFTNOT || *pTemp == AMAP_SYMB_AND2 )
*pTemp = ' ';
// save the names
nPins = 0;
......
......@@ -349,7 +349,7 @@ void Map_TimePropagateRequired( Map_Man_t * p )
if ( pNode->pCutBest[1] && pNode->tRequired[1].Worst < MAP_FLOAT_LARGE )
Map_TimePropagateRequiredPhase( p, pNode, 1 );
}
/*
// in the end, we verify the required times
// for this, we compute the arrival times of the outputs of each phase
// of the supergates using the fanins' required times as the fanins' arrival times
......@@ -377,6 +377,7 @@ void Map_TimePropagateRequired( Map_Man_t * p )
// assert( ptReqOutTest->Fall < pNode->tRequired[1].Fall + p->fEpsilon );
}
}
*/
}
void Map_TimeComputeRequiredGlobal( Map_Man_t * p )
{
......
......@@ -280,22 +280,40 @@ void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops )
***********************************************************************/
int Mio_DelayCompare( Mio_Gate_t ** ppG1, Mio_Gate_t ** ppG2 )
{
if ( (*ppG1)->dDelayMax < (*ppG2)->dDelayMax )
int Comp;
float Eps = (float)0.0094636;
if ( (*ppG1)->dDelayMax < (*ppG2)->dDelayMax - Eps )
return -1;
if ( (*ppG1)->dDelayMax > (*ppG2)->dDelayMax )
if ( (*ppG1)->dDelayMax > (*ppG2)->dDelayMax + Eps )
return 1;
// compare names
Comp = strcmp( (*ppG1)->pName, (*ppG2)->pName );
if ( Comp < 0 )
return -1;
if ( Comp > 0 )
return 1;
assert( 0 );
return 0;
}
int Mio_AreaCompare( Mio_Cell_t * pG1, Mio_Cell_t * pG2 )
{
if ( (pG1)->nFanins < (pG2)->nFanins )
int Comp;
float Eps = (float)0.0094636;
if ( pG1->nFanins < pG2->nFanins )
return -1;
if ( (pG1)->nFanins > (pG2)->nFanins )
if ( pG1->nFanins > pG2->nFanins )
return 1;
if ( (pG1)->Area < (pG2)->Area )
if ( pG1->Area < pG2->Area - Eps )
return -1;
if ( (pG1)->Area > (pG2)->Area )
if ( pG1->Area > pG2->Area + Eps )
return 1;
// compare names
Comp = strcmp( pG1->pName, pG2->pName );
if ( Comp < 0 )
return -1;
if ( Comp > 0 )
return 1;
assert( 0 );
return 0;
}
......@@ -333,7 +351,7 @@ static inline float Mio_GateDelayAve( Mio_Gate_t * pGate )
static inline int Mio_CompareTwoGates( Mio_Gate_t * pCell, Mio_Gate_t * pGate )
{
int Comp;
float Eps = (float)0.01;
float Eps = (float)0.0094636;
float CellDelay, GateDelay;
// compare areas
if ( pCell->dArea > (float)pGate->dArea + Eps )
......@@ -424,7 +442,7 @@ Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay,
static inline int Mio_CompareTwo( Mio_Cell_t * pCell, Mio_Gate_t * pGate )
{
int Comp;
float Eps = (float)0.01;
float Eps = (float)0.0094636;
float CellDelay, GateDelay;
// compare areas
if ( pCell->Area > (float)pGate->dArea + Eps )
......@@ -541,7 +559,7 @@ Mio_Cell_t * Mio_CollectRootsNew( Mio_Library_t * pLib, int nInputs, int * pnGat
if ( pCell->pName == NULL )
printf( "None\n" );
else
printf( "%-20s In = %d N = %3d A = %7.2f D = %7.2f\n",
printf( "%-20s In = %d N = %3d A = %12.6f D = %12.6f\n",
pCell->pName, pCell->nFanins, pCounts[i], pCell->Area, Mio_CellDelayAve(pCell) );
}
ABC_FREE( pCounts );
......
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