Guest User

Untitled

a guest
Jun 9th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.13 KB | None | 0 0
  1. diff --git a/passes/cmds/ltp.cc b/passes/cmds/ltp.cc
  2. index 05701710..c9ea9eb9 100644
  3. --- a/passes/cmds/ltp.cc
  4. +++ b/passes/cmds/ltp.cc
  5. @@ -33,12 +33,14 @@ struct LtpWorker
  6.     dict<SigBit, tuple<int, SigBit, Cell*>> bits;
  7.     dict<SigBit, dict<SigBit, Cell*>> bit2bits;
  8.     dict<SigBit, tuple<SigBit, Cell*>> bit2ff;
  9. +   dict<int, int> histo;
  10.  
  11. +   bool stat;
  12.     int maxlvl;
  13.     SigBit maxbit;
  14.     pool<SigBit> busy;
  15.  
  16. -   LtpWorker(RTLIL::Module *module, bool noff) : design(module->design), module(module), sigmap(module)
  17. +   LtpWorker(RTLIL::Module *module, bool noff, bool stat) : design(module->design), module(module), sigmap(module), stat(stat)
  18.     {
  19.         CellTypes ff_celltypes;
  20.  
  21. @@ -101,11 +103,14 @@ struct LtpWorker
  22.         if (level > maxlvl) {
  23.             maxlvl = level;
  24.             maxbit = bit;
  25. +           histo[level] = 0;
  26.         }
  27.  
  28.         if (bit2bits.count(bit)) {
  29.             for (auto &it : bit2bits.at(bit))
  30.                 runner(it.first, level+1, bit, it.second);
  31. +       } else {
  32. +           histo[level]++;
  33.         }
  34.  
  35.         busy.erase(bit);
  36. @@ -136,6 +141,13 @@ struct LtpWorker
  37.  
  38.         if (bit2ff.count(maxbit))
  39.             log("%5s: %s (via %s)\n", "ff", log_signal(get<0>(bit2ff.at(maxbit))), log_id(get<1>(bit2ff.at(maxbit))));
  40. +
  41. +       if (stat) {
  42. +           log("\n");
  43. +           log("Paths length distribution:\n");
  44. +           for (int i=0; i<=maxlvl; i++)
  45. +               log(" %2d: %5d\n", i, histo[i]);
  46. +       }
  47.     }
  48.  };
  49.  
  50. @@ -152,11 +164,14 @@ struct LtpPass : public Pass {
  51.         log("\n");
  52.         log("    -noff\n");
  53.         log("        automatically exclude FF cell types\n");
  54. +       log("    -stat\n");
  55. +       log("        Show stats about all paths\n");
  56.         log("\n");
  57.     }
  58.     void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
  59.     {
  60.         bool noff = false;
  61. +       bool stat = false;
  62.  
  63.         log_header(design, "Executing LTP pass (find longest path).\n");
  64.  
  65. @@ -165,6 +180,9 @@ struct LtpPass : public Pass {
  66.             if (args[argidx] == "-noff") {
  67.                 noff = true;
  68.                 continue;
  69. +           } else if (args[argidx] == "-stat") {
  70. +               stat = true;
  71. +               continue;
  72.             }
  73.             break;
  74.         }
  75. @@ -176,7 +194,7 @@ struct LtpPass : public Pass {
  76.             if (module->has_processes_warn())
  77.                 continue;
  78.  
  79. -           LtpWorker worker(module, noff);
  80. +           LtpWorker worker(module, noff, stat);
  81.             worker.run();
  82.         }
  83.     }
Add Comment
Please, Sign In to add comment