yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SelectPass Struct Reference
+ Inheritance diagram for SelectPass:
+ Collaboration diagram for SelectPass:

Public Member Functions

 SelectPass ()
 
virtual void help ()
 
virtual void execute (std::vector< std::string > args, RTLIL::Design *design)
 
pre_post_exec_state_t pre_execute ()
 
void post_execute (pre_post_exec_state_t state)
 
void cmd_log_args (const std::vector< std::string > &args)
 
void cmd_error (const std::vector< std::string > &args, size_t argidx, std::string msg)
 
void extra_args (std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
 
virtual void run_register ()
 

Static Public Member Functions

static void call (RTLIL::Design *design, std::string command)
 
static void call (RTLIL::Design *design, std::vector< std::string > args)
 
static void call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::string command)
 
static void call_on_selection (RTLIL::Design *design, const RTLIL::Selection &selection, std::vector< std::string > args)
 
static void call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::string command)
 
static void call_on_module (RTLIL::Design *design, RTLIL::Module *module, std::vector< std::string > args)
 
static void init_register ()
 
static void done_register ()
 

Data Fields

std::string pass_name
 
std::string short_help
 
int call_counter
 
int64_t runtime_ns
 
Passnext_queued_pass
 

Detailed Description

Definition at line 828 of file select.cc.

Constructor & Destructor Documentation

SelectPass::SelectPass ( )
inline

Definition at line 829 of file select.cc.

829 : Pass("select", "modify and view the list of selected objects") { }
Pass(std::string name, std::string short_help="** document me **")
Definition: register.cc:40

+ Here is the caller graph for this function:

Member Function Documentation

void Pass::call ( RTLIL::Design design,
std::string  command 
)
staticinherited

Definition at line 146 of file register.cc.

147 {
148  std::vector<std::string> args;
149 
150  std::string cmd_buf = command;
151  std::string tok = next_token(cmd_buf, " \t\r\n");
152 
153  if (tok.empty() || tok[0] == '#')
154  return;
155 
156  if (tok[0] == '!') {
157  cmd_buf = command.substr(command.find('!') + 1);
158  while (!cmd_buf.empty() && (cmd_buf.back() == ' ' || cmd_buf.back() == '\t' ||
159  cmd_buf.back() == '\r' || cmd_buf.back() == '\n'))
160  cmd_buf.resize(cmd_buf.size()-1);
161  log_header("Shell command: %s\n", cmd_buf.c_str());
162  int retCode = run_command(cmd_buf);
163  if (retCode != 0)
164  log_cmd_error("Shell command returned error code %d.\n", retCode);
165  return;
166  }
167 
168  while (!tok.empty()) {
169  if (tok == "#")
170  break;
171  if (tok.back() == ';') {
172  int num_semikolon = 0;
173  while (!tok.empty() && tok.back() == ';')
174  tok.resize(tok.size()-1), num_semikolon++;
175  if (!tok.empty())
176  args.push_back(tok);
177  call(design, args);
178  args.clear();
179  if (num_semikolon == 2)
180  call(design, "clean");
181  if (num_semikolon == 3)
182  call(design, "clean -purge");
183  } else
184  args.push_back(tok);
185  tok = next_token(cmd_buf, " \t\r\n");
186  }
187 
188  call(design, args);
189 }
static std::string next_token(bool pass_newline=false)
Definition: preproc.cc:96
void log_header(const char *format,...)
Definition: log.cc:188
int run_command(const std::string &command, std::function< void(const std::string &)> process_line)
Definition: yosys.cc:195
void log_cmd_error(const char *format,...)
Definition: log.cc:211
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::call ( RTLIL::Design design,
std::vector< std::string >  args 
)
staticinherited

Definition at line 191 of file register.cc.

