aboutsummaryrefslogtreecommitdiffstats
path: root/passes/cmds/design.cc
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-04-06 10:39:26 +0000
committerGitHub <noreply@github.com>2020-04-06 10:39:26 +0000
commit0d69d532e0b6c4294614d81ca534cb2ff3438c1c (patch)
tree657d1d72aaac4e709dbd7b8c51ad00f70bc83da4 /passes/cmds/design.cc
parentdf69febb1e8293d9234e1dc3b6be874cbb44fe3e (diff)
parenta0416fe1675665f10aa4379a750e0527494e6b74 (diff)
downloadyosys-0d69d532e0b6c4294614d81ca534cb2ff3438c1c.tar.gz
yosys-0d69d532e0b6c4294614d81ca534cb2ff3438c1c.tar.bz2
yosys-0d69d532e0b6c4294614d81ca534cb2ff3438c1c.zip
Merge pull request #1859 from boqwxp/design_duplicate
Add `-push-copy` option to the `design` command.
Diffstat (limited to 'passes/cmds/design.cc')
-rw-r--r--passes/cmds/design.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/passes/cmds/design.cc b/passes/cmds/design.cc
index 4fd43329f..4612760cc 100644
--- a/passes/cmds/design.cc
+++ b/passes/cmds/design.cc
@@ -60,6 +60,11 @@ struct DesignPass : public Pass {
log("Push the current design to the stack and then clear the current design.\n");
log("\n");
log("\n");
+ log(" design -push-copy\n");
+ log("\n");
+ log("Push the current design to the stack without clearing the current design.\n");
+ log("\n");
+ log("\n");
log(" design -pop\n");
log("\n");
log("Reset the current design and pop the last design from the stack.\n");
@@ -101,6 +106,7 @@ struct DesignPass : public Pass {
bool reset_mode = false;
bool reset_vlog_mode = false;
bool push_mode = false;
+ bool push_copy_mode = false;
bool pop_mode = false;
bool import_mode = false;
RTLIL::Design *copy_from_design = NULL, *copy_to_design = NULL;
@@ -126,6 +132,11 @@ struct DesignPass : public Pass {
push_mode = true;
continue;
}
+ if (!got_mode && args[argidx] == "-push-copy") {
+ got_mode = true;
+ push_copy_mode = true;
+ continue;
+ }
if (!got_mode && args[argidx] == "-pop") {
got_mode = true;
pop_mode = true;
@@ -307,7 +318,7 @@ struct DesignPass : public Pass {
}
}
- if (!save_name.empty() || push_mode)
+ if (!save_name.empty() || push_mode || push_copy_mode)
{
RTLIL::Design *design_copy = new RTLIL::Design;
@@ -321,7 +332,7 @@ struct DesignPass : public Pass {
if (saved_designs.count(save_name))
delete saved_designs.at(save_name);
- if (push_mode)
+ if (push_mode || push_copy_mode)
pushed_designs.push_back(design_copy);
else
saved_designs[save_name] = design_copy;