From 667543de0b2a4103a7bfdaffad980ea86faf8e6b Mon Sep 17 00:00:00 2001 From: Johann Glaser Date: Wed, 5 Feb 2014 15:53:02 +0100 Subject: [PATCH 1/2] improved help for "select" --- passes/cmds/select.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 2561e8f64..bdfa7a64e 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -690,15 +690,18 @@ struct SelectPass : public Pass { log("\n"); log(" -set \n"); log(" do not modify the current selection. instead save the new selection\n"); - log(" under the given name (see @ below).\n"); + log(" under the given name (see @ below). to save the current selection,\n"); + log(" use \"select -set %%\"\n"); log("\n"); log(" -assert-none\n"); - log(" asserts that the given selection is empty. i.e. produce an error if\n"); - log(" any object matching the selection is found.\n"); + log(" do not modify the current selection. instead assert that the given\n"); + log(" selection is empty. i.e. produce an error if any object matching the\n"); + log(" selection is found.\n"); log("\n"); log(" -assert-any\n"); - log(" asserts that the given selection is non-empty. i.e. produce an error\n"); - log(" if no object matching the selection is found.\n"); + log(" do not modify the current selection. instead assert that the given\n"); + log(" selection is non-empty. i.e. produce an error if no object matching\n"); + log(" the selection is found.\n"); log("\n"); log(" -list\n"); log(" list all objects in the current selection\n"); From 3c0b5139a19292b6a3172887b799e15dbe85a086 Mon Sep 17 00:00:00 2001 From: Johann Glaser Date: Wed, 5 Feb 2014 16:03:02 +0100 Subject: [PATCH 2/2] be more verbose for select -assert-any and -assert-none --- passes/cmds/select.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index bdfa7a64e..963b6940f 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -664,6 +664,20 @@ void handle_extra_select_args(Pass *pass, std::vector args, size_t design->selection_stack.push_back(RTLIL::Selection(false)); } +std::string list_nonopt_args(std::vector args) +{ + size_t argidx; + std::string result = ""; + for (argidx = 1; argidx < args.size(); argidx++) + { + std::string arg = args[argidx]; + if (arg.size() > 0 && arg[0] == '-') + continue; + result += arg + " "; + } + return result; +} + struct SelectPass : public Pass { SelectPass() : Pass("select", "modify and view the list of selected objects") { } virtual void help() @@ -1004,7 +1018,7 @@ struct SelectPass : public Pass { if (work_stack.size() == 0) log_cmd_error("No selection to check.\n"); if (!work_stack.back().empty()) - log_error("Assertation failed: selection is not empty.\n"); + log_error("Assertation failed: selection is not empty: %s\n",list_nonopt_args(args).c_str()); return; } @@ -1013,7 +1027,7 @@ struct SelectPass : public Pass { if (work_stack.size() == 0) log_cmd_error("No selection to check.\n"); if (work_stack.back().empty()) - log_error("Assertation failed: selection is empty.\n"); + log_error("Assertation failed: selection is empty: %s\n",list_nonopt_args(args).c_str()); return; }