| 105 | } |
| 106 | |
| 107 | any *CompileHelper::getObject(std::string_view name, DesignComponent *component, |
| 108 | CompileDesign *compileDesign, |
| 109 | ValuedComponentI *instance, const any *pexpr) { |
| 110 | any *result = nullptr; |
| 111 | while (pexpr) { |
| 112 | if (const UHDM::scope *s = any_cast<const scope *>(pexpr)) { |
| 113 | if ((result == nullptr) && s->Variables()) { |
| 114 | for (auto o : *s->Variables()) { |
| 115 | if (o->VpiName() == name) { |
| 116 | result = o; |
| 117 | break; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | if (const UHDM::task_func *s = any_cast<const task_func *>(pexpr)) { |
| 123 | if ((result == nullptr) && s->Io_decls()) { |
| 124 | for (auto o : *s->Io_decls()) { |
| 125 | if (o->VpiName() == name) { |
| 126 | result = o; |
| 127 | break; |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | if (result) break; |
| 133 | pexpr = pexpr->VpiParent(); |
| 134 | } |
| 135 | if ((result == nullptr) && instance) { |
| 136 | if (ModuleInstance *inst = |
| 137 | valuedcomponenti_cast<ModuleInstance *>(instance)) { |
| 138 | while (inst) { |
| 139 | Netlist *netlist = inst->getNetlist(); |
| 140 | if (netlist) { |
| 141 | if ((result == nullptr) && netlist->array_nets()) { |
| 142 | for (auto o : *netlist->array_nets()) { |
| 143 | if (o->VpiName() == name) { |
| 144 | result = o; |
| 145 | break; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | if ((result == nullptr) && netlist->nets()) { |
| 150 | for (auto o : *netlist->nets()) { |
| 151 | if (o->VpiName() == name) { |
| 152 | result = o; |
| 153 | break; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | if ((result == nullptr) && netlist->variables()) { |
| 158 | for (auto o : *netlist->variables()) { |
| 159 | if (o->VpiName() == name) { |
| 160 | result = o; |
| 161 | break; |
| 162 | } |
| 163 | } |
| 164 | } |
no test coverage detected