From de37070c28c08e1d7a5e18f8c65e4837f51c9e40 Mon Sep 17 00:00:00 2001 From: Gus Smith Date: Wed, 22 Jun 2022 10:57:46 -0700 Subject: [PATCH] Support param. default values in JSON FE and SV BE --- backends/verilog/verilog_backend.cc | 11 +++++++++++ frontends/json/jsonparse.cc | 3 +++ 2 files changed, 14 insertions(+) diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index aa1d4558c..28cbb4f4d 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -395,6 +395,14 @@ void dump_attributes(std::ostream &f, std::string indent, dictattributes, '\n', /*modattr=*/false, /*regattr=*/reg_wires.count(wire->name)); @@ -2084,6 +2092,9 @@ void dump_module(std::ostream &f, std::string indent, RTLIL::Module *module) f << indent + " " << "reg " << id(initial_id) << " = 0;\n"; } + for (auto p : module->parameter_default_values) + dump_parameter(f, indent + " ", p.first, p.second); + for (auto w : module->wires()) dump_wire(f, indent + " ", w); diff --git a/frontends/json/jsonparse.cc b/frontends/json/jsonparse.cc index 1aab81015..96c2d3d77 100644 --- a/frontends/json/jsonparse.cc +++ b/frontends/json/jsonparse.cc @@ -302,6 +302,9 @@ void json_import(Design *design, string &modname, JsonNode *node) if (node->data_dict.count("attributes")) json_parse_attr_param(module->attributes, node->data_dict.at("attributes")); + if (node->data_dict.count("parameter_default_values")) + json_parse_attr_param(module->parameter_default_values, node->data_dict.at("parameter_default_values")); + dict signal_bits; if (node->data_dict.count("ports"))