From 0d8447895cb150aa70a4201c13aa2605b9e22785 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Wed, 25 Oct 2023 17:12:01 -0700 Subject: [PATCH] Repair -lowmem in read_systemverilog yosys command --- src/CommandLine/CommandLineParser.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/CommandLine/CommandLineParser.cpp b/src/CommandLine/CommandLineParser.cpp index 452c417139..b4bb508aba 100644 --- a/src/CommandLine/CommandLineParser.cpp +++ b/src/CommandLine/CommandLineParser.cpp @@ -754,8 +754,18 @@ void CommandLineParser::processOutputDirectory_( bool CommandLineParser::parseCommandLine(int32_t argc, const char** argv) { FileSystem* const fileSystem = FileSystem::getInstance(); - m_programId = fileSystem->getProgramFile(argv[0], m_symbolTable); - + std::string pname = argv[0]; + if (pname == "read_systemverilog") { + // When surelog is embedded as a plugin in yosys, the program name is + // "read_systemverilog", which breaks the -lowmem option + pname = "surelog"; + std::filesystem::path programPath = fileSystem->getProgramPath(); + programPath = programPath.parent_path(); + programPath = programPath / pname; + m_programId = fileSystem->toPathId(programPath.c_str(), m_symbolTable); + } else { + m_programId = fileSystem->getProgramFile(pname, m_symbolTable); + } std::vector cmd_line; for (int32_t i = 1; i < argc; i++) { cmd_line.emplace_back(undecorateArg(argv[i]));