| 288 | } |
| 289 | |
| 290 | ModuleInstance* Design::findInstance_(const std::vector<std::string>& path, |
| 291 | ModuleInstance* scope) const { |
| 292 | if (path.empty()) return nullptr; |
| 293 | if (scope == nullptr) return nullptr; |
| 294 | if (path.size() == 1) { |
| 295 | if (scope->getInstanceName() == path[0]) { |
| 296 | return scope; |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | for (uint32_t i = 0; i < scope->getNbChildren(); i++) { |
| 301 | ModuleInstance* child = scope->getChildren(i); |
| 302 | if (path.empty()) continue; |
| 303 | if (child->getInstanceName() == path[0]) { |
| 304 | if (path.size() == 1) { |
| 305 | return child; |
| 306 | } else { |
| 307 | std::vector<std::string> subpath = path; |
| 308 | subpath.erase(subpath.begin()); |
| 309 | ModuleInstance* res = findInstance(subpath, child); |
| 310 | if (res) return res; |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | return nullptr; |
| 315 | } |
| 316 | |
| 317 | DefParam* Design::getDefParam(std::string_view name) const { |
| 318 | std::vector<std::string> vpath; |
nothing calls this directly
no test coverage detected