192 {
193  if (args.size() == 0 || args[0][0] == '#')
194  return;
195 
196  if (echo_mode) {
197  log("%s", create_prompt(design, 0));
198  for (size_t i = 0; i < args.size(); i++)
199  log("%s%s", i ? " " : "", args[i].c_str());
200  log("\n");
201  }
202 
203  if (pass_register.count(args[0]) == 0)
204  log_cmd_error("No such command: %s (type 'help' for a command overview)\n", args[0].c_str());
205 
206  size_t orig_sel_stack_pos = design->selection_stack.size();
207  auto state = pass_register[args[0]]->pre_execute();
208  pass_register[args[0]]->execute(args, design);
209  pass_register[args[0]]->post_execute(state);
210  while (design->selection_stack.size() > orig_sel_stack_pos)
211  design->selection_stack.pop_back();
212 
213  design->check();
214 }
bool echo_mode
Definition: register.cc:30
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
const char * create_prompt(RTLIL::Design *design, int recursion_counter)
Definition: yosys.cc:400
void check()
Definition: rtlil.cc:357
void log_cmd_error(const char *format,...)
Definition: log.cc:211
void log(const char *format,...)
Definition: log.cc:180
std::map< std::string, Pass * > pass_register
Definition: register.cc:35

+ Here is the call graph for this function:

void Pass::call_on_module ( RTLIL::Design design,
RTLIL::Module module,
std::string  command 
)
staticinherited

Definition at line 240 of file register.cc.

241 {
242  std::string backup_selected_active_module = design->selected_active_module;
243  design->selected_active_module = module->name.str();
244  design->selection_stack.push_back(RTLIL::Selection(false));
245  design->selection_stack.back().select(module);
246 
247  Pass::call(design, command);
248 
249  design->selection_stack.pop_back();
250  design->selected_active_module = backup_selected_active_module;
251 }
std::string str() const
Definition: rtlil.h:182
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
RTLIL::IdString name
Definition: rtlil.h:599
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::call_on_module ( RTLIL::Design design,
RTLIL::Module module,
std::vector< std::string >  args 
)
staticinherited

Definition at line 253 of file register.cc.

254 {
255  std::string backup_selected_active_module = design->selected_active_module;
256  design->selected_active_module = module->name.str();
257  design->selection_stack.push_back(RTLIL::Selection(false));
258  design->selection_stack.back().select(module);
259 
260  Pass::call(design, args);
261 
262  design->selection_stack.pop_back();
263  design->selected_active_module = backup_selected_active_module;
264 }
std::string str() const
Definition: rtlil.h:182
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
RTLIL::IdString name
Definition: rtlil.h:599
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

void Pass::call_on_selection ( RTLIL::Design design,
const RTLIL::Selection selection,
std::string  command 
)
staticinherited

Definition at line 216 of file register.cc.

