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

Method getObject

src/DesignCompile/CompileExpression.cpp:107–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107any *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 }

Callers 1

restoreErrorsMethod · 0.80

Calls 15

array_netsMethod · 0.80
netsMethod · 0.80
variablesMethod · 0.80
portsMethod · 0.80
param_assignsMethod · 0.80
getUhdmParamAssignMethod · 0.80
getTypeSpecIdMethod · 0.80
getNetlistMethod · 0.45
getComplexValueMethod · 0.45
getTypeMethod · 0.45
getParentMethod · 0.45
getDataTypeMethod · 0.45

Tested by

no test coverage detected