Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/passes/cmds/ltp.cc b/passes/cmds/ltp.cc
- index 05701710..c9ea9eb9 100644
- --- a/passes/cmds/ltp.cc
- +++ b/passes/cmds/ltp.cc
- @@ -33,12 +33,14 @@ struct LtpWorker
- dict<SigBit, tuple<int, SigBit, Cell*>> bits;
- dict<SigBit, dict<SigBit, Cell*>> bit2bits;
- dict<SigBit, tuple<SigBit, Cell*>> bit2ff;
- + dict<int, int> histo;
- + bool stat;
- int maxlvl;
- SigBit maxbit;
- pool<SigBit> busy;
- - LtpWorker(RTLIL::Module *module, bool noff) : design(module->design), module(module), sigmap(module)
- + LtpWorker(RTLIL::Module *module, bool noff, bool stat) : design(module->design), module(module), sigmap(module), stat(stat)
- {
- CellTypes ff_celltypes;
- @@ -101,11 +103,14 @@ struct LtpWorker
- if (level > maxlvl) {
- maxlvl = level;
- maxbit = bit;
- + histo[level] = 0;
- }
- if (bit2bits.count(bit)) {
- for (auto &it : bit2bits.at(bit))
- runner(it.first, level+1, bit, it.second);
- + } else {
- + histo[level]++;
- }
- busy.erase(bit);
- @@ -136,6 +141,13 @@ struct LtpWorker
- if (bit2ff.count(maxbit))
- log("%5s: %s (via %s)\n", "ff", log_signal(get<0>(bit2ff.at(maxbit))), log_id(get<1>(bit2ff.at(maxbit))));
- +
- + if (stat) {
- + log("\n");
- + log("Paths length distribution:\n");
- + for (int i=0; i<=maxlvl; i++)
- + log(" %2d: %5d\n", i, histo[i]);
- + }
- }
- };
- @@ -152,11 +164,14 @@ struct LtpPass : public Pass {
- log("\n");
- log(" -noff\n");
- log(" automatically exclude FF cell types\n");
- + log(" -stat\n");
- + log(" Show stats about all paths\n");
- log("\n");
- }
- void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
- {
- bool noff = false;
- + bool stat = false;
- log_header(design, "Executing LTP pass (find longest path).\n");
- @@ -165,6 +180,9 @@ struct LtpPass : public Pass {
- if (args[argidx] == "-noff") {
- noff = true;
- continue;
- + } else if (args[argidx] == "-stat") {
- + stat = true;
- + continue;
- }
- break;
- }
- @@ -176,7 +194,7 @@ struct LtpPass : public Pass {
- if (module->has_processes_warn())
- continue;
- - LtpWorker worker(module, noff);
- + LtpWorker worker(module, noff, stat);
- worker.run();
- }
- }
Add Comment
Please, Sign In to add comment