217 {
218  std::string backup_selected_active_module = design->selected_active_module;
219  design->selected_active_module.clear();
220  design->selection_stack.push_back(selection);
221 
222  Pass::call(design, command);
223 
224  design->selection_stack.pop_back();
225  design->selected_active_module = backup_selected_active_module;
226 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

void Pass::call_on_selection ( RTLIL::Design design,
const RTLIL::Selection selection,
std::vector< std::string >  args 
)
staticinherited

Definition at line 228 of file register.cc.

229 {
230  std::string backup_selected_active_module = design->selected_active_module;
231  design->selected_active_module.clear();
232  design->selection_stack.push_back(selection);
233 
234  Pass::call(design, args);
235 
236  design->selection_stack.pop_back();
237  design->selected_active_module = backup_selected_active_module;
238 }
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
std::string selected_active_module
Definition: rtlil.h:511
static void call(RTLIL::Design *design, std::string command)
Definition: register.cc:146

+ Here is the call graph for this function:

void Pass::cmd_error ( const std::vector< std::string > &  args,
size_t  argidx,
std::string  msg 
)
inherited

Definition at line 110 of file register.cc.

111 {
112  std::string command_text;
113  int error_pos = 0;
114 
115  for (size_t i = 0; i < args.size(); i++) {
116  if (i < argidx)
117  error_pos += args[i].size() + 1;
118  command_text = command_text + (command_text.empty() ? "" : " ") + args[i];
119  }
120 
121  log("\nSyntax error in command `%s':\n", command_text.c_str());
122  help();
123 
124  log_cmd_error("Command syntax error: %s\n> %s\n> %*s^\n",
125  msg.c_str(), command_text.c_str(), error_pos, "");
126 }
virtual void help()
Definition: register.cc:93
void log_cmd_error(const char *format,...)
Definition: log.cc:211
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::cmd_log_args ( const std::vector< std::string > &  args)
inherited

Definition at line 100 of file register.cc.

101 {
102  if (args.size() <= 1)
103  return;
104  log("Full command line:");
105  for (size_t i = 0; i < args.size(); i++)
106  log(" %s", args[i].c_str());
107  log("\n");
108 }
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

void Pass::done_register ( )
staticinherited

Definition at line 62 of file register.cc.

63 {
64  frontend_register.clear();
65  pass_register.clear();
66  backend_register.clear();
68 }
std::map< std::string, Frontend * > frontend_register
Definition: register.cc:34
Pass * first_queued_pass
Definition: register.cc:31
#define log_assert(_assert_expr_)
Definition: log.h:85
#define NULL
std::map< std::string, Pass * > pass_register
Definition: register.cc:35
std::map< std::string, Backend * > backend_register
Definition: register.cc:36

+ Here is the caller graph for this function:

virtual void SelectPass::execute ( std::vector< std::string >  args,
RTLIL::Design design 
)
inlinevirtual

Implements Pass.

Definition at line 1024 of file select.cc.

1025  {
1026  bool add_mode = false;
1027  bool del_mode = false;
1028  bool clear_mode = false;
1029  bool none_mode = false;
1030  bool list_mode = false;
1031  bool count_mode = false;
1032  bool got_module = false;
1033  bool assert_none = false;
1034  bool assert_any = false;
1035  int assert_count = -1;
1036  std::string write_file;
1037  std::string set_name;
1038  std::string sel_str;
1039 
1040  work_stack.clear();
1041 
1042  size_t argidx;
1043  for (argidx = 1; argidx < args.size(); argidx++)
1044  {
1045  std::string arg = args[argidx];
1046  if (arg == "-add") {
1047  add_mode = true;
1048  continue;
1049  }
1050  if (arg == "-del") {
1051  del_mode = true;
1052  continue;
1053  }
1054  if (arg == "-assert-none") {
1055  assert_none = true;
1056  continue;
1057  }
1058  if (arg == "-assert-any") {
1059  assert_any = true;
1060  continue;
1061  }
1062  if (arg == "-assert-count" && argidx+1 < args.size()) {
1063  assert_count = atoi(args[++argidx].c_str());
1064  continue;
1065  }
1066  if (arg == "-clear") {
1067  clear_mode = true;
1068  continue;
1069  }
1070  if (arg == "-none") {
1071  none_mode = true;
1072  continue;
1073  }
1074  if (arg == "-list") {
1075  list_mode = true;
1076  continue;
1077  }
1078  if (arg == "-write" && argidx+1 < args.size()) {
1079  write_file = args[++argidx];
1080  continue;
1081  }
1082  if (arg == "-count") {
1083  count_mode = true;
1084  continue;
1085  }
1086  if (arg == "-module" && argidx+1 < args.size()) {
1087  RTLIL::IdString mod_name = RTLIL::escape_id(args[++argidx]);
1088  if (design->modules_.count(mod_name) == 0)
1089  log_cmd_error("No such module: %s\n", id2cstr(mod_name));
1090  design->selected_active_module = mod_name.str();
1091  got_module = true;
1092  continue;
1093  }
1094  if (arg == "-set" && argidx+1 < args.size()) {
1095  set_name = RTLIL::escape_id(args[++argidx]);
1096  continue;
1097  }
1098  if (arg.size() > 0 && arg[0] == '-')
1099  log_cmd_error("Unknown option %s.\n", arg.c_str());
1100  select_stmt(design, arg);
1101  sel_str += " " + arg;
1102  }
1103 
1104  if (clear_mode && args.size() != 2)
1105  log_cmd_error("Option -clear can not be combined with any other options.\n");
1106 
1107  if (none_mode && args.size() != 2)
1108  log_cmd_error("Option -none can not be combined with any other options.\n");
1109 
1110  if (add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) > 1)
1111  log_cmd_error("Options -add, -del, -assert-none, -assert-any or -assert-count can not be combined.\n");
1112 
1113  if ((list_mode || !write_file.empty() || count_mode) && (add_mode || del_mode || assert_none || assert_any || assert_count >= 0))
1114  log_cmd_error("Options -list, -write and -count can not be combined with -add, -del, -assert-none, -assert-any or -assert-count.\n");
1115 
1116  if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || del_mode || assert_none || assert_any || assert_count >= 0))
1117  log_cmd_error("Option -set can not be combined with -list, -write, -count, -add, -del, -assert-none, -assert-any or -assert-count.\n");
1118 
1119  if (work_stack.size() == 0 && got_module) {
1120  RTLIL::Selection sel;
1121  select_filter_active_mod(design, sel);
1122  work_stack.push_back(sel);
1123  }
1124 
1125  while (work_stack.size() > 1) {
1126  select_op_union(design, work_stack.front(), work_stack.back());
1127  work_stack.pop_back();
1128  }
1129 
1130  log_assert(design->selection_stack.size() > 0);
1131 
1132  if (clear_mode) {
1133  design->selection_stack.back() = RTLIL::Selection(true);
1134  design->selected_active_module = std::string();
1135  return;
1136  }
1137 
1138  if (none_mode) {
1139  design->selection_stack.back() = RTLIL::Selection(false);
1140  return;
1141  }
1142 
1143  if (list_mode || count_mode || !write_file.empty())
1144  {
1145  #define LOG_OBJECT(...) { if (list_mode) log(__VA_ARGS__); if (f != NULL) fprintf(f, __VA_ARGS__); total_count++; }
1146  int total_count = 0;
1147  FILE *f = NULL;
1148  if (!write_file.empty()) {
1149  f = fopen(write_file.c_str(), "w");
1150  if (f == NULL)
1151  log_error("Can't open '%s' for writing: %s\n", write_file.c_str(), strerror(errno));
1152  }
1153  RTLIL::Selection *sel = &design->selection_stack.back();
1154  if (work_stack.size() > 0)
1155  sel = &work_stack.back();
1156  sel->optimize(design);
1157  for (auto mod_it : design->modules_)
1158  {
1159  if (sel->selected_whole_module(mod_it.first) && list_mode)
1160  log("%s\n", id2cstr(mod_it.first));
1161  if (sel->selected_module(mod_it.first)) {
1162  for (auto &it : mod_it.second->wires_)
1163  if (sel->selected_member(mod_it.first, it.first))
1164  LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first))
1165  for (auto &it : mod_it.second->memories)
1166  if (sel->selected_member(mod_it.first, it.first))
1167  LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first))
1168  for (auto &it : mod_it.second->cells_)
1169  if (sel->selected_member(mod_it.first, it.first))
1170  LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first))
1171  for (auto &it : mod_it.second->processes)
1172  if (sel->selected_member(mod_it.first, it.first))
1173  LOG_OBJECT("%s/%s\n", id2cstr(mod_it.first), id2cstr(it.first))
1174  }
1175  }
1176  if (count_mode)
1177  log("%d objects.\n", total_count);
1178  if (f != NULL)
1179  fclose(f);
1180  #undef LOG_OBJECT
1181  return;
1182  }
1183 
1184  if (add_mode)
1185  {
1186  if (work_stack.size() == 0)
1187  log_cmd_error("Nothing to add to selection.\n");
1188  select_op_union(design, design->selection_stack.back(), work_stack.back());
1189  design->selection_stack.back().optimize(design);
1190  return;
1191  }
1192 
1193  if (del_mode)
1194  {
1195  if (work_stack.size() == 0)
1196  log_cmd_error("Nothing to delete from selection.\n");
1197  select_op_diff(design, design->selection_stack.back(), work_stack.back());
1198  design->selection_stack.back().optimize(design);
1199  return;
1200  }
1201 
1202  if (assert_none)
1203  {
1204  if (work_stack.size() == 0)
1205  log_cmd_error("No selection to check.\n");
1206  if (!work_stack.back().empty())
1207  log_error("Assertation failed: selection is not empty:%s\n", sel_str.c_str());
1208  return;
1209  }
1210 
1211  if (assert_any)
1212  {
1213  if (work_stack.size() == 0)
1214  log_cmd_error("No selection to check.\n");
1215  if (work_stack.back().empty())
1216  log_error("Assertation failed: selection is empty:%s\n", sel_str.c_str());
1217  return;
1218  }
1219 
1220  if (assert_count >= 0)
1221  {
1222  int total_count = 0;
1223  if (work_stack.size() == 0)
1224  log_cmd_error("No selection to check.\n");
1225  RTLIL::Selection *sel = &work_stack.back();
1226  sel->optimize(design);
1227  for (auto mod_it : design->modules_)
1228  if (sel->selected_module(mod_it.first)) {
1229  for (auto &it : mod_it.second->wires_)
1230  if (sel->selected_member(mod_it.first, it.first))
1231  total_count++;
1232  for (auto &it : mod_it.second->memories)
1233  if (sel->selected_member(mod_it.first, it.first))
1234  total_count++;
1235  for (auto &it : mod_it.second->cells_)
1236  if (sel->selected_member(mod_it.first, it.first))
1237  total_count++;
1238  for (auto &it : mod_it.second->processes)
1239  if (sel->selected_member(mod_it.first, it.first))
1240  total_count++;
1241  }
1242  if (assert_count != total_count)
1243  log_error("Assertation failed: selection contains %d elements instead of the asserted %d:%s\n",
1244  total_count, assert_count, sel_str.c_str());
1245  return;
1246  }
1247 
1248  if (!set_name.empty())
1249  {
1250  if (work_stack.size() == 0)
1251  design->selection_vars[set_name] = RTLIL::Selection(false);
1252  else
1253  design->selection_vars[set_name] = work_stack.back();
1254  return;
1255  }
1256 
1257  if (work_stack.size() == 0) {
1258  RTLIL::Selection &sel = design->selection_stack.back();
1259  if (sel.full_selection)
1260  log("*\n");
1261  for (auto &it : sel.selected_modules)
1262  log("%s\n", id2cstr(it));
1263  for (auto &it : sel.selected_members)
1264  for (auto &it2 : it.second)
1265  log("%s/%s\n", id2cstr(it.first), id2cstr(it2));
1266  return;
1267  }
1268 
1269  design->selection_stack.back() = work_stack.back();
1270  design->selection_stack.back().optimize(design);
1271  }
bool selected_module(RTLIL::IdString mod_name) const
Definition: rtlil.cc:148
std::string str() const
Definition: rtlil.h:182
static void select_filter_active_mod(RTLIL::Design *design, RTLIL::Selection &sel)
Definition: select.cc:538
bool selected_whole_module(RTLIL::IdString mod_name) const
Definition: rtlil.cc:159
std::vector< RTLIL::Selection > selection_stack
Definition: rtlil.h:509
static std::vector< RTLIL::Selection > work_stack
Definition: select.cc:31
bool selected_member(RTLIL::IdString mod_name, RTLIL::IdString memb_name) const
Definition: rtlil.cc:168
std::set< RTLIL::IdString > selected_modules
Definition: rtlil.h:463
std::map< RTLIL::IdString, std::set< RTLIL::IdString > > selected_members
Definition: rtlil.h:464
void log_error(const char *format,...)
Definition: log.cc:204
static std::string escape_id(std::string str)
Definition: rtlil.h:251
std::map< RTLIL::IdString, RTLIL::Selection > selection_vars
Definition: rtlil.h:510
#define log_assert(_assert_expr_)
Definition: log.h:85
static void select_stmt(RTLIL::Design *design, std::string arg)
Definition: select.cc:564
bool full_selection
Definition: rtlil.h:462
static const char * id2cstr(const RTLIL::IdString &str)
Definition: rtlil.h:267
void log_cmd_error(const char *format,...)
Definition: log.cc:211
std::map< RTLIL::IdString, RTLIL::Module * > modules_
Definition: rtlil.h:507
#define LOG_OBJECT(...)
#define NULL
void log(const char *format,...)
Definition: log.cc:180
static void select_op_diff(RTLIL::Design *design, RTLIL::Selection &lhs, const RTLIL::Selection &rhs)
Definition: select.cc:251
void optimize(RTLIL::Design *design)
Definition: rtlil.cc:180
std::string selected_active_module
Definition: rtlil.h:511
static void select_op_union(RTLIL::Design *, RTLIL::Selection &lhs, const RTLIL::Selection &rhs)
Definition: select.cc:229

