| 4333 | } |
| 4334 | |
| 4335 | void UhdmWriter::writeInstance(ModuleDefinition* mod, ModuleInstance* instance, |
| 4336 | any* m, CompileDesign* compileDesign, |
| 4337 | ModPortMap& modPortMap, InstanceMap& instanceMap, |
| 4338 | ExprBuilder& exprBuilder) { |
| 4339 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 4340 | Serializer& s = compileDesign->getSerializer(); |
| 4341 | VectorOfmodule_inst* subModules = nullptr; |
| 4342 | VectorOfprogram* subPrograms = nullptr; |
| 4343 | VectorOfinterface_inst* subInterfaces = nullptr; |
| 4344 | VectorOfprimitive* subPrimitives = nullptr; |
| 4345 | VectorOfprimitive_array* subPrimitiveArrays = nullptr; |
| 4346 | VectorOfgen_scope_array* subGenScopeArrays = nullptr; |
| 4347 | m_componentMap.emplace(instance, m); |
| 4348 | if (m->UhdmType() == uhdmmodule_inst) { |
| 4349 | writeElabModule(s, instance, (module_inst*)m, exprBuilder); |
| 4350 | } else if (m->UhdmType() == uhdmgen_scope) { |
| 4351 | writeElabGenScope(s, instance, (gen_scope*)m, exprBuilder); |
| 4352 | } else if (m->UhdmType() == uhdminterface_inst) { |
| 4353 | writeElabInterface(s, instance, (interface_inst*)m, exprBuilder); |
| 4354 | } |
| 4355 | Netlist* netlist = instance->getNetlist(); |
| 4356 | if (netlist) { |
| 4357 | if (VectorOfinterface_array* subInterfaceArrays = |
| 4358 | netlist->interface_arrays()) { |
| 4359 | UHDM_OBJECT_TYPE utype = m->UhdmType(); |
| 4360 | if (utype == uhdmmodule_inst) { |
| 4361 | ((module_inst*)m)->Interface_arrays(subInterfaceArrays); |
| 4362 | for (interface_array* array : *subInterfaceArrays) { |
| 4363 | array->VpiParent(m); |
| 4364 | } |
| 4365 | } else if (utype == uhdmgen_scope) { |
| 4366 | ((gen_scope*)m)->Interface_arrays(subInterfaceArrays); |
| 4367 | for (interface_array* array : *subInterfaceArrays) { |
| 4368 | array->VpiParent(m); |
| 4369 | } |
| 4370 | } else if (utype == uhdminterface_inst) { |
| 4371 | ((interface_inst*)m)->Interface_arrays(subInterfaceArrays); |
| 4372 | for (interface_array* array : *subInterfaceArrays) { |
| 4373 | array->VpiParent(m); |
| 4374 | } |
| 4375 | } |
| 4376 | } |
| 4377 | if (VectorOfinterface_inst* subInterfaces = netlist->interfaces()) { |
| 4378 | UHDM_OBJECT_TYPE utype = m->UhdmType(); |
| 4379 | if (utype == uhdmmodule_inst) { |
| 4380 | ((module_inst*)m)->Interfaces(subInterfaces); |
| 4381 | for (interface_inst* interf : *subInterfaces) { |
| 4382 | interf->VpiParent(m); |
| 4383 | } |
| 4384 | } else if (utype == uhdmgen_scope) { |
| 4385 | ((gen_scope*)m)->Interfaces(subInterfaces); |
| 4386 | for (interface_inst* interf : *subInterfaces) { |
| 4387 | interf->VpiParent(m); |
| 4388 | } |
| 4389 | } else if (utype == uhdminterface_inst) { |
| 4390 | ((interface_inst*)m)->Interfaces(subInterfaces); |
| 4391 | for (interface_inst* interf : *subInterfaces) { |
| 4392 | interf->VpiParent(m); |
nothing calls this directly
no test coverage detected