Commit 7802db98 by Alan Mishchenko

Integrating sweeping information.

parent 8281b56e
...@@ -160,7 +160,11 @@ struct Gia_Man_t_ ...@@ -160,7 +160,11 @@ struct Gia_Man_t_
void * pLutLib; // LUT library void * pLutLib; // LUT library
word nHashHit; // hash table hit word nHashHit; // hash table hit
word nHashMiss; // hash table miss 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 int fVerbose; // verbose reports
// truth table computation for small functions // truth table computation for small functions
int nTtVars; // truth table variables int nTtVars; // truth table variables
......
...@@ -550,7 +550,6 @@ void Gia_ManReprFromAigRepr2( Aig_Man_t * pAig, Gia_Man_t * pGia ) ...@@ -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 ) 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; Gia_Man_t * pGia;
Aig_Man_t * pNew, * pTemp; Aig_Man_t * pNew, * pTemp;
if ( p->pManTime && p->vLevels == NULL ) if ( p->pManTime && p->vLevels == NULL )
...@@ -562,7 +561,7 @@ Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose ) ...@@ -562,7 +561,7 @@ Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose )
Aig_ManStop( pNew ); Aig_ManStop( pNew );
pGia->pManTime = p->pManTime; p->pManTime = NULL; pGia->pManTime = p->pManTime; p->pManTime = NULL;
pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
// Gia_ManLevelWithBoxes( pGia ); pGia->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
return pGia; return pGia;
} }
...@@ -581,6 +580,8 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars ) ...@@ -581,6 +580,8 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars )
{ {
Gia_Man_t * pGia; Gia_Man_t * pGia;
Aig_Man_t * pNew; Aig_Man_t * pNew;
if ( p->pManTime && p->vLevels == NULL )
Gia_ManLevelWithBoxes( p );
pNew = Gia_ManToAig( p, 0 ); pNew = Gia_ManToAig( p, 0 );
pNew = Dar_ManChoiceNew( pNew, (Dch_Pars_t *)pPars ); pNew = Dar_ManChoiceNew( pNew, (Dch_Pars_t *)pPars );
// pGia = Gia_ManFromAig( pNew ); // pGia = Gia_ManFromAig( pNew );
...@@ -588,6 +589,7 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars ) ...@@ -588,6 +589,7 @@ Gia_Man_t * Gia_ManPerformDch( Gia_Man_t * p, void * pPars )
Aig_ManStop( pNew ); Aig_ManStop( pNew );
pGia->pManTime = p->pManTime; p->pManTime = NULL; pGia->pManTime = p->pManTime; p->pManTime = NULL;
pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; pGia->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
pGia->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
return pGia; return pGia;
} }
......
...@@ -521,6 +521,13 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -521,6 +521,13 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
if ( fVerbose ) printf( "Finished reading extension \"c\".\n" ); if ( fVerbose ) printf( "Finished reading extension \"c\".\n" );
} }
// read delay information // 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' ) else if ( *pCur == 'i' )
{ {
pCur++; pCur++;
...@@ -739,6 +746,8 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -739,6 +746,8 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
return NULL; return NULL;
} }
*/ */
// pNew->nAnd2Delay = 5;
return pNew; return pNew;
} }
...@@ -1092,7 +1101,13 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int ...@@ -1092,7 +1101,13 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
Gia_FileWriteBufferSize( pFile, p->nConstrs ); 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 ) if ( p->pManTime )
{ {
Vec_Flt_t * vArrTimes, * vReqTimes; Vec_Flt_t * vArrTimes, * vReqTimes;
......
...@@ -1150,6 +1150,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -1150,6 +1150,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
return NULL; return NULL;
pNew->pManTime = p->pManTime; p->pManTime = NULL; pNew->pManTime = p->pManTime; p->pManTime = NULL;
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
p = pNew; p = pNew;
} }
else else
...@@ -1189,6 +1190,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -1189,6 +1190,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
// return the original (unmodified by the mapper) timing manager // return the original (unmodified by the mapper) timing manager
pNew->pManTime = p->pManTime; p->pManTime = NULL; pNew->pManTime = p->pManTime; p->pManTime = NULL;
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
Gia_ManStop( p ); Gia_ManStop( p );
// normalize and transfer mapping // normalize and transfer mapping
pNew = Gia_ManDupNormalize( p = pNew ); pNew = Gia_ManDupNormalize( p = pNew );
...@@ -1196,6 +1198,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp ) ...@@ -1196,6 +1198,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp )
Gia_ManTransferPacking( p, pNew ); Gia_ManTransferPacking( p, pNew );
pNew->pManTime = p->pManTime; p->pManTime = NULL; pNew->pManTime = p->pManTime; p->pManTime = NULL;
pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL; pNew->pAigExtra = p->pAigExtra; p->pAigExtra = NULL;
pNew->nAnd2Delay = p->nAnd2Delay; p->nAnd2Delay = 0;
// pNew->vPacking = p->vPacking; p->vPacking = NULL; // pNew->vPacking = p->vPacking; p->vPacking = NULL;
Gia_ManStop( p ); Gia_ManStop( p );
......
...@@ -335,7 +335,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fTents, int fSwitch, int fCut ) ...@@ -335,7 +335,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fTents, int fSwitch, int fCut )
if ( p->pPlacement ) if ( p->pPlacement )
Gia_ManPrintPlacement( p ); Gia_ManPrintPlacement( p );
if ( p->pManTime ) if ( p->pManTime )
Tim_ManPrintStats( p->pManTime ); Tim_ManPrintStats( p->pManTime, p->nAnd2Delay );
// print register classes // print register classes
Gia_ManPrintFlopClasses( p ); Gia_ManPrintFlopClasses( p );
Gia_ManPrintGateClasses( p ); Gia_ManPrintGateClasses( p );
......
...@@ -319,6 +319,7 @@ Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars ) ...@@ -319,6 +319,7 @@ Gia_Man_t * Gia_ManFraigSweep( Gia_Man_t * p, void * pPars )
assert( pNew->pAigExtra == NULL ); assert( pNew->pAigExtra == NULL );
pNew->pManTime = p->pManTime; pNew->pManTime = p->pManTime;
pNew->pAigExtra = p->pAigExtra; pNew->pAigExtra = p->pAigExtra;
pNew->nAnd2Delay = p->nAnd2Delay;
pNew = Gia_ManFraigCreateGia( pTemp = pNew ); pNew = Gia_ManFraigCreateGia( pTemp = pNew );
assert( pTemp->pManTime == p->pManTime ); assert( pTemp->pManTime == p->pManTime );
assert( pTemp->pAigExtra == p->pAigExtra ); assert( pTemp->pAigExtra == p->pAigExtra );
......
...@@ -84,7 +84,7 @@ int Gia_ManOrderWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNod ...@@ -84,7 +84,7 @@ int Gia_ManOrderWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNod
Gia_ObjSetTravIdCurrent(p, pObj); Gia_ObjSetTravIdCurrent(p, pObj);
if ( Gia_ObjIsCi(pObj) ) if ( Gia_ObjIsCi(pObj) )
{ {
p->pData2 = (void *)(ABC_PTRUINT_T)Gia_ObjCioId(pObj); p->iData2 = Gia_ObjCioId(pObj);
return 1; return 1;
} }
assert( Gia_ObjIsAnd(pObj) ); assert( Gia_ObjIsAnd(pObj) );
...@@ -132,7 +132,7 @@ Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p ) ...@@ -132,7 +132,7 @@ Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p )
pObj = Gia_ManPo( p, curCo + k ); pObj = Gia_ManPo( p, curCo + k );
if ( Gia_ManOrderWithBoxes_rec( p, Gia_ObjFanin0(pObj), vNodes ) ) 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 ); int iBoxNum = Tim_ManBoxFindFromCiNum( p->pManTime, iCiNum );
printf( "Boxes are not in a topological order. The command has to terminate.\n" ); 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" ); 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 ) ...@@ -143,7 +143,7 @@ Vec_Int_t * Gia_ManOrderWithBoxes( Gia_Man_t * p )
Tim_ManBoxOutputFirst(p->pManTime, iBoxNum), Tim_ManBoxInputFirst(p->pManTime, iBoxNum) ); Tim_ManBoxOutputFirst(p->pManTime, iBoxNum), Tim_ManBoxInputFirst(p->pManTime, iBoxNum) );
printf( "In a correct topological order, BoxB should preceed BoxA.\n" ); printf( "In a correct topological order, BoxB should preceed BoxA.\n" );
Vec_IntFree( vNodes ); Vec_IntFree( vNodes );
p->pData2 = NULL; p->iData2 = 0;
return NULL; return NULL;
} }
} }
...@@ -395,9 +395,10 @@ int Gia_ManLevelWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj ) ...@@ -395,9 +395,10 @@ int Gia_ManLevelWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
} }
int Gia_ManLevelWithBoxes( Gia_Man_t * p ) int Gia_ManLevelWithBoxes( Gia_Man_t * p )
{ {
int nAnd2Delay = p->nAnd2Delay ? p->nAnd2Delay : 1;
Tim_Man_t * pTime = (Tim_Man_t *)p->pManTime; Tim_Man_t * pTime = (Tim_Man_t *)p->pManTime;
Gia_Obj_t * pObj; Gia_Obj_t * pObj, * pObjIn;
int i, k, curCi, curCo, LevelMax; int i, k, j, curCi, curCo, LevelMax;
assert( Gia_ManRegNum(p) == 0 ); assert( Gia_ManRegNum(p) == 0 );
// copy const and real PIs // copy const and real PIs
Gia_ManCleanLevels( p, Gia_ManObjNum(p) ); Gia_ManCleanLevels( p, Gia_ManObjNum(p) );
...@@ -407,8 +408,7 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p ) ...@@ -407,8 +408,7 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p )
for ( i = 0; i < Tim_ManPiNum(pTime); i++ ) for ( i = 0; i < Tim_ManPiNum(pTime); i++ )
{ {
pObj = Gia_ManPi( p, i ); pObj = Gia_ManPi( p, i );
// Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pTime, i) ); Gia_ObjSetLevel( p, pObj, Tim_ManGetCiArrival(pTime, i) / nAnd2Delay );
Gia_ObjSetLevel( p, pObj, 0 );
Gia_ObjSetTravIdCurrent( p, pObj ); Gia_ObjSetTravIdCurrent( p, pObj );
} }
// create logic for each box // create logic for each box
...@@ -416,8 +416,11 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p ) ...@@ -416,8 +416,11 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p )
curCo = 0; curCo = 0;
for ( i = 0; i < Tim_ManBoxNum(pTime); i++ ) for ( i = 0; i < Tim_ManBoxNum(pTime); i++ )
{ {
LevelMax = 0; int nBoxInputs = Tim_ManBoxInputNum( pTime, i );
for ( k = 0; k < Tim_ManBoxInputNum(pTime, i); k++ ) 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 ); pObj = Gia_ManPo( p, curCo + k );
if ( Gia_ManLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) ) ) if ( Gia_ManLevelWithBoxes_rec( p, Gia_ObjFanin0(pObj) ) )
...@@ -425,18 +428,25 @@ int Gia_ManLevelWithBoxes( Gia_Man_t * p ) ...@@ -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" ); printf( "Boxes are not in a topological order. Switching to level computation without boxes.\n" );
return Gia_ManLevelNum( p ); return Gia_ManLevelNum( p );
} }
// set box input level
Gia_ObjSetCoLevel( p, pObj ); Gia_ObjSetCoLevel( p, pObj );
LevelMax = Abc_MaxInt( LevelMax, Gia_ObjLevel(p, pObj) );
} }
curCo += Tim_ManBoxInputNum(pTime, i); // compute level for box outputs
LevelMax++; for ( k = 0; k < nBoxOutputs; k++ )
for ( k = 0; k < Tim_ManBoxOutputNum(pTime, i); k++ )
{ {
pObj = Gia_ManPi( p, curCi + k ); pObj = Gia_ManPi( p, curCi + k );
Gia_ObjSetLevel( p, pObj, LevelMax );
Gia_ObjSetTravIdCurrent( p, pObj ); 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 // add remaining nodes
p->nLevels = 0; p->nLevels = 0;
......
...@@ -134,7 +134,7 @@ extern int Tim_ManGetArrsReqs( Tim_Man_t * p, Vec_Flt_t ** pvInArrs, ...@@ -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_ManStop( Tim_Man_t * p );
extern void Tim_ManStopP( Tim_Man_t ** p ); extern void Tim_ManStopP( Tim_Man_t ** p );
extern void Tim_ManPrint( 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_ManCiNum( Tim_Man_t * p );
extern int Tim_ManCoNum( Tim_Man_t * p ); extern int Tim_ManCoNum( Tim_Man_t * p );
extern int Tim_ManPiNum( Tim_Man_t * p ); extern int Tim_ManPiNum( Tim_Man_t * p );
......
...@@ -488,7 +488,7 @@ void Tim_ManPrint( Tim_Man_t * p ) ...@@ -488,7 +488,7 @@ void Tim_ManPrint( Tim_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Tim_ManPrintStats( Tim_Man_t * p ) void Tim_ManPrintStats( Tim_Man_t * p, int nAnd2Delay )
{ {
Tim_Box_t * pBox; Tim_Box_t * pBox;
Vec_Int_t * vCounts; Vec_Int_t * vCounts;
...@@ -497,10 +497,12 @@ void Tim_ManPrintStats( Tim_Man_t * p ) ...@@ -497,10 +497,12 @@ void Tim_ManPrintStats( Tim_Man_t * p )
if ( p == NULL ) if ( p == NULL )
return; return;
Abc_Print( 1, "Hierarchy : " ); 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_ManPiNum(p), Tim_ManCiNum(p),
Tim_ManPoNum(p), Tim_ManCoNum(p), Tim_ManPoNum(p), Tim_ManCoNum(p),
Tim_ManBoxNum(p) ); Tim_ManBoxNum(p) );
if ( nAnd2Delay )
printf( "delay(AND2) = %d", nAnd2Delay );
printf( "\n" ); printf( "\n" );
if ( Tim_ManBoxNum(p) == 0 ) if ( Tim_ManBoxNum(p) == 0 )
return; return;
......
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