summaryrefslogtreecommitdiffstats
path: root/src/aig
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-02-23 16:08:10 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2013-02-23 16:08:10 -0800
commit7802db98af7705be65f7e58986ed52afc52d4d64 (patch)
tree525963aa8792e1c79ea84e26b703c353101e40c3 /src/aig
parent8281b56e9e2a6a9339fb2dc86711aa719055e014 (diff)
downloadabc-7802db98af7705be65f7e58986ed52afc52d4d64.tar.gz
abc-7802db98af7705be65f7e58986ed52afc52d4d64.tar.bz2
abc-7802db98af7705be65f7e58986ed52afc52d4d64.zip
Integrating sweeping information.
Diffstat (limited to 'src/aig')
-rw-r--r--src/aig/gia/gia.h6
-rw-r--r--src/aig/gia/giaAig.c14
-rw-r--r--src/aig/gia/giaAiger.c17
-rw-r--r--src/aig/gia/giaIf.c15
-rw-r--r--src/aig/gia/giaMan.c2
-rw-r--r--src/aig/gia/giaSweep.c7
-rw-r--r--src/aig/gia/giaTim.c40
7 files changed, 68 insertions, 33 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index 89f599ba..3188d84f 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -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
diff --git a/src/aig/gia/giaAig.c b/src/aig/gia/giaAig.c
index d523c46e..6256b7fd 100644
--- a/src/aig/gia/giaAig.c
+++ b/src/aig/gia/giaAig.c
@@ -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;
}
diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c
index fbbaea00..0e9172c8 100644
--- a/src/aig/gia/giaAiger.c
+++ b/src/aig/gia/giaAiger.c
@@ -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;
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index 931fa4a1..1d4373a3 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -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 );
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index 493d3ed1..732a5075 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -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 );
diff --git a/src/aig/gia/giaSweep.c b/src/aig/gia/giaSweep.c
index 47d368c0..ac52fe9c 100644
--- a/src/aig/gia/giaSweep.c
+++ b/src/aig/gia/giaSweep.c
@@ -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
diff --git a/src/aig/gia/giaTim.c b/src/aig/gia/giaTim.c
index 15e80c42..e3841856 100644
--- a/src/aig/gia/giaTim.c
+++ b/src/aig/gia/giaTim.c
@@ -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;