summaryrefslogtreecommitdiffstats
path: root/src/map
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-08-11 00:49:34 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-08-11 00:49:34 -0700
commitec4804aab61503e8a65c1c31488683eb6bdbe8e1 (patch)
treedb87004cad5427bd9906c434b26c3c7fed8f8d62 /src/map
parent679a9a021a6b9d6fd346a3849e981aeb4f619dff (diff)
downloadabc-ec4804aab61503e8a65c1c31488683eb6bdbe8e1.tar.gz
abc-ec4804aab61503e8a65c1c31488683eb6bdbe8e1.tar.bz2
abc-ec4804aab61503e8a65c1c31488683eb6bdbe8e1.zip
Integrated buffering and sizing.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/scl/scl.c17
-rw-r--r--src/map/scl/sclBufSize.c2
-rw-r--r--src/map/scl/sclBuffer.c20
-rw-r--r--src/map/scl/sclSize.c9
-rw-r--r--src/map/scl/sclSize.h11
-rw-r--r--src/map/scl/sclUpsize.c6
6 files changed, 44 insertions, 21 deletions
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c
index 1e0e02fa..37efc86a 100644
--- a/src/map/scl/scl.c
+++ b/src/map/scl/scl.c
@@ -575,7 +575,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
Abc_Ntk_t * pNtkRes;
- int FanMin, FanMax, FanMaxR, fAddInvs, fUseInvs, fBufPis;
+ int FanMin, FanMax, FanMaxR, fAddInvs, fUseInvs, fBufPis, fSkipDup;
int c, fVerbose;
int fOldAlgo = 0;
FanMin = 6;
@@ -584,9 +584,10 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
fAddInvs = 0;
fUseInvs = 0;
fBufPis = 0;
+ fSkipDup = 0;
fVerbose = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "NMRaixpvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "NMRaixpdvh" ) ) != EOF )
{
switch ( c )
{
@@ -635,6 +636,9 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'p':
fBufPis ^= 1;
break;
+ case 'd':
+ fSkipDup ^= 1;
+ break;
case 'v':
fVerbose ^= 1;
break;
@@ -667,7 +671,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
else if ( fOldAlgo )
pNtkRes = Abc_SclPerformBuffering( pNtk, FanMaxR, FanMax, fUseInvs, fVerbose );
else
- pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fBufPis, fVerbose );
+ pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fBufPis, fSkipDup, fVerbose );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "The command has failed.\n" );
@@ -678,7 +682,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
- fprintf( pAbc->Err, "usage: buffer [-NMR num] [-aixpvh]\n" );
+ fprintf( pAbc->Err, "usage: buffer [-NMR num] [-aixpdvh]\n" );
fprintf( pAbc->Err, "\t performs buffering of the mapped network\n" );
fprintf( pAbc->Err, "\t-N <num> : the min fanout considered by the algorithm [default = %d]\n", FanMin );
fprintf( pAbc->Err, "\t-M <num> : the max allowed fanout count of node/buffer [default = %d]\n", FanMax );
@@ -687,6 +691,7 @@ usage:
fprintf( pAbc->Err, "\t-i : toggle adding interters instead of buffering [default = %s]\n", fAddInvs? "yes": "no" );
fprintf( pAbc->Err, "\t-x : toggle using interters instead of buffers [default = %s]\n", fUseInvs? "yes": "no" );
fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", fBufPis? "yes": "no" );
+ fprintf( pAbc->Err, "\t-d : toggle disabling gate duplication [default = %s]\n", fSkipDup? "yes": "no" );
fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-h : print the command usage\n");
return 1;
@@ -710,8 +715,8 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
int c;
memset( pPars, 0, sizeof(SC_BusPars) );
pPars->GainRatio = 200;
- pPars->Slew = 80;
- pPars->nDegree = 4;
+ pPars->Slew = 100;
+ pPars->nDegree = 8;
pPars->fSizeOnly = 0;
pPars->fAddBufs = 0;
pPars->fBufPis = 0;
diff --git a/src/map/scl/sclBufSize.c b/src/map/scl/sclBufSize.c
index 9925c7ef..8ec76da4 100644
--- a/src/map/scl/sclBufSize.c
+++ b/src/map/scl/sclBufSize.c
@@ -80,7 +80,7 @@ Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars )
p->pPars = pPars;
p->pNtk = pNtk;
p->pLib = pLib;
- p->pInv = Abc_SclFindInvertor(pLib, pPars->fAddBufs)->pAve;
+ p->pInv = Abc_SclFindInvertor(pLib, pPars->fAddBufs)->pRepr->pPrev;//->pAve;
if ( pPars->fUseWireLoads )
{
if ( pNtk->pWLoadUsed == NULL )
diff --git a/src/map/scl/sclBuffer.c b/src/map/scl/sclBuffer.c
index 868e851a..580a6446 100644
--- a/src/map/scl/sclBuffer.c
+++ b/src/map/scl/sclBuffer.c
@@ -704,8 +704,8 @@ Buf_Man_t * Buf_ManStart( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis
// Abc_NtkForEachNode( p->pNtk, pObj, i )
// printf( "%4d : %4d %4d\n", i, Abc_BufNodeArr(p, pObj), Abc_BufNodeDep(p, pObj) );
// create fanout queue
- Abc_NtkForEachCi( p->pNtk, pObj, i )
- Abc_BufAddToQue( p, pObj );
+// Abc_NtkForEachCi( p->pNtk, pObj, i )
+// Abc_BufAddToQue( p, pObj );
Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
Abc_BufAddToQue( p, pObj );
Vec_PtrFree( vNodes );
@@ -860,7 +860,7 @@ int Abc_BufCountNonCritical( Buf_Man_t * p, Abc_Obj_t * pObj )
Vec_IntPush( p->vNonCrit, Abc_ObjId(pFanout) );
return Vec_IntSize(p->vNonCrit);
}
-void Abc_BufPerformOne( Buf_Man_t * p, int iPivot, int fVerbose )
+void Abc_BufPerformOne( Buf_Man_t * p, int iPivot, int fSkipDup, int fVerbose )
{
Abc_Obj_t * pObj, * pFanout;
int i, j, nCrit, nNonCrit;
@@ -889,11 +889,12 @@ printf( "ObjId = %6d : %-10s FI = %d. FO =%4d. Crit =%4d. ",
Abc_BufUpdateDep( p, pBuffer );
Abc_BufAddToQue( p, pObj );
Abc_BufAddToQue( p, pBuffer );
+ Abc_SclTimeIncUpdateLevel( pBuffer );
p->nSeparate++;
if ( fVerbose )
printf( "Adding buffer\n" );
}
- else if ( nCrit > 0 && Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > p->nFanMin )//&& Abc_ObjFaninNum(pObj) < 2 )
+ else if ( !fSkipDup && nCrit > 0 && Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > p->nFanMin )//&& Abc_ObjLevel(pObj) < 4 )//&& Abc_ObjFaninNum(pObj) < 2 )
{
// (2) only critical are present - duplicate
Abc_Obj_t * pClone = Abc_NtkDupObj( p->pNtk, pObj, 0 );
@@ -911,7 +912,9 @@ printf( "Adding buffer\n" );
Abc_BufAddToQue( p, pClone );
Abc_ObjForEachFanin( pObj, pFanout, i )
Abc_BufAddToQue( p, pFanout );
+ Abc_SclTimeIncUpdateLevel( pClone );
p->nDuplicate++;
+// printf( "Duplicating %s on level %d\n", Mio_GateReadName((Mio_Gate_t *)pObj->pData), Abc_ObjLevel(pObj) );
if ( fVerbose )
printf( "Duplicating node\n" );
}
@@ -963,6 +966,8 @@ printf( "Adding %d buffers\n", nDegree );
Abc_BufUpdateDep( p, pObj );
for ( i = 0; i < nDegree; i++ )
Abc_BufAddToQue( p, Abc_NtkObj(p->pNtk, iFirstBuf + i) );
+ for ( i = 0; i < nDegree; i++ )
+ Abc_SclTimeIncUpdateLevel( Abc_NtkObj(p->pNtk, iFirstBuf + i) );
}
else
{
@@ -972,13 +977,16 @@ printf( "Doing nothing\n" );
// if ( DelayMax != p->DelayMax )
// printf( "%d (%.2f) ", p->DelayMax, 1.0 * p->DelayMax * p->DelayInv / BUF_SCALE );
}
-Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fVerbose )
+Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose )
{
Abc_Ntk_t * pNew;
Buf_Man_t * p = Buf_ManStart( pNtk, FanMin, FanMax, fBufPis );
int i, Limit = ABC_INFINITY;
+ Abc_NtkLevel( pNtk );
+ if ( Abc_NtkNodeNum(pNtk) < 1000 )
+ fSkipDup = 1;
for ( i = 0; i < Limit && Vec_QueSize(p->vQue); i++ )
- Abc_BufPerformOne( p, Vec_QuePop(p->vQue), fVerbose );
+ Abc_BufPerformOne( p, Vec_QuePop(p->vQue), fSkipDup, fVerbose );
Buf_ManStop( p );
// Abc_BufReplaceBufsByInvs( pNtk );
// duplicate network in topo order
diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c
index 07952802..0f085ecb 100644
--- a/src/map/scl/sclSize.c
+++ b/src/map/scl/sclSize.c
@@ -133,11 +133,12 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
p->ReportDelay = maxDelay;
printf( "WireLoad model = \"%s\" ", p->pWLoadUsed ? p->pWLoadUsed->pName : "none" );
- printf( "Gates = %6d ", Abc_NtkNodeNum(p->pNtk) );
- printf( "Cave = %5.1f ff ", p->EstLoadAve );
- printf( "Area = %12.2f ", Abc_SclGetTotalArea(p->pNtk) );
+ printf( "Gates =%7d ", Abc_NtkNodeNum(p->pNtk) );
+ printf( "(%5.1f %%) ", Abc_SclGetAverageSize(p->pNtk) );
+ printf( "Cave =%5.1f ff ", p->EstLoadAve );
+ printf( "Area =%12.2f ", Abc_SclGetTotalArea(p->pNtk) );
printf( "(%5.1f %%) ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
- printf( "Delay = %8.2f ps ", maxDelay );
+ printf( "Delay =%9.2f ps ", maxDelay );
printf( "(%5.1f %%) ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
printf( " \n" );
if ( fShowAll )
diff --git a/src/map/scl/sclSize.h b/src/map/scl/sclSize.h
index 37337cd8..b63fe41b 100644
--- a/src/map/scl/sclSize.h
+++ b/src/map/scl/sclSize.h
@@ -400,6 +400,15 @@ static inline void Abc_SclConeClean( SC_Man * p, Vec_Int_t * vCone )
SeeAlso []
***********************************************************************/
+static inline float Abc_SclGetAverageSize( Abc_Ntk_t * pNtk )
+{
+ Abc_Obj_t * pObj;
+ double Total = 0;
+ int i, Count = 0;
+ Abc_NtkForEachNode1( pNtk, pObj, i )
+ Count++, Total += 100.0*Abc_SclObjCell(pObj)->Order/Abc_SclObjCell(pObj)->nGates;
+ return (float)(Total / Count);
+}
static inline float Abc_SclGetTotalArea( Abc_Ntk_t * pNtk )
{
double Area = 0;
@@ -504,7 +513,7 @@ extern Abc_Ntk_t * Abc_SclUnBufferPhase( Abc_Ntk_t * pNtk, int fVerbose );
extern Abc_Ntk_t * Abc_SclBufferPhase( Abc_Ntk_t * pNtk, int fVerbose );
extern int Abc_SclCheckNtk( Abc_Ntk_t * p, int fVerbose );
extern Abc_Ntk_t * Abc_SclPerformBuffering( Abc_Ntk_t * p, int DegreeR, int Degree, int fUseInvs, int fVerbose );
-extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fVerbose );
+extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose );
/*=== sclDnsize.c ===============================================================*/
extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars );
/*=== sclLoad.c ===============================================================*/
diff --git a/src/map/scl/sclUpsize.c b/src/map/scl/sclUpsize.c
index a5d71ddf..09eadfa0 100644
--- a/src/map/scl/sclUpsize.c
+++ b/src/map/scl/sclUpsize.c
@@ -469,8 +469,8 @@ int Abc_SclFindBypasses( SC_Man * p, Vec_Int_t * vPathNodes, int Ratio, int Notc
// remember gain
if ( dGainBest2 == -1 )
dGainBest2 = Vec_FltEntry(p->vNode2Gain, iNode);
- else if ( dGainBest2 > 2*Vec_FltEntry(p->vNode2Gain, iNode) )
- break;
+// else if ( dGainBest2 > 2*Vec_FltEntry(p->vNode2Gain, iNode) )
+// break;
// redirect
Abc_SclUpdateLoadSplit( p, pBuf, pFanout );
Abc_SclAddWireLoad( p, pBuf, 1 );
@@ -932,7 +932,7 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars
clk = Abc_Clock();
if ( pPars->fUseDept )
{
- if ( Vec_IntSize(p->vChanged) && pPars->BypassFreq == 0 )
+ if ( Vec_IntSize(p->vChanged) && !(pPars->BypassFreq && i && (i % pPars->BypassFreq) == 0) )
nConeSize = Abc_SclTimeIncUpdate( p );
else
Abc_SclTimeNtkRecompute( p, NULL, NULL, pPars->fUseDept, 0 );