+ Here is the call graph for this function:

void Pass::extra_args ( std::vector< std::string >  args,
size_t  argidx,
RTLIL::Design design,
bool  select = true 
)
inherited

Definition at line 128 of file register.cc.

129 {
130  for (; argidx < args.size(); argidx++)
131  {
132  std::string arg = args[argidx];
133 
134  if (arg.substr(0, 1) == "-")
135  cmd_error(args, argidx, "Unknown option or option in arguments.");
136 
137  if (!select)
138  cmd_error(args, argidx, "Extra argument.");
139 
140  handle_extra_select_args(this, args, argidx, args.size(), design);
141  break;
142  }
143  // cmd_log_args(args);
144 }
void cmd_error(const std::vector< std::string > &args, size_t argidx, std::string msg)
Definition: register.cc:110
void handle_extra_select_args(Pass *pass, std::vector< std::string > args, size_t argidx, size_t args_size, RTLIL::Design *design)
Definition: select.cc:803

+ Here is the call graph for this function:

virtual void SelectPass::help ( )
inlinevirtual

Reimplemented from Pass.

Definition at line 830 of file select.cc.

831  {
832  // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
833  log("\n");
834  log(" select [ -add | -del | -set <name> ] <selection>\n");
835  log(" select [ -assert-none | -assert-any ] <selection>\n");
836  log(" select [ -list | -write <filename> | -count | -clear ]\n");
837  log(" select -module <modname>\n");
838  log("\n");
839  log("Most commands use the list of currently selected objects to determine which part\n");
840  log("of the design to operate on. This command can be used to modify and view this\n");
841  log("list of selected objects.\n");
842  log("\n");
843  log("Note that many commands support an optional [selection] argument that can be\n");
844  log("used to override the global selection for the command. The syntax of this\n");
845  log("optional argument is identical to the syntax of the <selection> argument\n");
846  log("described here.\n");
847  log("\n");
848  log(" -add, -del\n");
849  log(" add or remove the given objects to the current selection.\n");
850  log(" without this options the current selection is replaced.\n");
851  log("\n");
852  log(" -set <name>\n");
853  log(" do not modify the current selection. instead save the new selection\n");
854  log(" under the given name (see @<name> below). to save the current selection,\n");
855  log(" use \"select -set <name> %%\"\n");
856  log("\n");
857  log(" -assert-none\n");
858  log(" do not modify the current selection. instead assert that the given\n");
859  log(" selection is empty. i.e. produce an error if any object matching the\n");
860  log(" selection is found.\n");
861  log("\n");
862  log(" -assert-any\n");
863  log(" do not modify the current selection. instead assert that the given\n");
864  log(" selection is non-empty. i.e. produce an error if no object matching\n");
865  log(" the selection is found.\n");
866  log("\n");
867  log(" -assert-count N\n");
868  log(" do not modify the current selection. instead assert that the given\n");
869  log(" selection contains exactly N objects.\n");
870  log("\n");
871  log(" -list\n");
872  log(" list all objects in the current selection\n");
873  log("\n");
874  log(" -write <filename>\n");
875  log(" like -list but write the output to the specified file\n");
876  log("\n");
877  log(" -count\n");
878  log(" count all objects in the current selection\n");
879  log("\n");
880  log(" -clear\n");
881  log(" clear the current selection. this effectively selects the whole\n");
882  log(" design. it also resets the selected module (see -module). use the\n");
883  log(" command 'select *' to select everything but stay in the current module.\n");
884  log("\n");
885  log(" -none\n");
886  log(" create an empty selection. the current module is unchanged.\n");
887  log("\n");
888  log(" -module <modname>\n");
889  log(" limit the current scope to the specified module.\n");
890  log(" the difference between this and simply selecting the module\n");
891  log(" is that all object names are interpreted relative to this\n");
892  log(" module after this command until the selection is cleared again.\n");
893  log("\n");
894  log("When this command is called without an argument, the current selection\n");
895  log("is displayed in a compact form (i.e. only the module name when a whole module\n");
896  log("is selected).\n");
897  log("\n");
898  log("The <selection> argument itself is a series of commands for a simple stack\n");
899  log("machine. Each element on the stack represents a set of selected objects.\n");
900  log("After this commands have been executed, the union of all remaining sets\n");
901  log("on the stack is computed and used as selection for the command.\n");
902  log("\n");
903  log("Pushing (selecting) object when not in -module mode:\n");
904  log("\n");
905  log(" <mod_pattern>\n");
906  log(" select the specified module(s)\n");
907  log("\n");
908  log(" <mod_pattern>/<obj_pattern>\n");
909  log(" select the specified object(s) from the module(s)\n");
910  log("\n");
911  log("Pushing (selecting) object when in -module mode:\n");
912  log("\n");
913  log(" <obj_pattern>\n");
914  log(" select the specified object(s) from the current module\n");
915  log("\n");
916  log("A <mod_pattern> can be a module name, wildcard expression (*, ?, [..])\n");
917  log("matching module names, or one of the following:\n");
918  log("\n");
919  log(" A:<pattern>, A:<pattern>=<pattern>\n");
920  log(" all modules with an attribute matching the given pattern\n");
921  log(" in addition to = also <, <=, >=, and > are supported\n");
922  log("\n");
923  log("An <obj_pattern> can be an object name, wildcard expression, or one of\n");
924  log("the following:\n");
925  log("\n");
926  log(" w:<pattern>\n");
927  log(" all wires with a name matching the given wildcard pattern\n");
928  log("\n");
929  log(" i:<pattern>, o:<pattern>, x:<pattern>\n");
930  log(" all inputs (i:), outputs (o:) or any ports (x:) with matching names\n");
931  log("\n");
932  log(" s:<size>, s:<min>:<max>\n");
933  log(" all wires with a matching width\n");
934  log("\n");
935  log(" m:<pattern>\n");
936  log(" all memories with a name matching the given pattern\n");
937  log("\n");
938  log(" c:<pattern>\n");
939  log(" all cells with a name matching the given pattern\n");
940  log("\n");
941  log(" t:<pattern>\n");
942  log(" all cells with a type matching the given pattern\n");
943  log("\n");
944  log(" p:<pattern>\n");
945  log(" all processes with a name matching the given pattern\n");
946  log("\n");
947  log(" a:<pattern>\n");
948  log(" all objects with an attribute name matching the given pattern\n");
949  log("\n");
950  log(" a:<pattern>=<pattern>\n");
951  log(" all objects with a matching attribute name-value-pair.\n");
952  log(" in addition to = also <, <=, >=, and > are supported\n");
953  log("\n");
954  log(" r:<pattern>, r:<pattern>=<pattern>\n");
955  log(" cells with matching parameters. also with <, <=, >= and >.\n");
956  log("\n");
957  log(" n:<pattern>\n");
958  log(" all objects with a name matching the given pattern\n");
959  log(" (i.e. 'n:' is optional as it is the default matching rule)\n");
960  log("\n");
961  log(" @<name>\n");
962  log(" push the selection saved prior with 'select -set <name> ...'\n");
963  log("\n");
964  log("The following actions can be performed on the top sets on the stack:\n");
965  log("\n");
966  log(" %%\n");
967  log(" push a copy of the current selection to the stack\n");
968  log("\n");
969  log(" %%%%\n");
970  log(" replace the stack with a union of all elements on it\n");
971  log("\n");
972  log(" %%n\n");
973  log(" replace top set with its invert\n");
974  log("\n");
975  log(" %%u\n");
976  log(" replace the two top sets on the stack with their union\n");
977  log("\n");
978  log(" %%i\n");
979  log(" replace the two top sets on the stack with their intersection\n");
980  log("\n");
981  log(" %%d\n");
982  log(" pop the top set from the stack and subtract it from the new top\n");
983  log("\n");
984  log(" %%D\n");
985  log(" like %%d but swap the roles of two top sets on the stack\n");
986  log("\n");
987  log(" %%c\n");
988  log(" create a copy of the top set rom the stack and push it\n");
989  log("\n");
990  log(" %%x[<num1>|*][.<num2>][:<rule>[:<rule>..]]\n");
991  log(" expand top set <num1> num times according to the specified rules.\n");
992  log(" (i.e. select all cells connected to selected wires and select all\n");
993  log(" wires connected to selected cells) The rules specify which cell\n");
994  log(" ports to use for this. the syntax for a rule is a '-' for exclusion\n");
995  log(" and a '+' for inclusion, followed by an optional comma separated\n");
996  log(" list of cell types followed by an optional comma separated list of\n");
997  log(" cell ports in square brackets. a rule can also be just a cell or wire\n");
998  log(" name that limits the expansion (is included but does not go beyond).\n");
999  log(" select at most <num2> objects. a warning message is printed when this\n");
1000  log(" limit is reached. When '*' is used instead of <num1> then the process\n");
1001  log(" is repeated until no further object are selected.\n");
1002  log("\n");
1003  log(" %%ci[<num1>|*][.<num2>][:<rule>[:<rule>..]]\n");
1004  log(" %%co[<num1>|*][.<num2>][:<rule>[:<rule>..]]\n");
1005  log(" simmilar to %%x, but only select input (%%ci) or output cones (%%co)\n");
1006  log("\n");
1007  log(" %%a\n");
1008  log(" expand top set by selecting all wires that are (at least in part)\n");
1009  log(" aliases for selected wires.\n");
1010  log("\n");
1011  log(" %%s\n");
1012  log(" expand top set by adding all modules of instantiated cells in selected\n");
1013  log(" modules\n");
1014  log("\n");
1015  log(" %%m\n");
1016  log(" expand top set by selecting all modules that contain selected objects\n");
1017  log("\n");
1018  log("Example: the following command selects all wires that are connected to a\n");
1019  log("'GATE' input of a 'SWITCH' cell:\n");
1020  log("\n");
1021  log(" select */t:SWITCH %%x:+[GATE] */t:SWITCH %%d\n");
1022  log("\n");
1023  }
void log(const char *format,...)
Definition: log.cc:180

