Commit 56a233be by Alan Mishchenko

Adding switch 'buffer -p' to enable buffing of the primary inputs.

parent f1615dcc
...@@ -558,15 +558,16 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -558,15 +558,16 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
Abc_Ntk_t * pNtkRes; Abc_Ntk_t * pNtkRes;
int FanMin, FanMax, fUseInvs; int FanMin, FanMax, fUseInvs, fBufPis;
int c, fVerbose; int c, fVerbose;
int fOldAlgo = 0; int fOldAlgo = 0;
FanMin = 6; FanMin = 6;
FanMax = 14; FanMax = 14;
fUseInvs = 0; fUseInvs = 0;
fBufPis = 0;
fVerbose = 0; fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "NMaivh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "NMaipvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -598,6 +599,9 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -598,6 +599,9 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'i': case 'i':
fUseInvs ^= 1; fUseInvs ^= 1;
break; break;
case 'p':
fBufPis ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -623,7 +627,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -623,7 +627,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( fOldAlgo ) if ( fOldAlgo )
pNtkRes = Abc_SclPerformBuffering( pNtk, FanMax, fUseInvs, fVerbose ); pNtkRes = Abc_SclPerformBuffering( pNtk, FanMax, fUseInvs, fVerbose );
else else
pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fVerbose ); pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fBufPis, fVerbose );
if ( pNtkRes == NULL ) if ( pNtkRes == NULL )
{ {
Abc_Print( -1, "The command has failed.\n" ); Abc_Print( -1, "The command has failed.\n" );
...@@ -634,12 +638,13 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -634,12 +638,13 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: buffer [-NM num] [-aivh]\n" ); fprintf( pAbc->Err, "usage: buffer [-NM num] [-aipvh]\n" );
fprintf( pAbc->Err, "\t performs buffering of the mapped network\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-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 ); fprintf( pAbc->Err, "\t-M <num> : the max allowed fanout count of node/buffer [default = %d]\n", FanMax );
fprintf( pAbc->Err, "\t-a : toggle using old algorithm [default = %s]\n", fOldAlgo? "yes": "no" ); fprintf( pAbc->Err, "\t-a : toggle using old algorithm [default = %s]\n", fOldAlgo? "yes": "no" );
fprintf( pAbc->Err, "\t-i : toggle using interters instead of buffers [default = %s]\n", fUseInvs? "yes": "no" ); fprintf( pAbc->Err, "\t-i : 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-v : toggle printing verbose information [default = %s]\n", fVerbose? "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"); fprintf( pAbc->Err, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -36,6 +36,7 @@ struct Buf_Man_t_ ...@@ -36,6 +36,7 @@ struct Buf_Man_t_
// parameters // parameters
int nFanMin; // the smallest fanout count to consider int nFanMin; // the smallest fanout count to consider
int nFanMax; // the largest fanout count allowed off CP int nFanMax; // the largest fanout count allowed off CP
int fBufPis; // enables buffing of the combinational inputs
// internal deta // internal deta
Abc_Ntk_t * pNtk; // logic network Abc_Ntk_t * pNtk; // logic network
Vec_Int_t * vOffsets; // offsets into edge delays Vec_Int_t * vOffsets; // offsets into edge delays
...@@ -372,7 +373,7 @@ void Abc_BufCreateEdges( Buf_Man_t * p, Abc_Obj_t * pObj ) ...@@ -372,7 +373,7 @@ void Abc_BufCreateEdges( Buf_Man_t * p, Abc_Obj_t * pObj )
} }
void Abc_BufAddToQue( Buf_Man_t * p, Abc_Obj_t * pObj ) void Abc_BufAddToQue( Buf_Man_t * p, Abc_Obj_t * pObj )
{ {
if ( Abc_ObjFanoutNum(pObj) < p->nFanMin ) if ( Abc_ObjFanoutNum(pObj) < p->nFanMin || (!p->fBufPis && Abc_ObjIsCi(pObj)) )
return; return;
Vec_FltWriteEntry( p->vCounts, Abc_ObjId(pObj), Abc_ObjFanoutNum(pObj) ); Vec_FltWriteEntry( p->vCounts, Abc_ObjId(pObj), Abc_ObjFanoutNum(pObj) );
if ( Vec_QueIsMember(p->vQue, Abc_ObjId(pObj)) ) if ( Vec_QueIsMember(p->vQue, Abc_ObjId(pObj)) )
...@@ -484,7 +485,7 @@ void Abc_BufUpdateDep( Buf_Man_t * p, Abc_Obj_t * pObj ) ...@@ -484,7 +485,7 @@ void Abc_BufUpdateDep( Buf_Man_t * p, Abc_Obj_t * pObj )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Buf_Man_t * Buf_ManStart( Abc_Ntk_t * pNtk, int FanMin, int FanMax ) Buf_Man_t * Buf_ManStart( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis )
{ {
Buf_Man_t * p; Buf_Man_t * p;
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
...@@ -494,6 +495,7 @@ Buf_Man_t * Buf_ManStart( Abc_Ntk_t * pNtk, int FanMin, int FanMax ) ...@@ -494,6 +495,7 @@ Buf_Man_t * Buf_ManStart( Abc_Ntk_t * pNtk, int FanMin, int FanMax )
p->pNtk = pNtk; p->pNtk = pNtk;
p->nFanMin = FanMin; p->nFanMin = FanMin;
p->nFanMax = FanMax; p->nFanMax = FanMax;
p->fBufPis = fBufPis;
// allocate arrays // allocate arrays
p->nObjStart = Abc_NtkObjNumMax(p->pNtk); p->nObjStart = Abc_NtkObjNumMax(p->pNtk);
p->nObjAlloc = (6 * Abc_NtkObjNumMax(p->pNtk) / 3) + 100; p->nObjAlloc = (6 * Abc_NtkObjNumMax(p->pNtk) / 3) + 100;
...@@ -793,10 +795,10 @@ printf( "Doing nothing\n" ); ...@@ -793,10 +795,10 @@ printf( "Doing nothing\n" );
// if ( DelayMax != p->DelayMax ) // if ( DelayMax != p->DelayMax )
// printf( "%d (%.2f) ", p->DelayMax, 1.0 * p->DelayMax * p->DelayInv / BUF_SCALE ); // 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 fVerbose ) Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fVerbose )
{ {
Abc_Ntk_t * pNew; Abc_Ntk_t * pNew;
Buf_Man_t * p = Buf_ManStart( pNtk, FanMin, FanMax ); Buf_Man_t * p = Buf_ManStart( pNtk, FanMin, FanMax, fBufPis );
int i, Limit = ABC_INFINITY; int i, Limit = ABC_INFINITY;
for ( i = 0; i < Limit && Vec_QueSize(p->vQue); i++ ) 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), fVerbose );
......
...@@ -389,7 +389,7 @@ static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, abctime Time ...@@ -389,7 +389,7 @@ static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, abctime Time
extern Abc_Ntk_t * Abc_SclUnBufferPerform( Abc_Ntk_t * pNtk, int fVerbose ); extern Abc_Ntk_t * Abc_SclUnBufferPerform( Abc_Ntk_t * pNtk, int fVerbose );
extern int Abc_SclCheckNtk( Abc_Ntk_t * p, int fVerbose ); extern int Abc_SclCheckNtk( Abc_Ntk_t * p, int fVerbose );
extern Abc_Ntk_t * Abc_SclPerformBuffering( Abc_Ntk_t * p, int Degree, int fUseInvs, int fVerbose ); extern Abc_Ntk_t * Abc_SclPerformBuffering( Abc_Ntk_t * p, int Degree, int fUseInvs, int fVerbose );
extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fVerbose ); extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fVerbose );
/*=== sclDnsize.c ===============================================================*/ /*=== sclDnsize.c ===============================================================*/
extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ); extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars );
/*=== sclLoad.c ===============================================================*/ /*=== sclLoad.c ===============================================================*/
......
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