From e35032f2f6b8cb2b809ad46ea99d60c84d1a4d24 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Mon, 10 Mar 2025 09:27:27 -0700 Subject: [PATCH 1/3] write_verilog -onlysrcattr option --- backends/verilog/verilog_backend.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index 9a86bed25..28bc902bd 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -36,7 +36,7 @@ USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN -bool verbose, norename, noattr, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs, noparallelcase; +bool verbose, norename, noattr, srcattronly, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs, noparallelcase; int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter; dict auto_name_map; std::set reg_wires; @@ -400,6 +400,7 @@ void dump_attributes(std::ostream &f, std::string indent, dictfirst == ID::init && regattr) continue; + if (srcattronly && it->first != ID::src) continue; f << stringf("%s" "%s %s", indent.c_str(), as_comment ? "/*" : "(*", id(it->first).c_str()); f << stringf(" = "); if (modattr && (it->second == State::S0 || it->second == Const(0))) @@ -2419,6 +2420,8 @@ struct VerilogBackend : public Backend { log("\n"); log(" -noattr\n"); log(" with this option no attributes are included in the output\n"); + log(" -onlysrcattr\n"); + log(" with this option only src attributes are included in the output\n"); log("\n"); log(" -attr2comment\n"); log(" with this option attributes are included as comments in the output\n"); @@ -2497,6 +2500,7 @@ struct VerilogBackend : public Backend { verbose = false; norename = false; noattr = false; + srcattronly = false; attr2comment = false; noexpr = false; nodec = false; @@ -2535,6 +2539,10 @@ struct VerilogBackend : public Backend { noattr = true; continue; } + if (arg == "-srcattronly") { + srcattronly = true; + continue; + } if (arg == "-attr2comment") { attr2comment = true; continue; From 1b1882fe56def37ef04d6cc8df82a49cc10b7d3c Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Mon, 10 Mar 2025 09:29:48 -0700 Subject: [PATCH 2/3] write_verilog -srcattronly option --- backends/verilog/verilog_backend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index 28bc902bd..8efc443df 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -2420,7 +2420,7 @@ struct VerilogBackend : public Backend { log("\n"); log(" -noattr\n"); log(" with this option no attributes are included in the output\n"); - log(" -onlysrcattr\n"); + log(" -srcattronly\n"); log(" with this option only src attributes are included in the output\n"); log("\n"); log(" -attr2comment\n"); From 268459e00a8c9c3758c5dad2e8f795f015a61d81 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Mon, 10 Mar 2025 10:15:24 -0700 Subject: [PATCH 3/3] write_verilog -srcattronly option --- backends/verilog/verilog_backend.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index 8efc443df..0dfd4d96b 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -2420,6 +2420,7 @@ struct VerilogBackend : public Backend { log("\n"); log(" -noattr\n"); log(" with this option no attributes are included in the output\n"); + log("\n"); log(" -srcattronly\n"); log(" with this option only src attributes are included in the output\n"); log("\n");