+ Here is the call graph for this function:

void Pass::init_register ( )
staticinherited

Definition at line 54 of file register.cc.

55 {
56  while (first_queued_pass) {
59  }
60 }
Pass * first_queued_pass
Definition: register.cc:31
Pass * next_queued_pass
Definition: register.h:60
virtual void run_register()
Definition: register.cc:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::post_execute ( Pass::pre_post_exec_state_t  state)
inherited

Definition at line 84 of file register.cc.

85 {
86  int64_t time_ns = PerformanceTimer::query() - state.begin_ns;
87  runtime_ns += time_ns;
88  current_pass = state.parent_pass;
89  if (current_pass)
90  current_pass->runtime_ns -= time_ns;
91 }
static int64_t query()
Definition: log.h:151
int64_t runtime_ns
Definition: register.h:37
Pass * current_pass
Definition: register.cc:32
Pass * parent_pass
Definition: register.h:40
int64_t begin_ns
Definition: register.h:41

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Pass::pre_post_exec_state_t Pass::pre_execute ( )
inherited

Definition at line 74 of file register.cc.

75 {
76  pre_post_exec_state_t state;
77  call_counter++;
78  state.begin_ns = PerformanceTimer::query();
79  state.parent_pass = current_pass;
80  current_pass = this;
81  return state;
82 }
static int64_t query()
Definition: log.h:151
Pass * current_pass
Definition: register.cc:32
int call_counter
Definition: register.h:36

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Pass::run_register ( )
virtualinherited

Reimplemented in Backend, and Frontend.

Definition at line 48 of file register.cc.

49 {
50  log_assert(pass_register.count(pass_name) == 0);
51  pass_register[pass_name] = this;
52 }
std::string pass_name
Definition: register.h:29
#define log_assert(_assert_expr_)
Definition: log.h:85
std::map< std::string, Pass * > pass_register
Definition: register.cc:35

+ Here is the caller graph for this function:

Field Documentation

int Pass::call_counter
inherited

Definition at line 36 of file register.h.

Pass* Pass::next_queued_pass
inherited

Definition at line 60 of file register.h.

std::string Pass::pass_name
inherited

Definition at line 29 of file register.h.

int64_t Pass::runtime_ns
inherited

Definition at line 37 of file register.h.

std::string Pass::short_help
inherited

Definition at line 29 of file register.h.


The documentation for this struct was generated from the following file: