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

Method write

src/DesignCompile/UhdmWriter.cpp:4712–5231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4710}
4711
4712vpiHandle UhdmWriter::write(PathId uhdmFileId) {
4713 FileSystem* const fileSystem = FileSystem::getInstance();
4714 ModPortMap modPortMap;
4715 InstanceMap instanceMap;
4716 ModuleMap moduleMap;
4717 Serializer& s = m_compileDesign->getSerializer();
4718 ExprBuilder exprBuilder;
4719 exprBuilder.seterrorReporting(
4720 m_compileDesign->getCompiler()->getErrorContainer(),
4721 m_compileDesign->getCompiler()->getSymbolTable());
4722
4723 Location loc(uhdmFileId);
4724 Error err(ErrorDefinition::UHDM_CREATING_MODEL, loc);
4725 m_compileDesign->getCompiler()->getErrorContainer()->addError(err);
4726 m_compileDesign->getCompiler()->getErrorContainer()->printMessages(
4727 m_compileDesign->getCompiler()->getCommandLineParser()->muteStdout());
4728
4729 m_helper.setElabMode(false);
4730
4731 // Compute list of design components that are part of the instance tree
4732 std::set<DesignComponent*> designComponents;
4733 {
4734 std::queue<ModuleInstance*> queue;
4735 for (const auto& pack : m_design->getPackageDefinitions()) {
4736 if (!pack.second->getFileContents().empty()) {
4737 if (pack.second->getFileContents()[0] != nullptr)
4738 designComponents.insert(pack.second);
4739 }
4740 }
4741 for (auto instance : m_design->getTopLevelModuleInstances()) {
4742 queue.push(instance);
4743 }
4744
4745 while (!queue.empty()) {
4746 ModuleInstance* current = queue.front();
4747 DesignComponent* def = current->getDefinition();
4748 queue.pop();
4749 if (current == nullptr) continue;
4750 for (ModuleInstance* sub : current->getAllSubInstances()) {
4751 queue.push(sub);
4752 }
4753 const FileContent* fC = current->getFileContent();
4754 if (fC) {
4755 designComponents.insert(def);
4756 }
4757 }
4758 }
4759
4760 vpiHandle designHandle = nullptr;
4761 std::vector<vpiHandle> designs;
4762 design* d = nullptr;
4763 if (m_design) {
4764 d = s.MakeDesign();
4765 m_uhdmDesign = d;
4766 designHandle = reinterpret_cast<vpiHandle>(new uhdm_handle(uhdmdesign, d));
4767 std::string designName = "unnamed";
4768 auto topLevelModules = m_design->getTopLevelModuleInstances();
4769 if (!topLevelModules.empty()) {

Callers 8

saveContentMethod · 0.80
writeUHDMMethod · 0.80
_write_outputFunction · 0.80
_write_outputFunction · 0.80
_run_oneFunction · 0.80
_extract_workerFunction · 0.80
_write_outputFunction · 0.80
_extract_workerFunction · 0.80

Calls 15

printMessagesMethod · 0.80
muteStdoutMethod · 0.80
setElabModeMethod · 0.80
insertMethod · 0.80
getModuleNameMethod · 0.80
getFileInfoMethod · 0.80
getTask_funcsMethod · 0.80
getParametersMethod · 0.80
getParam_assignsMethod · 0.80
getUhdmInstanceMethod · 0.80
populateCoreMembersMethod · 0.80
getUnElabPackageMethod · 0.80

Tested by

no test coverage detected