Added select -none

This commit is contained in:
Clifford Wolf 2014-02-04 23:23:44 +01:00
parent e0c867db53
commit b1bf55dd63
1 changed files with 20 additions and 4 deletions

View File

@ -709,8 +709,12 @@ struct SelectPass : public Pass {
log(" count all objects in the current selection\n"); log(" count all objects in the current selection\n");
log("\n"); log("\n");
log(" -clear\n"); log(" -clear\n");
log(" clear the current selection. this effectively selects the\n"); log(" clear the current selection. this effectively selects the whole\n");
log(" whole design.\n"); log(" design. it also resets the selected module (see -module). use the\n");
log(" command 'select *' to select everything but stay in the current module.\n");
log("\n");
log(" -none\n");
log(" create an empty selection. the current module is unchanged.\n");
log("\n"); log("\n");
log(" -module <modname>\n"); log(" -module <modname>\n");
log(" limit the current scope to the specified module.\n"); log(" limit the current scope to the specified module.\n");
@ -825,6 +829,7 @@ struct SelectPass : public Pass {
bool add_mode = false; bool add_mode = false;
bool del_mode = false; bool del_mode = false;
bool clear_mode = false; bool clear_mode = false;
bool none_mode = false;
bool list_mode = false; bool list_mode = false;
bool count_mode = false; bool count_mode = false;
bool got_module = false; bool got_module = false;
@ -859,6 +864,10 @@ struct SelectPass : public Pass {
clear_mode = true; clear_mode = true;
continue; continue;
} }
if (arg == "-none") {
none_mode = true;
continue;
}
if (arg == "-list") { if (arg == "-list") {
list_mode = true; list_mode = true;
continue; continue;
@ -891,6 +900,9 @@ struct SelectPass : public Pass {
if (clear_mode && args.size() != 2) if (clear_mode && args.size() != 2)
log_cmd_error("Option -clear can not be combined with any other options.\n"); log_cmd_error("Option -clear can not be combined with any other options.\n");
if (none_mode && args.size() != 2)
log_cmd_error("Option -none can not be combined with any other options.\n");
if (add_mode + del_mode + assert_none + assert_any > 1) if (add_mode + del_mode + assert_none + assert_any > 1)
log_cmd_error("Options -add, -del, -assert-none or -assert-any can not be combined.\n"); log_cmd_error("Options -add, -del, -assert-none or -assert-any can not be combined.\n");
@ -913,13 +925,17 @@ struct SelectPass : public Pass {
assert(design->selection_stack.size() > 0); assert(design->selection_stack.size() > 0);
if (clear_mode) if (clear_mode) {
{
design->selection_stack.back() = RTLIL::Selection(true); design->selection_stack.back() = RTLIL::Selection(true);
design->selected_active_module = std::string(); design->selected_active_module = std::string();
return; return;
} }
if (none_mode) {
design->selection_stack.back() = RTLIL::Selection(false);
return;
}
if (list_mode || count_mode || !write_file.empty()) if (list_mode || count_mode || !write_file.empty())
{ {
#define LOG_OBJECT(...) do { if (list_mode) log(__VA_ARGS__); if (f != NULL) fprintf(f, __VA_ARGS__); total_count++; } while (0) #define LOG_OBJECT(...) do { if (list_mode) log(__VA_ARGS__); if (f != NULL) fprintf(f, __VA_ARGS__); total_count++; } while (0)