aboutsummaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorMiodrag Milanović <mmicko@gmail.com>2021-11-17 13:57:56 +0100
committerGitHub <noreply@github.com>2021-11-17 13:57:56 +0100
commitd0fda4c0ef1446f6d865b30d25a68e721834a4f2 (patch)
treecfd193a711a070bb880535bfb8309489d64aca1d /backends
parent07dde32bf1c507767d3dc3992f5248aa99b0d34d (diff)
parentc081c683a4672aa6b6b35d4cc8142719dacb882c (diff)
downloadyosys-d0fda4c0ef1446f6d865b30d25a68e721834a4f2.tar.gz
yosys-d0fda4c0ef1446f6d865b30d25a68e721834a4f2.tar.bz2
yosys-d0fda4c0ef1446f6d865b30d25a68e721834a4f2.zip
Merge pull request #3080 from YosysHQ/micko/init_wire
Give initial wire unique ID, fixes #2914
Diffstat (limited to 'backends')
-rw-r--r--backends/verilog/verilog_backend.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc
index dc5c188c0..47ef1c479 100644
--- a/backends/verilog/verilog_backend.cc
+++ b/backends/verilog/verilog_backend.cc
@@ -44,6 +44,7 @@ std::string auto_prefix, extmem_prefix;
RTLIL::Module *active_module;
dict<RTLIL::SigBit, RTLIL::State> active_initdata;
SigMap active_sigmap;
+IdString initial_id;
void reset_auto_counter_id(RTLIL::IdString id, bool may_rename)
{
@@ -1943,7 +1944,7 @@ void dump_process(std::ostream &f, std::string indent, RTLIL::Process *proc, boo
f << stringf("%s" "always%s begin\n", indent.c_str(), systemverilog ? "_comb" : " @*");
if (!systemverilog)
- f << indent + " " << "if (" << id("\\initial") << ") begin end\n";
+ f << indent + " " << "if (" << id(initial_id) << ") begin end\n";
dump_case_body(f, indent, &proc->root_case, true);
std::string backup_indent = indent;
@@ -2077,9 +2078,10 @@ void dump_module(std::ostream &f, std::string indent, RTLIL::Module *module)
}
}
f << stringf(");\n");
-
- if (!systemverilog && !module->processes.empty())
- f << indent + " " << "reg " << id("\\initial") << " = 0;\n";
+ if (!systemverilog && !module->processes.empty()) {
+ initial_id = NEW_ID;
+ f << indent + " " << "reg " << id(initial_id) << " = 0;\n";
+ }
for (auto w : module->wires())
dump_wire(f, indent + " ", w);