From a4f80c1d36ee2ea986ac3fd637aa91f97537cdb6 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 13 Oct 2013 21:05:35 -0700 Subject: [PATCH] Cleaning up buffering code. --- src/map/scl/scl.c | 490 ++++++++++++++++------------------------ src/map/scl/sclDnsize.c | 2 - src/map/scl/sclSize.c | 120 ---------- src/map/scl/sclSize.h | 1 - src/map/scl/sclUpsize.c | 2 - 5 files changed, 200 insertions(+), 415 deletions(-) diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index e5eab4c7c..1c5e33549 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -37,14 +37,13 @@ static int Scl_CommandDumpGen ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandPrintGS ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandStime ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandTopo ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Scl_CommandBuffer ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Scl_CommandBufSize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandUnBuffer ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Scl_CommandBuffer ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Scl_CommandBufferOld ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandMinsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandMaxsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandUpsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandDnsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Scl_CommandBsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandPrintBuf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandReadConstr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -99,14 +98,13 @@ void Scl_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "SCL mapping", "print_gs", Scl_CommandPrintGS, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "stime", Scl_CommandStime, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "topo", Scl_CommandTopo, 1 ); -// Cmd_CommandAdd( pAbc, "SCL mapping", "buffer", Scl_CommandBuffer, 1 ); - Cmd_CommandAdd( pAbc, "SCL mapping", "bufsize", Scl_CommandBufSize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "unbuffer", Scl_CommandUnBuffer, 1 ); + Cmd_CommandAdd( pAbc, "SCL mapping", "buffer", Scl_CommandBuffer, 1 ); +// Cmd_CommandAdd( pAbc, "SCL mapping", "_buffer", Scl_CommandBufferOld, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "minsize", Scl_CommandMinsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "maxsize", Scl_CommandMaxsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "upsize", Scl_CommandUpsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "dnsize", Scl_CommandDnsize, 1 ); -// Cmd_CommandAdd( pAbc, "SCL mapping", "bsize", Scl_CommandBsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_buf", Scl_CommandPrintBuf, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "read_constr", Scl_CommandReadConstr, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_constr", Scl_CommandPrintConstr, 0 ); @@ -792,6 +790,70 @@ usage: return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Scl_CommandUnBuffer( Abc_Frame_t * pAbc, int argc, char **argv ) +{ + Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc); + int c, fRemInv = 0, fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "ivh" ) ) != EOF ) + { + switch ( c ) + { + case 'i': + fRemInv ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + + if ( pNtk == NULL ) + { + fprintf( pAbc->Err, "There is no current network.\n" ); + return 1; + } + if ( !Abc_NtkIsLogic(pNtk) ) + { + fprintf( pAbc->Err, "The current network is not a logic network.\n" ); + return 1; + } + if ( fRemInv ) + pNtkRes = Abc_SclUnBufferPhase( pNtk, fVerbose ); + else + pNtkRes = Abc_SclUnBufferPerform( pNtk, fVerbose ); + if ( pNtkRes == NULL ) + { + Abc_Print( -1, "The command has failed.\n" ); + return 1; + } + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + return 0; + +usage: + fprintf( pAbc->Err, "usage: unbuffer [-ivh]\n" ); + fprintf( pAbc->Err, "\t collapses buffer/inverter trees\n" ); + fprintf( pAbc->Err, "\t-i : toggle removing interters [default = %s]\n", fRemInv? "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; +} + /**Function************************************************************* Synopsis [] @@ -804,6 +866,137 @@ usage: ***********************************************************************/ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + SC_BusPars Pars, * pPars = &Pars; + Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc); + int c; + memset( pPars, 0, sizeof(SC_BusPars) ); + pPars->GainRatio = 1000; + pPars->Slew = 100; + pPars->nDegree = 10; + pPars->fSizeOnly = 0; + pPars->fAddBufs = 1; + pPars->fBufPis = 0; + pPars->fUseWireLoads = 1; + pPars->fVerbose = 0; + pPars->fVeryVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "GSDsbpcvwh" ) ) != EOF ) + { + switch ( c ) + { + case 'G': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" ); + goto usage; + } + pPars->GainRatio = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->GainRatio < 0 ) + goto usage; + break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" ); + goto usage; + } + pPars->Slew = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->Slew < 0 ) + goto usage; + break; + case 'D': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); + goto usage; + } + pPars->nDegree = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nDegree < 0 ) + goto usage; + break; + case 's': + pPars->fSizeOnly ^= 1; + break; + case 'b': + pPars->fAddBufs ^= 1; + break; + case 'p': + pPars->fBufPis ^= 1; + break; + case 'c': + pPars->fUseWireLoads ^= 1; + break; + case 'v': + pPars->fVerbose ^= 1; + break; + case 'w': + pPars->fVeryVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + + if ( pNtk == NULL ) + { + Abc_Print( -1, "Empty network.\n" ); + return 1; + } + if ( !Abc_NtkIsLogic(pNtk) ) + { + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); + return 1; + } + if ( !pPars->fSizeOnly && !pPars->fAddBufs && pNtk->vPhases == NULL ) + { + Abc_Print( -1, "Fanin phase information is not avaiable.\n" ); + return 1; + } + // modify the current network + pNtkRes = Abc_SclBufSizePerform( pNtk, (SC_Lib *)pAbc->pLibScl, pPars ); + if ( pNtkRes == NULL ) + { + Abc_Print( -1, "The command has failed.\n" ); + return 1; + } + // replace the current network + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + return 0; + +usage: + fprintf( pAbc->Err, "usage: buffer [-GSD num] [-sbpcvwh]\n" ); + fprintf( pAbc->Err, "\t performs buffering and sizing and mapped network\n" ); + fprintf( pAbc->Err, "\t-G : target gain percentage [default = %d]\n", pPars->GainRatio ); + fprintf( pAbc->Err, "\t-S : target slew in pisoseconds [default = %d]\n", pPars->Slew ); + fprintf( pAbc->Err, "\t-D : the maximum fanout degree [default = %d]\n", pPars->nDegree ); + fprintf( pAbc->Err, "\t-s : toggle performing only sizing [default = %s]\n", pPars->fSizeOnly? "yes": "no" ); + fprintf( pAbc->Err, "\t-b : toggle using buffers instead of inverters [default = %s]\n", pPars->fAddBufs? "yes": "no" ); + fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", pPars->fBufPis? "yes": "no" ); + fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" ); + fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + fprintf( pAbc->Err, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Scl_CommandBufferOld( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes; @@ -914,7 +1107,7 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pAbc->Err, "usage: buffer [-NMR num] [-aixpdvh]\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 : 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 ); @@ -929,201 +1122,6 @@ usage: return 1; } -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - SC_BusPars Pars, * pPars = &Pars; - Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc); - int c; - memset( pPars, 0, sizeof(SC_BusPars) ); - pPars->GainRatio = 1000; - pPars->Slew = 100; - pPars->nDegree = 10; - pPars->fSizeOnly = 0; - pPars->fAddBufs = 1; - pPars->fBufPis = 0; - pPars->fUseWireLoads = 1; - pPars->fVerbose = 0; - pPars->fVeryVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "GSDsbpcvwh" ) ) != EOF ) - { - switch ( c ) - { - case 'G': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->GainRatio = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->GainRatio < 0 ) - goto usage; - break; - case 'S': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->Slew = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->Slew < 0 ) - goto usage; - break; - case 'D': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->nDegree = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nDegree < 0 ) - goto usage; - break; - case 's': - pPars->fSizeOnly ^= 1; - break; - case 'b': - pPars->fAddBufs ^= 1; - break; - case 'p': - pPars->fBufPis ^= 1; - break; - case 'c': - pPars->fUseWireLoads ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'w': - pPars->fVeryVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pNtk == NULL ) - { - Abc_Print( -1, "Empty network.\n" ); - return 1; - } - if ( !Abc_NtkIsLogic(pNtk) ) - { - Abc_Print( -1, "This command can only be applied to a logic network.\n" ); - return 1; - } - if ( !pPars->fSizeOnly && !pPars->fAddBufs && pNtk->vPhases == NULL ) - { - Abc_Print( -1, "Fanin phase information is not avaiable.\n" ); - return 1; - } - // modify the current network - pNtkRes = Abc_SclBufSizePerform( pNtk, (SC_Lib *)pAbc->pLibScl, pPars ); - if ( pNtkRes == NULL ) - { - Abc_Print( -1, "The command has failed.\n" ); - return 1; - } - // replace the current network - Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); - return 0; - -usage: - fprintf( pAbc->Err, "usage: bufsize [-GSD num] [-sbpcvwh]\n" ); - fprintf( pAbc->Err, "\t performs buffering and sizing and mapped network\n" ); - fprintf( pAbc->Err, "\t-G : target gain percentage [default = %d]\n", pPars->GainRatio ); - fprintf( pAbc->Err, "\t-S : target slew in pisoseconds [default = %d]\n", pPars->Slew ); - fprintf( pAbc->Err, "\t-D : the maximum fanout degree [default = %d]\n", pPars->nDegree ); - fprintf( pAbc->Err, "\t-s : toggle performing only sizing [default = %s]\n", pPars->fSizeOnly? "yes": "no" ); - fprintf( pAbc->Err, "\t-b : toggle using buffers instead of inverters [default = %s]\n", pPars->fAddBufs? "yes": "no" ); - fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", pPars->fBufPis? "yes": "no" ); - fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" ); - fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pAbc->Err, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Scl_CommandUnBuffer( Abc_Frame_t * pAbc, int argc, char **argv ) -{ - Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc); - int c, fRemInv = 0, fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "ivh" ) ) != EOF ) - { - switch ( c ) - { - case 'i': - fRemInv ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pNtk == NULL ) - { - fprintf( pAbc->Err, "There is no current network.\n" ); - return 1; - } - if ( !Abc_NtkIsLogic(pNtk) ) - { - fprintf( pAbc->Err, "The current network is not a logic network.\n" ); - return 1; - } - if ( fRemInv ) - pNtkRes = Abc_SclUnBufferPhase( pNtk, fVerbose ); - else - pNtkRes = Abc_SclUnBufferPerform( pNtk, fVerbose ); - if ( pNtkRes == NULL ) - { - Abc_Print( -1, "The command has failed.\n" ); - return 1; - } - Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); - return 0; - -usage: - fprintf( pAbc->Err, "usage: unbuffer [-ivh]\n" ); - fprintf( pAbc->Err, "\t collapses buffer/inverter trees\n" ); - fprintf( pAbc->Err, "\t-i : toggle removing interters [default = %s]\n", fRemInv? "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; -} - /**Function************************************************************* Synopsis [] @@ -1635,94 +1633,6 @@ usage: return 1; } -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Scl_CommandBsize( Abc_Frame_t * pAbc, int argc, char **argv ) -{ - extern Abc_Ntk_t * Abc_SclBuffSizeStep( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads ); - Abc_Ntk_t * pNtkRes; - int c; - int fUseWireLoads = 1; - int nTreeCRatio = 0; - - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Xch" ) ) != EOF ) - { - switch ( c ) - { - case 'X': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" ); - goto usage; - } - nTreeCRatio = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nTreeCRatio < 0 ) - goto usage; - break; - case 'c': - fUseWireLoads ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( Abc_FrameReadNtk(pAbc) == NULL ) - { - fprintf( pAbc->Err, "There is no current network.\n" ); - return 1; - } - if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) ) - { - fprintf( pAbc->Err, "The current network is not mapped.\n" ); - return 1; - } - if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) ) - { - fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" ); - return 1; - } - if ( pAbc->pLibScl == NULL ) - { - fprintf( pAbc->Err, "There is no Liberty library available.\n" ); - return 1; - } - if ( Abc_FrameReadNtk(pAbc)->vPhases == 0 ) - { - fprintf( pAbc->Err, "There is no phases available.\n" ); - return 1; - } - pNtkRes = Abc_SclBuffSizeStep( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), nTreeCRatio, fUseWireLoads ); - if ( pNtkRes == NULL ) - { - Abc_Print( -1, "The command has failed.\n" ); - return 1; - } - Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); - return 0; - -usage: - fprintf( pAbc->Err, "usage: bsize [-X num] [-ch]\n" ); - fprintf( pAbc->Err, "\t performs STA using Liberty library\n" ); - fprintf( pAbc->Err, "\t-X : min Cout/Cave ratio for tree estimations [default = %d]\n", nTreeCRatio ); - fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", fUseWireLoads? "yes": "no" ); - fprintf( pAbc->Err, "\t-h : print the help massage\n" ); - return 1; -} - /**Function************************************************************* Synopsis [] diff --git a/src/map/scl/sclDnsize.c b/src/map/scl/sclDnsize.c index ef1415f72..c4bfc0b98 100644 --- a/src/map/scl/sclDnsize.c +++ b/src/map/scl/sclDnsize.c @@ -122,8 +122,6 @@ clk = Abc_Clock(); continue; if ( i > Notches ) break; -// if ( p->vInDrive && !Abc_SclInputDriveOk( p, pObj, pCellNew ) ) -// continue; // set new cell Abc_SclObjSetCell( pObj, pCellNew ); Abc_SclUpdateLoad( p, pObj, pCellOld, pCellNew ); diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c index 37dca670d..70f8e1a69 100644 --- a/src/map/scl/sclSize.c +++ b/src/map/scl/sclSize.c @@ -813,126 +813,6 @@ void Abc_SclPrintBuffers( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fVerbose ) } -/**Function************************************************************* - - Synopsis [Checks if the input drive capability is ok.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_SclInputDriveOk( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pCell ) -{ - Abc_Obj_t * pFanin; - int i; - assert( Abc_ObjFaninNum(pObj) == pCell->n_inputs ); - Abc_ObjForEachFanin( pObj, pFanin, i ) - if ( Abc_ObjIsPi(pFanin) && Abc_SclObjInDrive(p, pFanin) > 0 && - (Abc_SclObjInDrive(p, pFanin) / Abc_ObjFanoutNum(pFanin)) < SC_CellPinCap( pCell, i ) ) - return 0; - return 1; -} - -/**Function************************************************************* - - Synopsis [Select nodes that need to be buffered.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Vec_Wec_t * Abc_SclSelectSplitNodes( SC_Man * p, Abc_Ntk_t * pNtk ) -{ - Vec_Wec_t * vSplits; - Vec_Int_t * vCrits, * vNonCrits, * vLevel; - Abc_Obj_t * pObj, * pFanout; - int i, k; - assert( p->EstLoadMax > 0 ); - vCrits = Vec_IntAlloc( 1000 ); - vNonCrits = Vec_IntAlloc( 1000 ); - vSplits = Vec_WecAlloc( 1000 ); - Abc_NtkForEachNodeCi( pNtk, pObj, i ) - { - if ( Abc_SclObjLoadValue(p, pObj) < 1 ) - { -// printf( "%d ", Abc_ObjFanoutNum(pObj) ); - continue; - } -/* - printf( "%d : %.0f ", i, 0.5 * (Abc_SclObjLoad(p, pObj)->fall + Abc_SclObjLoad(p, pObj)->rise) ); - Abc_ObjForEachFanout( pObj, pFanout, k ) - printf( "%.1f ", SC_CellPinCapAve(Abc_SclObjCell(pFanout)) ); - printf( "\n" ); -*/ - // skip non-critical nodes -// if ( Abc_SclObjSlack(p, pObj) > 100 ) -// continue; - // collect non-critical fanouts of the node - Vec_IntClear( vCrits ); - Vec_IntClear( vNonCrits ); - Abc_ObjForEachFanout( pObj, pFanout, k ) - if ( Abc_SclObjGetSlack(p, pFanout, p->MaxDelay0) < 100 ) - Vec_IntPush( vCrits, Abc_ObjId(pFanout) ); - else - Vec_IntPush( vNonCrits, Abc_ObjId(pFanout) ); -// assert( Vec_IntSize(vNonCrits) < Abc_ObjFanoutNum(pObj) ); - // skip if there is nothing to split -// if ( Vec_IntSize(vNonCrits) < 2 ) -// continue; - // remember them - vLevel = Vec_WecPushLevel( vSplits ); - Vec_IntPush( vLevel, i ); - Vec_IntAppend( vLevel, vCrits ); - // remember them - vLevel = Vec_WecPushLevel( vSplits ); - Vec_IntPush( vLevel, i ); - Vec_IntAppend( vLevel, vNonCrits ); - } - Vec_IntFree( vCrits ); - Vec_IntFree( vNonCrits ); - // print out - printf( "Collected %d nodes to split.\n", Vec_WecSize(vSplits) ); - return vSplits; -} -void Abc_SclPerformSplit( SC_Man * p, Abc_Ntk_t * pNtk, Vec_Wec_t * vSplits ) -{ - Abc_Obj_t * pObj, * pObjInv, * pFanout; - Vec_Int_t * vLevel; - int i, k; - assert( pNtk->vPhases != NULL ); - Vec_WecForEachLevel( vSplits, vLevel, i ) - { - pObj = Abc_NtkObj( pNtk, Vec_IntEntry(vLevel, 0) ); - pObjInv = Abc_NtkCreateNodeInv( pNtk, pObj ); - Abc_NtkForEachObjVecStart( vLevel, pNtk, pFanout, k, 1 ) - { - Abc_ObjFaninFlipPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) ); - Abc_ObjPatchFanin( pFanout, pObj, pObjInv ); - } - } - Vec_IntFillExtra( pNtk->vPhases, Abc_NtkObjNumMax(pNtk), 0 ); -} -Abc_Ntk_t * Abc_SclBuffSizeStep( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads ) -{ - SC_Man * p; - Vec_Wec_t * vSplits; - p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, nTreeCRatio ); - Abc_SclTimeNtkPrint( p, 0, 0 ); - if ( p->nEstNodes ) - printf( "Estimated nodes = %d.\n", p->nEstNodes ); - vSplits = Abc_SclSelectSplitNodes( p, pNtk ); - Abc_SclPerformSplit( p, pNtk, vSplits ); - Vec_WecFree( vSplits ); - Abc_SclManFree( p ); - return Abc_NtkDupDfs( pNtk ); -} - //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/map/scl/sclSize.h b/src/map/scl/sclSize.h index 1e2899e35..76022448a 100644 --- a/src/map/scl/sclSize.h +++ b/src/map/scl/sclSize.h @@ -571,7 +571,6 @@ extern void Abc_SclTimeIncInsert( SC_Man * p, Abc_Obj_t * pObj ); extern void Abc_SclTimeIncUpdateLevel( Abc_Obj_t * pObj ); extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats ); extern void Abc_SclPrintBuffers( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fVerbose ); -extern int Abc_SclInputDriveOk( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pCell ); /*=== sclUpsize.c ===============================================================*/ extern int Abc_SclCountNearCriticalNodes( SC_Man * p ); extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ); diff --git a/src/map/scl/sclUpsize.c b/src/map/scl/sclUpsize.c index 58c5142cf..fbcaff83a 100644 --- a/src/map/scl/sclUpsize.c +++ b/src/map/scl/sclUpsize.c @@ -291,8 +291,6 @@ int Abc_SclFindBestCell( SC_Man * p, Abc_Obj_t * pObj, Vec_Int_t * vRecalcs, Vec continue; if ( k > Notches ) break; -// if ( p->vInDrive && !Abc_SclInputDriveOk( p, pObj, pCellNew ) ) -// continue; // set new cell Abc_SclObjSetCell( pObj, pCellNew ); Abc_SclUpdateLoad( p, pObj, pCellOld, pCellNew );