| 130 | } |
| 131 | |
| 132 | Value* ModuleInstance::getValue(std::string_view name, |
| 133 | ExprBuilder& exprBuilder) const { |
| 134 | Value* sval = nullptr; |
| 135 | |
| 136 | if (ValuedComponentI::getComplexValue( |
| 137 | name)) { // Only check current instance level |
| 138 | return nullptr; |
| 139 | } |
| 140 | |
| 141 | ModuleInstance* instance = (ModuleInstance*)this; |
| 142 | while (instance) { |
| 143 | if (instance->m_netlist) { |
| 144 | UHDM::VectorOfparam_assign* param_assigns = |
| 145 | instance->m_netlist->param_assigns(); |
| 146 | if (param_assigns) { |
| 147 | std::set<std::string> visited; |
| 148 | const UHDM::constant* res = |
| 149 | resolveFromParamAssign(param_assigns, visited, name); |
| 150 | if (res) { |
| 151 | sval = exprBuilder.fromVpiValue(res->VpiValue(), res->VpiSize()); |
| 152 | break; |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | if (instance->getType() != VObjectType::paModule_instantiation) |
| 158 | instance = instance->getParent(); |
| 159 | else |
| 160 | instance = nullptr; |
| 161 | } |
| 162 | |
| 163 | if (sval == nullptr) { |
| 164 | sval = ValuedComponentI::getValue(name); |
| 165 | } |
| 166 | |
| 167 | if (m_definition && (sval == nullptr)) { |
| 168 | UHDM::VectorOfparam_assign* param_assigns = |
| 169 | m_definition->getParam_assigns(); |
| 170 | if (param_assigns) { |
| 171 | std::set<std::string> visited; |
| 172 | const UHDM::constant* res = |
| 173 | resolveFromParamAssign(param_assigns, visited, name); |
| 174 | if (res) { |
| 175 | sval = exprBuilder.fromVpiValue(res->VpiValue(), res->VpiSize()); |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | return sval; |
| 181 | } |
| 182 | |
| 183 | ModuleInstance* ModuleInstance::getChildByName(std::string_view name) { |
| 184 | for (auto child : m_allSubInstances) { |
nothing calls this directly
no test coverage detected