mirror of https://github.com/YosysHQ/abc.git
Integrating sweeping information.
This commit is contained in:
parent
8281b56e9e
commit
7802db98af
|
|
@ -160,7 +160,11 @@ struct Gia_Man_t_
|
|||
void * pLutLib; // LUT library
|
||||
word nHashHit; // hash table hit
|
||||
word nHashMiss; // hash table miss
|
||||
unsigned * pData2; // storage for object values
|
||||
unsigned * pData; // various user data
|
||||
unsigned * pData2; // various user data
|
||||
int iData; // various user data
|
||||
int iData2; // various user data
|
||||
int nAnd2Delay; // AND2 delay scaled to match delay numbers used
|
||||
int fVerbose; // verbose reports
|
||||
// truth table computation for small functions
|
||||
int nTtVars; // truth table variables
|
||||
|
|
|
|||
|
|
@ -550,7 +550,6 @@ void Gia_ManReprFromAigRepr2( Aig_Man_t * pAig, Gia_Man_t * pGia )
|
|||
***********************************************************************/
|
||||
Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose )
|
||||
{
|
||||
// extern Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose );
|
||||
Gia_Man_t * pGia;
|
||||
Aig_Man_t * pNew, * pTemp;
|
||||
if ( p->pManTime && p->vLevels == NULL )
|
||||
|
|
@ -560,9 +559,9 @@ Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose )
|
|||
Aig_ManStop( pTemp );
|
||||
pGia = Gia_ManFromAig( pNew );
|
||||
Aig_ManStop( pNew );
|
||||
pGia->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
// Gia_ManLevelWithBoxes( pGia );
|
||||
pGia->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pGia->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
|
||||
return pGia;
|
||||
}
|
||||
|
||||
|
|
@ -581,13 +580,16 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars )
|
|||
{
|
||||
Gia_Man_t * pGia;
|
||||
Aig_Man_t * pNew;
|
||||
if ( p->pManTime && p->vLevels == NULL )
|
||||
Gia_ManLevelWithBoxes( p );
|
||||
pNew = Gia_ManToAig( p, 0 );
|
||||
pNew = Dar_ManChoiceNew( pNew, (Dch_Pars_t *)pPars );
|
||||
// pGia = Gia_ManFromAig( pNew );
|
||||
pGia = Gia_ManFromAigChoices( pNew );
|
||||
Aig_ManStop( pNew );
|
||||
pGia->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pGia->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pGia->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
|
||||
return pGia;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -521,6 +521,13 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
|
|||
if ( fVerbose ) printf( "Finished reading extension \"c\".\n" );
|
||||
}
|
||||
// read delay information
|
||||
else if ( *pCur == 'd' )
|
||||
{
|
||||
pCur++;
|
||||
assert( Gia_AigerReadInt(pCur) == 4 ); pCur += 4;
|
||||
pNew->nAnd2Delay = Gia_AigerReadInt(pCur); pCur += 4;
|
||||
if ( fVerbose ) printf( "Finished reading extension \"d\".\n" );
|
||||
}
|
||||
else if ( *pCur == 'i' )
|
||||
{
|
||||
pCur++;
|
||||
|
|
@ -739,6 +746,8 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
|
|||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
// pNew->nAnd2Delay = 5;
|
||||
return pNew;
|
||||
}
|
||||
|
||||
|
|
@ -1092,7 +1101,13 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
|
|||
Gia_FileWriteBufferSize( pFile, p->nConstrs );
|
||||
}
|
||||
*/
|
||||
// write gate classes
|
||||
// write timing information
|
||||
if ( p->nAnd2Delay )
|
||||
{
|
||||
fprintf( pFile, "d" );
|
||||
Gia_FileWriteBufferSize( pFile, 4 );
|
||||
Gia_FileWriteBufferSize( pFile, p->nAnd2Delay );
|
||||
}
|
||||
if ( p->pManTime )
|
||||
{
|
||||
Vec_Flt_t * vArrTimes, * vReqTimes;
|
||||
|
|
|
|||
|
|
@ -1148,8 +1148,9 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
|
|||
pNew = Gia_ManDupUnnormalize( p );
|
||||
if ( pNew == NULL )
|
||||
return NULL;
|
||||
pNew->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pNew->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
|
||||
p = pNew;
|
||||
}
|
||||
else
|
||||
|
|
@ -1187,15 +1188,17 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
|
|||
// if ( pIfMan->pPars->fDelayOpt )
|
||||
// Vec_IntFreeP( &pNew->vMapping );
|
||||
// return the original (unmodified by the mapper) timing manager
|
||||
pNew->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pNew->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
|
||||
Gia_ManStop( p );
|
||||
// normalize and transfer mapping
|
||||
pNew = Gia_ManDupNormalize( p = pNew );
|
||||
Gia_ManTransferMapping( p, pNew );
|
||||
Gia_ManTransferPacking( p, pNew );
|
||||
pNew->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pNew->pManTime = p->pManTime; p->pManTime = NULL;
|
||||
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
|
||||
pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
|
||||
// pNew->vPacking = p->vPacking; p->vPacking = NULL;
|
||||
Gia_ManStop( p );
|
||||
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fTents, int fSwitch, int fCut )
|
|||
if ( p->pPlacement )
|
||||
Gia_ManPrintPlacement( p );
|
||||
if ( p->pManTime )
|
||||
Tim_ManPrintStats( p->pManTime );
|
||||
Tim_ManPrintStats( p->pManTime, p->nAnd2Delay );
|
||||
// print register classes
|
||||
Gia_ManPrintFlopClasses( p );
|
||||
Gia_ManPrintGateClasses( p );
|
||||
|
|
|
|||
|
|
@ -317,12 +317,13 @@ Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars )
|
|||
// derive new AIG
|
||||
assert( pNew->pManTime == NULL );
|
||||
assert( pNew->pAigExtra == NULL );
|
||||
pNew->pManTime = p->pManTime;
|
||||
pNew->pAigExtra = p->pAigExtra;
|
||||
pNew->pManTime = p->pManTime;
|
||||
pNew->pAigExtra = p->pAigExtra;
|
||||
pNew->nAnd2Delay = p->nAnd2Delay;
|
||||
pNew = Gia_ManFraigCreateGia( pTemp = pNew );
|
||||
assert( pTemp->pManTime == p->pManTime );
|
||||
assert( pTemp->pAigExtra == p->pAigExtra );
|
||||
pTemp->pManTime = NULL;
|
||||
pTemp->pManTime = NULL;
|
||||
pTemp->pAigExtra = NULL;
|
||||
Gia_ManStop( pTemp );
|
||||
// return the result
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ int Gia_ManOrderWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNod
|
|||
Gia_ObjSetTravIdCurrent(p, pObj);
|
||||
if ( Gia_ObjIsCi(pObj) )
|
||||
{
|
||||
p->pData2 = (void *)(ABC_PTRUINT_T)Gia_ObjCioId(pObj);
|
||||
p->iData2 = Gia_ObjCioId(pObj);
|
||||
return 1;
|
||||
}
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
|
|
@ -132,7 +132,7 @@ Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p )
|
|||
pObj = Gia_ManPo( p, curCo + k );
|
||||
if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
|
||||
{
|
||||
int iCiNum = (int)(ABC_PTRUINT_T)p->pData2;
|
||||
int iCiNum = p->iData2;
|
||||
int iBoxNum = Tim_ManBoxFindFromCiNum( p->pManTime, iCiNum );
|
||||
printf( "Boxes are not in a topological order. The command has to terminate.\n" );
|
||||
printf( "The following information may help debugging (numbers are 0-based):\n" );
|
||||
|
|
@ -143,7 +143,7 @@ Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p )
|
|||
Tim_ManBoxOutputFirst(p->pManTime, iBoxNum), Tim_ManBoxInputFirst(p->pManTime, iBoxNum) );
|
||||
printf( "In a correct topological order, BoxB should preceed BoxA.\n" );
|
||||
Vec_IntFree( vNodes );
|
||||
p->pData2 = NULL;
|
||||
p->iData2 = 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -395,9 +395,10 @@ int Gia_ManLevelWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
|
|||
}
|
||||
int Gia_ManLevelWithBoxes( Gia_Man_t * p )
|
||||
{
|
||||
int nAnd2Delay = p->nAnd2Delay ? p->nAnd2Delay : 1;
|
||||
Tim_Man_t * pTime = (Tim_Man_t *)p->pManTime;
|
||||
Gia_Obj_t * pObj;
|
||||
int i, k, curCi, curCo, LevelMax;
|
||||
Gia_Obj_t * pObj, * pObjIn;
|
||||
int i, k, j, curCi, curCo, LevelMax;
|
||||
assert( Gia_ManRegNum(p) == 0 );
|
||||
// copy const and real PIs
|
||||
Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
|
||||
|
|
@ -407,8 +408,7 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p )
|
|||
for ( i = 0; i < Tim_ManPiNum(pTime); i++ )
|
||||
{
|
||||
pObj = Gia_ManPi( p, i );
|
||||
// Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pTime, i) );
|
||||
Gia_ObjSetLevel( p, pObj, 0 );
|
||||
Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pTime, i) / nAnd2Delay );
|
||||
Gia_ObjSetTravIdCurrent( p, pObj );
|
||||
}
|
||||
// create logic for each box
|
||||
|
|
@ -416,8 +416,11 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p )
|
|||
curCo = 0;
|
||||
for ( i = 0; i < Tim_ManBoxNum(pTime); i++ )
|
||||
{
|
||||
LevelMax = 0;
|
||||
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ )
|
||||
int nBoxInputs = Tim_ManBoxInputNum( pTime, i );
|
||||
int nBoxOutputs = Tim_ManBoxOutputNum( pTime, i );
|
||||
float * pDelayTable = Tim_ManBoxDelayTable( pTime, i );
|
||||
// compute level for TFI of box inputs
|
||||
for ( k = 0; k < nBoxInputs; k++ )
|
||||
{
|
||||
pObj = Gia_ManPo( p, curCo + k );
|
||||
if ( Gia_ManLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) ) )
|
||||
|
|
@ -425,18 +428,25 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p )
|
|||
printf( "Boxes are not in a topological order. Switching to level computation without boxes.\n" );
|
||||
return Gia_ManLevelNum( p );
|
||||
}
|
||||
// set box input level
|
||||
Gia_ObjSetCoLevel( p, pObj );
|
||||
LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObj) );
|
||||
}
|
||||
curCo += Tim_ManBoxInputNum(pTime, i);
|
||||
LevelMax++;
|
||||
for ( k = 0; k < Tim_ManBoxOutputNum(pTime, i); k++ )
|
||||
// compute level for box outputs
|
||||
for ( k = 0; k < nBoxOutputs; k++ )
|
||||
{
|
||||
pObj = Gia_ManPi( p, curCi + k );
|
||||
Gia_ObjSetLevel( p, pObj, LevelMax );
|
||||
Gia_ObjSetTravIdCurrent( p, pObj );
|
||||
// evaluate delay of this output
|
||||
LevelMax = 0;
|
||||
assert( nBoxInputs == (int)pDelayTable[1] );
|
||||
for ( j = 0; j < nBoxInputs && (pObjIn = Gia_ManPo(p, curCo + j)); j++ )
|
||||
if ( (int)pDelayTable[3+k*nBoxInputs+j] != -ABC_INFINITY )
|
||||
LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObjIn) + ((int)pDelayTable[3+k*nBoxInputs+j] / nAnd2Delay) );
|
||||
// set box output level
|
||||
Gia_ObjSetLevel( p, pObj, LevelMax );
|
||||
}
|
||||
curCi += Tim_ManBoxOutputNum(pTime, i);
|
||||
curCo += nBoxInputs;
|
||||
curCi += nBoxOutputs;
|
||||
}
|
||||
// add remaining nodes
|
||||
p->nLevels = 0;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ extern int Tim_ManGetArrsReqs( Tim_Man_t * p, Vec_Flt_t ** pvInArrs,
|
|||
extern void Tim_ManStop( Tim_Man_t * p );
|
||||
extern void Tim_ManStopP( Tim_Man_t ** p );
|
||||
extern void Tim_ManPrint( Tim_Man_t * p );
|
||||
extern void Tim_ManPrintStats( Tim_Man_t * p );
|
||||
extern void Tim_ManPrintStats( Tim_Man_t * p, int nAnd2Delay );
|
||||
extern int Tim_ManCiNum( Tim_Man_t * p );
|
||||
extern int Tim_ManCoNum( Tim_Man_t * p );
|
||||
extern int Tim_ManPiNum( Tim_Man_t * p );
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ void Tim_ManPrint( Tim_Man_t * p )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Tim_ManPrintStats( Tim_Man_t * p )
|
||||
void Tim_ManPrintStats( Tim_Man_t * p, int nAnd2Delay )
|
||||
{
|
||||
Tim_Box_t * pBox;
|
||||
Vec_Int_t * vCounts;
|
||||
|
|
@ -497,10 +497,12 @@ void Tim_ManPrintStats( Tim_Man_t * p )
|
|||
if ( p == NULL )
|
||||
return;
|
||||
Abc_Print( 1, "Hierarchy : " );
|
||||
printf( "PI/CI = %d/%d PO/CO = %d/%d Box = %d",
|
||||
printf( "PI/CI = %d/%d PO/CO = %d/%d Box = %d ",
|
||||
Tim_ManPiNum(p), Tim_ManCiNum(p),
|
||||
Tim_ManPoNum(p), Tim_ManCoNum(p),
|
||||
Tim_ManBoxNum(p) );
|
||||
if ( nAnd2Delay )
|
||||
printf( "delay(AND2) = %d", nAnd2Delay );
|
||||
printf( "\n" );
|
||||
if ( Tim_ManBoxNum(p) == 0 )
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue