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

Method writePorts

src/DesignCompile/UhdmWriter.cpp:629–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

627}
628
629void 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() &&

Callers

nothing calls this directly

Calls 15

attributesMethod · 0.80
populateCoreMembersMethod · 0.80
getInterfaceDefMethod · 0.80
isExplicitlyNamedMethod · 0.80
getPortExpressionMethod · 0.80
needLateBindingMethod · 0.80
compileExpressionMethod · 0.80
getDefaultValueMethod · 0.80
getTypeSpecIdMethod · 0.80
getUnpackedDimensionMethod · 0.80
compileRangesMethod · 0.80
compileTypespecMethod · 0.80

Tested by

no test coverage detected