From 7aa3fdab806c7df29345da5f0f2319edca35ca28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 16 Oct 2024 11:43:26 +0200 Subject: [PATCH 1/2] select: Add `-list-mod` option --- passes/cmds/select.cc | 12 +++++++++--- tests/select/list_mod.ys | 13 +++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 tests/select/list_mod.ys diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index ff72724aeae..aec4c964b28 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1041,7 +1041,7 @@ struct SelectPass : public Pass { log(" select [ -add | -del | -set ] {-read | }\n"); log(" select [ -unset ]\n"); log(" select [ ] {-read | }\n"); - log(" select [ -list | -write | -count | -clear ]\n"); + log(" select [ -list | -list-mod | -write | -count | -clear ]\n"); log(" select -module \n"); log("\n"); log("Most commands use the list of currently selected objects to determine which part\n"); @@ -1277,6 +1277,7 @@ struct SelectPass : public Pass { bool clear_mode = false; bool none_mode = false; bool list_mode = false; + bool list_mod_mode = false; bool count_mode = false; bool got_module = false; bool assert_none = false; @@ -1338,6 +1339,11 @@ struct SelectPass : public Pass { list_mode = true; continue; } + if (arg == "-list-mod") { + list_mode = true; + list_mod_mode = true; + continue; + } if (arg == "-write" && argidx+1 < args.size()) { write_file = args[++argidx]; continue; @@ -1416,7 +1422,7 @@ struct SelectPass : public Pass { log_cmd_error("Options %s can not be combined.\n", common_flagset); if ((list_mode || !write_file.empty() || count_mode) && common_flagset_tally) - log_cmd_error("Options -list, -write and -count can not be combined with %s.\n", common_flagset); + log_cmd_error("Options -list, -list-mod, -write and -count can not be combined with %s.\n", common_flagset); if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || !unset_name.empty() || common_flagset_tally)) log_cmd_error("Option -set can not be combined with -list, -write, -count, -unset, %s.\n", common_flagset); @@ -1467,7 +1473,7 @@ struct SelectPass : public Pass { { if (sel->selected_whole_module(mod->name) && list_mode) log("%s\n", id2cstr(mod->name)); - if (sel->selected_module(mod->name)) { + if (sel->selected_module(mod->name) && !list_mod_mode) { for (auto wire : mod->wires()) if (sel->selected_member(mod->name, wire->name)) LOG_OBJECT("%s/%s\n", id2cstr(mod->name), id2cstr(wire->name)) diff --git a/tests/select/list_mod.ys b/tests/select/list_mod.ys new file mode 100644 index 00000000000..c8a3ac8b5eb --- /dev/null +++ b/tests/select/list_mod.ys @@ -0,0 +1,13 @@ +read_verilog < Date: Mon, 4 Nov 2024 13:16:40 +0100 Subject: [PATCH 2/2] logger: Adjust print --- passes/cmds/logger.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/passes/cmds/logger.cc b/passes/cmds/logger.cc index 9e45e86afd6..3277e16089b 100644 --- a/passes/cmds/logger.cc +++ b/passes/cmds/logger.cc @@ -162,7 +162,8 @@ struct LoggerPass : public Pass { log_cmd_error("Number of expected messages must be higher then 0 !\n"); if (type=="error" && count!=1) log_cmd_error("Expected error message occurrences must be 1 !\n"); - log("Added regex '%s' for warnings to expected %s list.\n", pattern.c_str(), type.c_str()); + log("Added regex '%s' to expected %s messages list.\n", + pattern.c_str(), type.c_str()); try { if (type == "error") log_expect_error[pattern] = LogExpectedItem(YS_REGEX_COMPILE(pattern), count);