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

Method reportInstanceTreeStats

src/Design/Design.cpp:203–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void Design::reportInstanceTreeStats(uint32_t& nbTopLevelModules,
204 uint32_t& maxDepth,
205 uint32_t& numberOfInstances,
206 uint32_t& numberOfLeafInstances,
207 uint32_t& nbUndefinedModules,
208 uint32_t& nbUndefinedInstances) const {
209 nbTopLevelModules = 0;
210 maxDepth = 0;
211 numberOfInstances = 0;
212 numberOfLeafInstances = 0;
213 nbUndefinedModules = 0;
214 nbUndefinedInstances = 0;
215 std::set<std::string_view> undefModules;
216 ModuleInstance* tmp;
217 std::queue<ModuleInstance*> queue;
218 for (auto instance : m_topLevelModuleInstances) {
219 queue.push(instance);
220 nbTopLevelModules++;
221 }
222 while (!queue.empty()) {
223 tmp = queue.front();
224 queue.pop();
225 bool isInstance = false;
226 if (!tmp->getDefinition())
227 isInstance = true;
228 else {
229 isInstance = tmp->getDefinition()->isInstance();
230 }
231
232 if (isInstance) {
233 numberOfInstances++;
234 uint32_t depth = tmp->getDepth();
235 if (depth > maxDepth) {
236 maxDepth = depth;
237 }
238 }
239 if (tmp->getNbChildren()) {
240 for (uint32_t i = 0; i < tmp->getNbChildren(); i++) {
241 queue.push(tmp->getChildren(i));
242 }
243 } else {
244 if (isInstance) numberOfLeafInstances++;
245 }
246 std::string def;
247 if (tmp->getDefinition()) {
248 } else {
249 nbUndefinedInstances++;
250 undefModules.emplace(tmp->getModuleName());
251 }
252 }
253
254 nbUndefinedModules = undefModules.size();
255}
256
257ModuleInstance* Design::findInstance(std::string_view path,
258 ModuleInstance* scope) const {

Callers 1

reportElaboration_Method · 0.80

Calls 6

getDepthMethod · 0.80
getNbChildrenMethod · 0.80
getChildrenMethod · 0.80
getModuleNameMethod · 0.80
getDefinitionMethod · 0.45
isInstanceMethod · 0.45

Tested by

no test coverage detected