aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtlil.cc
diff options
context:
space:
mode:
authorMarcelina Koƛcielnicka <mwk@0x04.net>2020-04-16 21:48:21 +0200
committerMarcelina Koƛcielnicka <mwk@0x04.net>2020-04-21 19:09:00 +0200
commitb4d76309e1e2a264fdac46341548e8d74c552f07 (patch)
tree63351a178816876dd35750ef95285dd3c1f37c22 /kernel/rtlil.cc
parent846c79b312b648b36b5f3b9d563c6c5e252a5411 (diff)
downloadyosys-b4d76309e1e2a264fdac46341548e8d74c552f07.tar.gz
yosys-b4d76309e1e2a264fdac46341548e8d74c552f07.tar.bz2
yosys-b4d76309e1e2a264fdac46341548e8d74c552f07.zip
Use default parameter value in getParam
Fixes #1822.
Diffstat (limited to 'kernel/rtlil.cc')
-rw-r--r--kernel/rtlil.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 0e9347267..2aefe30b1 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -2619,7 +2619,16 @@ void RTLIL::Cell::setParam(RTLIL::IdString paramname, RTLIL::Const value)
const RTLIL::Const &RTLIL::Cell::getParam(RTLIL::IdString paramname) const
{
- return parameters.at(paramname);
+ static const RTLIL::Const empty;
+ const auto &it = parameters.find(paramname);
+ if (it != parameters.end())
+ return it->second;
+ if (module && module->design) {
+ RTLIL::Module *m = module->design->module(type);
+ if (m)
+ return m->parameter_default_values.at(paramname, empty);
+ }
+ return empty;
}
void RTLIL::Cell::sort()