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

Method writeNets

src/DesignCompile/UhdmWriter.cpp:812–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812void UhdmWriter::writeNets(DesignComponent* mod,
813 std::vector<Signal*>& orig_nets, BaseClass* parent,
814 VectorOfnet* dest_nets, Serializer& s,
815 SignalBaseClassMap& signalBaseMap,
816 SignalMap& signalMap, SignalMap& portMap,
817 ModuleInstance* instance /* = nullptr */) {
818 for (auto& orig_net : orig_nets) {
819 net* dest_net = nullptr;
820 if (instance) {
821 for (net* net : *instance->getNetlist()->nets()) {
822 UhdmWriter::SignalMap::iterator itr = signalMap.find(net->VpiName());
823 if (itr == signalMap.end()) {
824 if (net->VpiName() == orig_net->getName()) {
825 dest_net = net;
826 break;
827 }
828 }
829 }
830 } else {
831 dest_net = s.MakeLogic_net();
832 }
833 if (dest_net) {
834 const FileContent* fC = orig_net->getFileContent();
835 if (fC->Type(orig_net->getNodeId()) == VObjectType::slStringConst) {
836 auto portItr = portMap.find(orig_net->getName());
837 if (portItr != portMap.end()) {
838 Signal* sig = (*portItr).second;
839 if (sig) {
840 UhdmWriter::SignalBaseClassMap::iterator itr =
841 signalBaseMap.find(sig);
842 if (itr != signalBaseMap.end()) {
843 port* p = (port*)((*itr).second);
844 NodeId nodeId = orig_net->getNodeId();
845 if (p->Low_conn() == nullptr) {
846 ref_obj* ref = s.MakeRef_obj();
847 ref->VpiName(p->VpiName());
848 ref->Actual_group(dest_net);
849 ref->VpiParent(p);
850 p->Low_conn(ref);
851 fC->populateCoreMembers(nodeId, nodeId, ref);
852 } else if (p->Low_conn()->UhdmType() == uhdmref_obj) {
853 if (!sig->isExplicitlyNamed()) {
854 ref_obj* ref = (ref_obj*)p->Low_conn();
855 ref->VpiName(p->VpiName());
856 if (ref->VpiLineNo() == 0) {
857 fC->populateCoreMembers(nodeId, nodeId, ref);
858 }
859 if (ref->Actual_group() == nullptr) {
860 ref->Actual_group(dest_net);
861 }
862 ref->VpiParent(p);
863 }
864 }
865 }
866 }
867 } else if (dest_net->Typespec() == nullptr) {
868 // compileTypespec function need to account for range
869 // location information if there is any in the typespec.

Callers

nothing calls this directly

Calls 15

netsMethod · 0.80
populateCoreMembersMethod · 0.80
isExplicitlyNamedMethod · 0.80
getTypeSpecIdMethod · 0.80
compileTypespecMethod · 0.80
getUnpackedDimensionMethod · 0.80
getPackedDimensionMethod · 0.80
attributesMethod · 0.80
getNetlistMethod · 0.45
getNameMethod · 0.45
getFileContentMethod · 0.45
TypeMethod · 0.45

Tested by

no test coverage detected