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

Method collectModuleObjects_

src/DesignCompile/CompileModule.cpp:528–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528bool CompileModule::collectModuleObjects_(CollectType collectType) {
529 std::vector<VObjectType> stopPoints = {
530 VObjectType::paConditional_generate_construct,
531 VObjectType::paGenerate_module_conditional_statement,
532 VObjectType::paLoop_generate_construct,
533 VObjectType::paGenerate_module_loop_statement,
534 VObjectType::paPar_block,
535 VObjectType::paSeq_block,
536 VObjectType::paModule_declaration,
537 VObjectType::paClass_declaration,
538 VObjectType::paFunction_body_declaration,
539 VObjectType::paTask_body_declaration};
540 if (collectType == CollectType::GENERATE_REGIONS) {
541 if (m_instance != nullptr) {
542 stopPoints.push_back(VObjectType::paGenerate_region);
543 }
544 } else {
545 stopPoints.push_back(VObjectType::paGenerate_region);
546 }
547
548 for (uint32_t i = 0; i < m_module->m_fileContents.size(); i++) {
549 const FileContent* fC = m_module->m_fileContents[i];
550 VObject current = fC->Object(m_module->m_nodeIds[i]);
551 NodeId id = current.m_child;
552
553 NodeId endOfBlockId;
554 if (m_module->getGenBlockId()) {
555 id = m_module->getGenBlockId();
556 endOfBlockId = id;
557 while (endOfBlockId) {
558 VObjectType type = fC->Type(endOfBlockId);
559 if (type == VObjectType::paEND) break;
560 if (type == VObjectType::paELSE) break;
561 endOfBlockId = fC->Sibling(endOfBlockId);
562 }
563 if (!endOfBlockId) endOfBlockId = fC->Sibling(m_module->getGenBlockId());
564 }
565 if (!id) id = current.m_sibling;
566 if (!id) return false;
567
568 if (collectType == CollectType::FUNCTION) {
569 // Package imports
570 std::vector<FileCNodeId> pack_imports;
571 // - Local file imports
572 for (auto import : fC->getObjects(VObjectType::paPackage_import_item)) {
573 pack_imports.push_back(import);
574 }
575
576 for (auto pack_import : pack_imports) {
577 const FileContent* pack_fC = pack_import.fC;
578 NodeId pack_id = pack_import.nodeId;
579 m_helper.importPackage(m_module, m_design, pack_fC, pack_id,
580 m_compileDesign);
581 }
582 }
583 NodeId ParameterPortListId;
584 std::stack<NodeId> stack;
585 stack.push(id);

Callers

nothing calls this directly

Calls 15

StrCatFunction · 0.85
ObjectMethod · 0.80
getGenBlockIdMethod · 0.80
importPackageMethod · 0.80
elaborationSystemTaskMethod · 0.80
compileNetDeclarationMethod · 0.80
compileAttributesMethod · 0.80
getContAssignsMethod · 0.80

Tested by

no test coverage detected