MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / findInstance_

Method findInstance_

src/Design/Design.cpp:290–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290ModuleInstance* 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
317DefParam* Design::getDefParam(std::string_view name) const {
318 std::vector<std::string> vpath;

Callers

nothing calls this directly

Calls 3

getInstanceNameMethod · 0.80
getNbChildrenMethod · 0.80
getChildrenMethod · 0.80

Tested by

no test coverage detected