| 585 | } |
| 586 | |
| 587 | void DesignElaboration::recurseInstanceLoop_( |
| 588 | std::vector<int32_t>& from, std::vector<int32_t>& to, |
| 589 | std::vector<int32_t>& indexes, uint32_t pos, DesignComponent* def, |
| 590 | const FileContent* fC, NodeId subInstanceId, NodeId paramOverride, |
| 591 | ModuleInstanceFactory* factory, ModuleInstance* parent, Config* config, |
| 592 | std::string instanceName, std::string_view modName, |
| 593 | std::vector<ModuleInstance*>& allSubInstances) { |
| 594 | if (pos == indexes.size()) { |
| 595 | // This is where the real logic goes. |
| 596 | // indexes[i] contain the value of the i-th index. |
| 597 | for (int32_t index : indexes) { |
| 598 | if (!instanceName.empty()) { |
| 599 | if (instanceName[instanceName.size() - 1] == ' ') { |
| 600 | instanceName.erase(instanceName.end() - 1); |
| 601 | } |
| 602 | } |
| 603 | StrAppend(&instanceName, "[", index, "]"); |
| 604 | } |
| 605 | ModuleInstance* child = factory->newModuleInstance( |
| 606 | def, fC, subInstanceId, parent, instanceName, modName); |
| 607 | VObjectType type = fC->Type(subInstanceId); |
| 608 | if (def && (type != VObjectType::paGate_instantiation)) { |
| 609 | for (uint32_t i = 0; i < def->getFileContents().size(); i++) { |
| 610 | elaborateInstance_(def->getFileContents()[i], def->getNodeIds()[i], |
| 611 | paramOverride, factory, child, config, |
| 612 | allSubInstances); |
| 613 | } |
| 614 | } |
| 615 | allSubInstances.push_back(child); |
| 616 | |
| 617 | } else { |
| 618 | for (indexes[pos] = from[pos]; indexes[pos] <= to[pos]; indexes[pos]++) { |
| 619 | // Recurse for the next level |
| 620 | recurseInstanceLoop_(from, to, indexes, pos + 1, def, fC, subInstanceId, |
| 621 | paramOverride, factory, parent, config, instanceName, |
| 622 | modName, allSubInstances); |
| 623 | } |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | ModuleInstance* DesignElaboration::createBindInstance_( |
| 628 | BindStmt* bind, ModuleInstance* parent, ModuleInstanceFactory* factory, |
nothing calls this directly
no test coverage detected