3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-23 04:38:55 +00:00

Use default parameter value in getParam

Fixes #1822.
This commit is contained in:
Marcelina Kościelnicka 2020-04-16 21:48:21 +02:00
parent 846c79b312
commit b4d76309e1
2 changed files with 13 additions and 4 deletions

View file

@ -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()