From cdb58f68ab180deea6d13caa131aa0ea62cb2a8a Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 11 Jul 2016 11:40:55 +0200 Subject: [PATCH] Added "prep -auto-top" and "synth -auto-top" --- techlibs/common/prep.cc | 15 ++++++++++++--- techlibs/common/synth.cc | 14 +++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/techlibs/common/prep.cc b/techlibs/common/prep.cc index 9f8f6b313..ac1d98fde 100644 --- a/techlibs/common/prep.cc +++ b/techlibs/common/prep.cc @@ -42,6 +42,9 @@ struct PrepPass : public ScriptPass log(" -top \n"); log(" use the specified module as top module (default='top')\n"); log("\n"); + log(" -auto-top\n"); + log(" automatically determine the top of the design hierarchy\n"); + log("\n"); log(" -flatten\n"); log(" flatten the design before synthesis. this will pass '-auto-top' to\n"); log(" 'hierarchy' if no top module is specified.\n"); @@ -65,12 +68,14 @@ struct PrepPass : public ScriptPass } string top_module, fsm_opts, memory_opts; - bool flatten, ifxmode; + bool autotop, flatten, ifxmode; virtual void clear_flags() YS_OVERRIDE { top_module.clear(); memory_opts.clear(); + + autotop = false; flatten = false; ifxmode = false; } @@ -97,6 +102,10 @@ struct PrepPass : public ScriptPass } continue; } + if (args[argidx] == "-auto-top") { + autotop = true; + continue; + } if (args[argidx] == "-flatten") { flatten = true; continue; @@ -130,10 +139,10 @@ struct PrepPass : public ScriptPass if (check_label("begin")) { if (help_mode) { - run("hierarchy -check [-top ]"); + run("hierarchy -check [-top | -auto-top]"); } else { if (top_module.empty()) { - if (flatten) + if (flatten || autotop) run("hierarchy -check -auto-top"); else run("hierarchy -check"); diff --git a/techlibs/common/synth.cc b/techlibs/common/synth.cc index 859a6606f..11ebe5339 100644 --- a/techlibs/common/synth.cc +++ b/techlibs/common/synth.cc @@ -41,6 +41,9 @@ struct SynthPass : public ScriptPass log(" -top \n"); log(" use the specified module as top module (default='top')\n"); log("\n"); + log(" -auto-top\n"); + log(" automatically determine the top of the design hierarchy\n"); + log("\n"); log(" -flatten\n"); log(" flatten the design before synthesis. this will pass '-auto-top' to\n"); log(" 'hierarchy' if no top module is specified.\n"); @@ -73,7 +76,7 @@ struct SynthPass : public ScriptPass } string top_module, fsm_opts, memory_opts; - bool flatten, noalumacc, nofsm, noabc; + bool autotop, flatten, noalumacc, nofsm, noabc; virtual void clear_flags() YS_OVERRIDE { @@ -81,6 +84,7 @@ struct SynthPass : public ScriptPass fsm_opts.clear(); memory_opts.clear(); + autotop = false; flatten = false; noalumacc = false; nofsm = false; @@ -114,6 +118,10 @@ struct SynthPass : public ScriptPass } continue; } + if (args[argidx] == "-auto-top") { + autotop = true; + continue; + } if (args[argidx] == "-flatten") { flatten = true; continue; @@ -154,10 +162,10 @@ struct SynthPass : public ScriptPass if (check_label("begin")) { if (help_mode) { - run("hierarchy -check [-top ]"); + run("hierarchy -check [-top | -auto-top]"); } else { if (top_module.empty()) { - if (flatten) + if (flatten || autotop) run("hierarchy -check -auto-top"); else run("hierarchy -check"); -- 2.30.2