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

Method registerFile

src/DesignCompile/UhdmChecker.cpp:72–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70// commented out as it is a work in progress
71
72bool UhdmChecker::registerFile(const FileContent* fC,
73 std::set<std::string_view>& moduleNames) {
74 const VObject& current = fC->Object(NodeId(fC->getSize() - 2));
75 NodeId id = current.m_child;
76 PathId fileId = fC->getFileId();
77 if (!id) id = current.m_sibling;
78 if (!id) return false;
79 std::stack<NodeId> stack;
80 stack.push(id);
81
82 FileNodeCoverMap::iterator fileItr = fileNodeCoverMap.find(fC);
83 if (fileItr == fileNodeCoverMap.end()) {
84 RangesMap uhdmCover;
85 fileNodeCoverMap.emplace(fC, uhdmCover);
86 fileItr = fileNodeCoverMap.find(fC);
87 }
88 RangesMap& uhdmCover = (*fileItr).second;
89 bool skipModule = false;
90 NodeId endModuleNode;
91 while (!stack.empty()) {
92 id = stack.top();
93 stack.pop();
94 const VObject& current = fC->Object(id);
95 bool skip = false;
96 VObjectType type = current.m_type;
97 if (type == VObjectType::paEND) skip = true;
98
99 // Skip macro expansion which resides in another file (header)
100 PathId fid = fC->getFileId(id);
101 if (fid != fileId) {
102 if (current.m_sibling) stack.push(current.m_sibling);
103 continue;
104 }
105
106 if (type == VObjectType::paModule_declaration) {
107 NodeId stId = fC->sl_collect(id, VObjectType::slStringConst,
108 VObjectType::paAttr_spec);
109 if (stId) {
110 std::string name =
111 StrCat(fC->getLibrary()->getName(), "@", fC->SymName(stId));
112 if (moduleNames.find(name) == moduleNames.end()) {
113 skipModule = true;
114 }
115 }
116 endModuleNode = fC->Parent(id);
117 endModuleNode = fC->Sibling(endModuleNode);
118 }
119 if (type == VObjectType::paDescription || type == VObjectType::paENDCASE ||
120 type == VObjectType::paENDTASK || type == VObjectType::paENDFUNCTION ||
121 type == VObjectType::paENDMODULE ||
122 type == VObjectType::paENDINTERFACE ||
123 type == VObjectType::paENDPACKAGE ||
124 type == VObjectType::paENDCLOCKING || type == VObjectType::paENDCLASS ||
125 type == VObjectType::paENDGENERATE ||
126 type == VObjectType::paENDCONFIG ||
127 type == VObjectType::paEndcelldefine_directive ||
128 type == VObjectType::paENDGROUP ||
129 type == VObjectType::paENDPRIMITIVE ||

Callers

nothing calls this directly

Calls 14

StrCatFunction · 0.85
ObjectMethod · 0.80
EndColumnMethod · 0.80
NodeIdClass · 0.50
getSizeMethod · 0.45
getFileIdMethod · 0.45
sl_collectMethod · 0.45
getNameMethod · 0.45
getLibraryMethod · 0.45
SymNameMethod · 0.45
ParentMethod · 0.45
SiblingMethod · 0.45

Tested by

no test coverage detected