| 627 | } |
| 628 | |
| 629 | void UhdmWriter::writePorts(std::vector<Signal*>& orig_ports, BaseClass* parent, |
| 630 | VectorOfport* dest_ports, VectorOfnet* dest_nets, |
| 631 | Serializer& s, ModPortMap& modPortMap, |
| 632 | SignalBaseClassMap& signalBaseMap, |
| 633 | SignalMap& signalMap, ModuleInstance* instance, |
| 634 | ModuleDefinition* mod) { |
| 635 | int32_t lastPortDirection = vpiInout; |
| 636 | for (Signal* orig_port : orig_ports) { |
| 637 | port* dest_port = s.MakePort(); |
| 638 | signalBaseMap.emplace(orig_port, dest_port); |
| 639 | signalMap.emplace(orig_port->getName(), orig_port); |
| 640 | |
| 641 | if (orig_port->attributes()) { |
| 642 | dest_port->Attributes(orig_port->attributes()); |
| 643 | for (auto ats : *orig_port->attributes()) { |
| 644 | ats->VpiParent(dest_port); |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | const FileContent* fC = orig_port->getFileContent(); |
| 649 | if (fC->Type(orig_port->getNodeId()) == VObjectType::slStringConst) |
| 650 | dest_port->VpiName(orig_port->getName()); |
| 651 | if (orig_port->getDirection() != VObjectType::slNoType) |
| 652 | lastPortDirection = |
| 653 | UhdmWriter::getVpiDirection(orig_port->getDirection()); |
| 654 | dest_port->VpiDirection(lastPortDirection); |
| 655 | orig_port->getFileContent()->populateCoreMembers( |
| 656 | orig_port->getNodeId(), orig_port->getNodeId(), dest_port); |
| 657 | dest_port->VpiParent(parent); |
| 658 | if (ModPort* orig_modport = orig_port->getModPort()) { |
| 659 | ref_obj* ref = s.MakeRef_obj(); |
| 660 | ref->VpiName(orig_port->getName()); |
| 661 | ref->VpiParent(dest_port); |
| 662 | dest_port->Low_conn(ref); |
| 663 | std::map<ModPort*, modport*>::iterator itr = |
| 664 | modPortMap.find(orig_modport); |
| 665 | if (itr != modPortMap.end()) { |
| 666 | ref->Actual_group((*itr).second); |
| 667 | } |
| 668 | } else if (ModuleDefinition* orig_interf = orig_port->getInterfaceDef()) { |
| 669 | ref_obj* ref = s.MakeRef_obj(); |
| 670 | ref->VpiName(orig_port->getName()); |
| 671 | ref->VpiParent(dest_port); |
| 672 | dest_port->Low_conn(ref); |
| 673 | const auto& found = m_componentMap.find(orig_interf); |
| 674 | if (found != m_componentMap.end()) { |
| 675 | ref->Actual_group(found->second); |
| 676 | } |
| 677 | } else if (orig_port->isExplicitlyNamed() && |
| 678 | (fC->Type(orig_port->getPortExpression()) == |
| 679 | VObjectType::slStringConst)) { |
| 680 | ref_obj* ref = s.MakeRef_obj(); |
| 681 | ref->VpiName( |
| 682 | orig_port->getFileContent()->SymName(orig_port->getPortExpression())); |
| 683 | ref->VpiParent(parent); |
| 684 | dest_port->Low_conn(ref); |
| 685 | mod->needLateBinding(ref); |
| 686 | } else if (orig_port->isExplicitlyNamed() && |
nothing calls this directly
no test coverage detected