mirror of
https://github.com/YosysHQ/yosys
synced 2026-06-09 10:31:03 +00:00
verilog_backend: alter only design copy unless -wreck
This commit is contained in:
parent
f785b664af
commit
dcd73b6b03
1 changed files with 30 additions and 2 deletions
|
|
@ -95,7 +95,7 @@ bool VERILOG_BACKEND::id_is_verilog_escaped(const std::string &str) {
|
||||||
|
|
||||||
PRIVATE_NAMESPACE_BEGIN
|
PRIVATE_NAMESPACE_BEGIN
|
||||||
|
|
||||||
bool verbose, norename, noattr, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs, noparallelcase;
|
bool verbose, norename, noattr, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs, noparallelcase, wreck;
|
||||||
int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter;
|
int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter;
|
||||||
dict<RTLIL::IdString, int> auto_name_map;
|
dict<RTLIL::IdString, int> auto_name_map;
|
||||||
std::set<RTLIL::IdString> reg_wires;
|
std::set<RTLIL::IdString> reg_wires;
|
||||||
|
|
@ -2554,6 +2554,10 @@ struct VerilogBackend : public Backend {
|
||||||
log(" only write selected modules. modules must be selected entirely or\n");
|
log(" only write selected modules. modules must be selected entirely or\n");
|
||||||
log(" not at all.\n");
|
log(" not at all.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -wreck\n");
|
||||||
|
log(" wreck your design by running required preparation passes\n");
|
||||||
|
log(" on it, instead of a copy. Used to be the default.\n");
|
||||||
|
log("\n");
|
||||||
log(" -v\n");
|
log(" -v\n");
|
||||||
log(" verbose output (print new names of all renamed wires and cells)\n");
|
log(" verbose output (print new names of all renamed wires and cells)\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
|
@ -2666,6 +2670,10 @@ struct VerilogBackend : public Backend {
|
||||||
verbose = true;
|
verbose = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (arg == "-wreck") {
|
||||||
|
wreck = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
extra_args(f, filename, args, argidx);
|
extra_args(f, filename, args, argidx);
|
||||||
|
|
@ -2676,6 +2684,21 @@ struct VerilogBackend : public Backend {
|
||||||
extmem_prefix = filename.substr(0, filename.rfind('.'));
|
extmem_prefix = filename.substr(0, filename.rfind('.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RTLIL::Design *original_design;
|
||||||
|
if (!wreck) {
|
||||||
|
// FIXME shamefully copied out of design.cc
|
||||||
|
RTLIL::Design * design_copy = new RTLIL::Design;
|
||||||
|
|
||||||
|
for (auto mod : design->modules())
|
||||||
|
design_copy->add(mod->clone());
|
||||||
|
|
||||||
|
design_copy->selection_stack = design->selection_stack;
|
||||||
|
design_copy->selection_vars = design->selection_vars;
|
||||||
|
design_copy->selected_active_module = design->selected_active_module;
|
||||||
|
original_design = design;
|
||||||
|
design = design_copy;
|
||||||
|
}
|
||||||
|
|
||||||
log_push();
|
log_push();
|
||||||
if (!noexpr) {
|
if (!noexpr) {
|
||||||
Pass::call(design, "bmuxmap");
|
Pass::call(design, "bmuxmap");
|
||||||
|
|
@ -2702,6 +2725,11 @@ struct VerilogBackend : public Backend {
|
||||||
dump_module(*f, "", module);
|
dump_module(*f, "", module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wreck) {
|
||||||
|
RTLIL::Design * design_copy = design;
|
||||||
|
design = original_design;
|
||||||
|
delete design_copy;
|
||||||
|
}
|
||||||
auto_name_map.clear();
|
auto_name_map.clear();
|
||||||
reg_wires.clear();
|
reg_wires.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue