Validate parameters only when they are used
authorMiodrag Milanovic <mmicko@gmail.com>
Fri, 25 Sep 2020 09:40:37 +0000 (11:40 +0200)
committerMiodrag Milanovic <mmicko@gmail.com>
Fri, 25 Sep 2020 09:40:37 +0000 (11:40 +0200)
passes/hierarchy/hierarchy.cc

index 90b25949d9e7b4388672270cf835d14a57f17117..225e1feaeabcd9368992429138941e81eede9086 100644 (file)
@@ -765,11 +765,13 @@ struct HierarchyPass : public Pass {
                        top_mod = design->module(top_name);
 
                        dict<RTLIL::IdString, RTLIL::Const> top_parameters;
-                       for (auto &para : parameters) {
-                               SigSpec sig_value;
-                               if (!RTLIL::SigSpec::parse(sig_value, NULL, para.second))
-                                       log_cmd_error("Can't decode value '%s'!\n", para.second.c_str());
-                               top_parameters[RTLIL::escape_id(para.first)] = sig_value.as_const();
+                       if ((top_mod == nullptr && design->module(abstract_id)) || top_mod != nullptr) {
+                               for (auto &para : parameters) {
+                                       SigSpec sig_value;
+                                       if (!RTLIL::SigSpec::parse(sig_value, NULL, para.second))
+                                               log_cmd_error("Can't decode value '%s'!\n", para.second.c_str());
+                                       top_parameters[RTLIL::escape_id(para.first)] = sig_value.as_const();
+                               }
                        }
 
                        if (top_mod == nullptr && design->module(abstract_id))