From 56a233be9121ad746889d0d8556d8f60d1092e3d Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 2 Aug 2013 23:23:45 -0700 Subject: Adding switch 'buffer -p' to enable buffing of the primary inputs. --- src/map/scl/scl.c | 13 +++++++++---- src/map/scl/sclBuffer.c | 10 ++++++---- src/map/scl/sclSize.h | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 49d07a04..7bab7abc 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -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 * pNtkRes; - int FanMin, FanMax, fUseInvs; + int FanMin, FanMax, fUseInvs, fBufPis; int c, fVerbose; int fOldAlgo = 0; FanMin = 6; FanMax = 14; fUseInvs = 0; + fBufPis = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "NMaivh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "NMaipvh" ) ) != EOF ) { switch ( c ) { @@ -598,6 +599,9 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'i': fUseInvs ^= 1; break; + case 'p': + fBufPis ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -623,7 +627,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( fOldAlgo ) pNtkRes = Abc_SclPerformBuffering( pNtk, FanMax, fUseInvs, fVerbose ); else - pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fVerbose ); + pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fBufPis, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); @@ -634,12 +638,13 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; 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-N : the min fanout considered by the algorithm [default = %d]\n", FanMin ); fprintf( pAbc->Err, "\t-M : 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-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-h : print the command usage\n"); return 1; diff --git a/src/map/scl/sclBuffer.c b/src/map/scl/sclBuffer.c index a13a7cf6..f7097fb1 100644 --- a/src/map/scl/sclBuffer.c +++ b/src/map/scl/sclBuffer.c @@ -36,6 +36,7 @@ struct Buf_Man_t_ // parameters int nFanMin; // the smallest fanout count to consider int nFanMax; // the largest fanout count allowed off CP + int fBufPis; // enables buffing of the combinational inputs // internal deta Abc_Ntk_t * pNtk; // logic network Vec_Int_t * vOffsets; // offsets into edge delays @@ -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 ) { - if ( Abc_ObjFanoutNum(pObj) < p->nFanMin ) + if ( Abc_ObjFanoutNum(pObj) < p->nFanMin || (!p->fBufPis && Abc_ObjIsCi(pObj)) ) return; Vec_FltWriteEntry( p->vCounts, Abc_ObjId(pObj), Abc_ObjFanoutNum(pObj) ); if ( Vec_QueIsMember(p->vQue, Abc_ObjId(pObj)) ) @@ -484,7 +485,7 @@ void Abc_BufUpdateDep( Buf_Man_t * p, Abc_Obj_t * pObj ) 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; Abc_Obj_t * pObj; @@ -494,6 +495,7 @@ Buf_Man_t * Buf_ManStart( Abc_Ntk_t * pNtk, int FanMin, int FanMax ) p->pNtk = pNtk; p->nFanMin = FanMin; p->nFanMax = FanMax; + p->fBufPis = fBufPis; // allocate arrays p->nObjStart = Abc_NtkObjNumMax(p->pNtk); p->nObjAlloc = (6 * Abc_NtkObjNumMax(p->pNtk) / 3) + 100; @@ -793,10 +795,10 @@ 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 fVerbose ) +Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fVerbose ) { 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; for ( i = 0; i < Limit && Vec_QueSize(p->vQue); i++ ) Abc_BufPerformOne( p, Vec_QuePop(p->vQue), fVerbose ); diff --git a/src/map/scl/sclSize.h b/src/map/scl/sclSize.h index b7d63542..d9964f28 100644 --- a/src/map/scl/sclSize.h +++ b/src/map/scl/sclSize.h @@ -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 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_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 ===============================================================*/ extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ); /*=== sclLoad.c ===============================================================*/ -- cgit v1.2.3