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

Public Member Functions

 ExposePass ()
 
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 221 of file expose.cc.

Constructor & Destructor Documentation

ExposePass::ExposePass ( )
inline

Definition at line 222 of file expose.cc.

222 : Pass("expose", "convert internal signals to module ports") { }
Pass(std::string name, std::string short_help="** document me **")
Definition: register.cc:40

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 ExposePass::execute ( std::vector< std::string >  args,
RTLIL::Design design 
)
inlinevirtual

Implements Pass.

Definition at line 256 of file expose.cc.

257  {
258  bool flag_shared = false;
259  bool flag_evert = false;
260  bool flag_dff = false;
261  bool flag_cut = false;
262  bool flag_evert_dff = false;
263  std::string sep = ".";
264 
265  log_header("Executing EXPOSE pass (exposing internal signals as outputs).\n");
266 
267  size_t argidx;
268  for (argidx = 1; argidx < args.size(); argidx++)
269  {
270  if (args[argidx] == "-shared") {
271  flag_shared = true;
272  continue;
273  }
274  if (args[argidx] == "-evert") {
275  flag_evert = true;
276  continue;
277  }
278  if (args[argidx] == "-dff") {
279  flag_dff = true;
280  continue;
281  }
282  if (args[argidx] == "-cut") {
283  flag_cut = true;
284  continue;
285  }
286  if (args[argidx] == "-evert-dff") {
287  flag_evert_dff = true;
288  continue;
289  }
290  if (args[argidx] == "-sep" && argidx+1 < args.size()) {
291  sep = args[++argidx];
292  continue;
293  }
294  break;
295  }
296  extra_args(args, argidx, design);
297 
298  CellTypes ct(design);
299 
300  std::map<RTLIL::Module*, std::map<RTLIL::IdString, dff_map_info_t>> dff_dq_maps;
301  std::map<RTLIL::Module*, std::set<RTLIL::IdString>> dff_cells;
302 
303  if (flag_evert_dff)
304  {
305  RTLIL::Module *first_module = NULL;
306  std::set<RTLIL::IdString> shared_dff_wires;
307 
308  for (auto &mod_it : design->modules_)
309  {
310  if (!design->selected(mod_it.second))
311  continue;
312 
313  create_dff_dq_map(dff_dq_maps[mod_it.second], design, mod_it.second);
314 
315  if (!flag_shared)
316  continue;
317 
318  if (first_module == NULL) {
319  for (auto &it : dff_dq_maps[mod_it.second])
320  shared_dff_wires.insert(it.first);
321  first_module = mod_it.second;
322  } else {
323  std::set<RTLIL::IdString> new_shared_dff_wires;
324  for (auto &it : shared_dff_wires) {
325  if (!dff_dq_maps[mod_it.second].count(it))
326  continue;
327  if (!compare_wires(first_module->wires_.at(it), mod_it.second->wires_.at(it)))
328  continue;
329  new_shared_dff_wires.insert(it);
330  }
331  shared_dff_wires.swap(new_shared_dff_wires);
332  }
333  }
334 
335  if (flag_shared)
336  for (auto &map_it : dff_dq_maps)
337  {
338  std::map<RTLIL::IdString, dff_map_info_t> new_map;
339  for (auto &it : map_it.second)
340  if (shared_dff_wires.count(it.first))
341  new_map[it.first] = it.second;
342  map_it.second.swap(new_map);
343  }
344 
345  for (auto &it1 : dff_dq_maps)
346  for (auto &it2 : it1.second)
347  for (auto &it3 : it2.second.cells)
348  dff_cells[it1.first].insert(it3);
349  }
350 
351  std::set<RTLIL::IdString> shared_wires, shared_cells;
352  std::set<RTLIL::IdString> used_names;
353 
354  if (flag_shared)
355  {
356  RTLIL::Module *first_module = NULL;
357 
358  for (auto &mod_it : design->modules_)
359  {
360  RTLIL::Module *module = mod_it.second;
361 
362  if (!design->selected(module))
363  continue;
364 
365  std::set<RTLIL::IdString> dff_wires;
366  if (flag_dff)
367  find_dff_wires(dff_wires, module);
368 
369  if (first_module == NULL)
370  {
371  for (auto &it : module->wires_)
372  if (design->selected(module, it.second) && consider_wire(it.second, dff_dq_maps[module]))
373  if (!flag_dff || dff_wires.count(it.first))
374  shared_wires.insert(it.first);
375 
376  if (flag_evert)
377  for (auto &it : module->cells_)
378  if (design->selected(module, it.second) && consider_cell(design, dff_cells[module], it.second))
379  shared_cells.insert(it.first);
380 
381  first_module = module;
382  }
383  else
384  {
385  std::vector<RTLIL::IdString> delete_shared_wires, delete_shared_cells;
386 
387  for (auto &it : shared_wires)
388  {
389  RTLIL::Wire *wire;
390 
391  if (module->wires_.count(it) == 0)
392  goto delete_shared_wire;
393 
394  wire = module->wires_.at(it);
395 
396  if (!design->selected(module, wire))
397  goto delete_shared_wire;
398  if (!consider_wire(wire, dff_dq_maps[module]))
399  goto delete_shared_wire;
400  if (!compare_wires(first_module->wires_.at(it), wire))
401  goto delete_shared_wire;
402  if (flag_dff && !dff_wires.count(it))
403  goto delete_shared_wire;
404 
405  if (0)
406  delete_shared_wire:
407  delete_shared_wires.push_back(it);
408  }
409 
410  if (flag_evert)
411  for (auto &it : shared_cells)
412  {
413  RTLIL::Cell *cell;
414 
415  if (module->cells_.count(it) == 0)
416  goto delete_shared_cell;
417 
418  cell = module->cells_.at(it);
419 
420  if (!design->selected(module, cell))
421  goto delete_shared_cell;
422  if (!consider_cell(design, dff_cells[module], cell))
423  goto delete_shared_cell;
424  if (!compare_cells(first_module->cells_.at(it), cell))
425  goto delete_shared_cell;
426 
427  if (0)
428  delete_shared_cell:
429  delete_shared_cells.push_back(it);
430  }
431 
432  for (auto &it : delete_shared_wires)
433  shared_wires.erase(it);
434  for (auto &it : delete_shared_cells)
435  shared_cells.erase(it);
436  }
437  }
438  }
439 
440  for (auto &mod_it : design->modules_)
441  {
442  RTLIL::Module *module = mod_it.second;
443 
444  if (!design->selected(module))
445  continue;
446 
447  std::set<RTLIL::IdString> dff_wires;
448  if (flag_dff && !flag_shared)
449  find_dff_wires(dff_wires, module);
450 
451  SigMap sigmap(module);
452 
453  SigMap out_to_in_map;
454 
455  for (auto &it : module->wires_)
456  {
457  if (flag_shared) {
458  if (shared_wires.count(it.first) == 0)
459  continue;
460  } else {
461  if (!design->selected(module, it.second) || !consider_wire(it.second, dff_dq_maps[module]))
462  continue;
463  if (flag_dff && !dff_wires.count(it.first))
464  continue;
465  }
466 
467  if (!it.second->port_output) {
468  it.second->port_output = true;
469  log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(it.second->name));
470  }
471 
472  if (flag_cut) {
473  RTLIL::Wire *in_wire = add_new_wire(module, it.second->name.str() + sep + "i", it.second->width);
474  in_wire->port_input = true;
475  out_to_in_map.add(sigmap(it.second), in_wire);
476  }
477  }
478 
479  if (flag_cut)
480  {
481  for (auto &it : module->cells_) {
482  if (!ct.cell_known(it.second->type))
483  continue;
484  for (auto &conn : it.second->connections_)
485  if (ct.cell_input(it.second->type, conn.first))
486  conn.second = out_to_in_map(sigmap(conn.second));
487  }
488 
489  for (auto &conn : module->connections_)
490  conn.second = out_to_in_map(sigmap(conn.second));
491  }
492 
493  std::set<RTLIL::SigBit> set_q_bits;
494 
495  for (auto &dq : dff_dq_maps[module])
496  {
497  if (!module->wires_.count(dq.first))
498  continue;
499 
500  RTLIL::Wire *wire = module->wires_.at(dq.first);
501  std::set<RTLIL::SigBit> wire_bits_set = sigmap(wire).to_sigbit_set();
502  std::vector<RTLIL::SigBit> wire_bits_vec = sigmap(wire).to_sigbit_vector();
503 
504  dff_map_info_t &info = dq.second;
505 
506  RTLIL::Wire *wire_dummy_q = add_new_wire(module, NEW_ID, 0);
507 
508  for (auto &cell_name : info.cells) {
509  RTLIL::Cell *cell = module->cells_.at(cell_name);
510  std::vector<RTLIL::SigBit> cell_q_bits = sigmap(cell->getPort("\\Q")).to_sigbit_vector();
511  for (auto &bit : cell_q_bits)
512  if (wire_bits_set.count(bit))
513  bit = RTLIL::SigBit(wire_dummy_q, wire_dummy_q->width++);
514  cell->setPort("\\Q", cell_q_bits);
515  }
516 
517  RTLIL::Wire *wire_q = add_new_wire(module, wire->name.str() + sep + "q", wire->width);
518  wire_q->port_input = true;
519  log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_q->name));
520 
521  RTLIL::SigSig connect_q;
522  for (size_t i = 0; i < wire_bits_vec.size(); i++) {
523  if (set_q_bits.count(wire_bits_vec[i]))
524  continue;
525  connect_q.first.append(wire_bits_vec[i]);
526  connect_q.second.append(RTLIL::SigBit(wire_q, i));
527  set_q_bits.insert(wire_bits_vec[i]);
528  }
529  module->connect(connect_q);
530 
531  RTLIL::Wire *wire_d = add_new_wire(module, wire->name.str() + sep + "d", wire->width);
532  wire_d->port_output = true;
533  log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_d->name));
534  module->connect(RTLIL::SigSig(wire_d, info.sig_d));
535 
536  RTLIL::Wire *wire_c = add_new_wire(module, wire->name.str() + sep + "c");
537  wire_c->port_output = true;
538  log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_c->name));
539  if (info.clk_polarity) {
540  module->connect(RTLIL::SigSig(wire_c, info.sig_clk));
541  } else {
542  RTLIL::Cell *c = module->addCell(NEW_ID, "$not");
543  c->parameters["\\A_SIGNED"] = 0;
544  c->parameters["\\A_WIDTH"] = 1;
545  c->parameters["\\Y_WIDTH"] = 1;
546  c->setPort("\\A", info.sig_clk);
547  c->setPort("\\Y", wire_c);
548  }
549 
550  if (info.sig_arst != RTLIL::State::Sm)
551  {
552  RTLIL::Wire *wire_r = add_new_wire(module, wire->name.str() + sep + "r");
553  wire_r->port_output = true;
554  log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_r->name));
555  if (info.arst_polarity) {
556  module->connect(RTLIL::SigSig(wire_r, info.sig_arst));
557  } else {
558  RTLIL::Cell *c = module->addCell(NEW_ID, "$not");
559  c->parameters["\\A_SIGNED"] = 0;
560  c->parameters["\\A_WIDTH"] = 1;
561  c->parameters["\\Y_WIDTH"] = 1;
562  c->setPort("\\A", info.sig_arst);
563  c->setPort("\\Y", wire_r);
564  }
565 
566  RTLIL::Wire *wire_v = add_new_wire(module, wire->name.str() + sep + "v", wire->width);
567  wire_v->port_output = true;
568  log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_v->name));
569  module->connect(RTLIL::SigSig(wire_v, info.arst_value));
570  }
571  }
572 
573  if (flag_evert)
574  {
575  std::vector<RTLIL::Cell*> delete_cells;
576 
577  for (auto &it : module->cells_)
578  {
579  if (flag_shared) {
580  if (shared_cells.count(it.first) == 0)
581  continue;
582  } else {
583  if (!design->selected(module, it.second) || !consider_cell(design, dff_cells[module], it.second))
584  continue;
585  }
586 
587  RTLIL::Cell *cell = it.second;
588 
589  if (design->modules_.count(cell->type))
590  {
591  RTLIL::Module *mod = design->modules_.at(cell->type);
592 
593  for (auto &it : mod->wires_)
594  {
595  RTLIL::Wire *p = it.second;
596  if (!p->port_input && !p->port_output)
597  continue;
598 
599  RTLIL::Wire *w = add_new_wire(module, cell->name.str() + sep + RTLIL::unescape_id(p->name), p->width);
600  if (p->port_input)
601  w->port_output = true;
602  if (p->port_output)
603  w->port_input = true;
604 
605  log("New module port: %s/%s (%s)\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(w->name), RTLIL::id2cstr(cell->type));
606 
607  RTLIL::SigSpec sig;
608  if (cell->hasPort(p->name))
609  sig = cell->getPort(p->name);
610  sig.extend(w->width);
611  if (w->port_input)
612  module->connect(RTLIL::SigSig(sig, w));
613  else
614  module->connect(RTLIL::SigSig(w, sig));
615  }
616  }
617  else
618  {
619  for (auto &it : cell->connections())
620  {
621  RTLIL::Wire *w = add_new_wire(module, cell->name.str() + sep + RTLIL::unescape_id(it.first), it.second.size());
622  if (ct.cell_input(cell->type, it.first))
623  w->port_output = true;
624  if (ct.cell_output(cell->type, it.first))
625  w->port_input = true;
626 
627  log("New module port: %s/%s (%s)\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(w->name), RTLIL::id2cstr(cell->type));
628 
629  if (w->port_input)
630  module->connect(RTLIL::SigSig(it.second, w));
631  else
632  module->connect(RTLIL::SigSig(w, it.second));
633  }
634  }
635 
636  delete_cells.push_back(cell);
637  }
638 
639  for (auto cell : delete_cells) {
640  log("Removing cell: %s/%s (%s)\n", log_id(module), log_id(cell), log_id(cell->type));
641  module->remove(cell);
642  }
643  }
644 
645  module->fixup_ports();
646  }
647  }
bool selected(T1 *module) const
Definition: rtlil.h:551
RTLIL::SigSpec sig_d
Definition: expose.cc:30
std::string str() const
Definition: rtlil.h:182
RTLIL::Wire * add_new_wire(RTLIL::Module *module, RTLIL::IdString name, int width=1)
Definition: expose.cc:214
void find_dff_wires(std::set< RTLIL::IdString > &dff_wires, RTLIL::Module *module)
Definition: expose.cc:79
void log_header(const char *format,...)
Definition: log.cc:188
CellTypes ct
Definition: opt_clean.cc:33
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
Definition: rtlil.h:595
static std::string unescape_id(std::string str)
Definition: rtlil.h:257
RTLIL::SigSpec sig_clk
Definition: expose.cc:30
RTLIL::IdString name
Definition: rtlil.h:853
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
Definition: rtlil.cc:1789
bool port_input
Definition: rtlil.h:827
int width
Definition: rtlil.h:826
RTLIL::Module * module
Definition: abc.cc:94
bool arst_polarity
Definition: expose.cc:31
RTLIL::IdString type
Definition: rtlil.h:854
std::map< RTLIL::IdString, RTLIL::Const > parameters
Definition: rtlil.h:856
bool consider_wire(RTLIL::Wire *wire, std::map< RTLIL::IdString, dff_map_info_t > &dff_dq_map)
Definition: expose.cc:43
bool compare_wires(RTLIL::Wire *wire1, RTLIL::Wire *wire2)
Definition: expose.cc:61
std::vector< RTLIL::SigSig > connections_
Definition: rtlil.h:597
if(!(yy_init))
Definition: ilang_lexer.cc:846
bool port_output
Definition: rtlil.h:827
bool cell_known(RTLIL::IdString type)
Definition: celltypes.h:188
RTLIL_ATTRIBUTE_MEMBERS bool hasPort(RTLIL::IdString portname) const
Definition: rtlil.cc:1766
bool cell_output(RTLIL::IdString type, RTLIL::IdString port)
Definition: celltypes.h:193
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
Definition: rtlil.cc:1809
RTLIL::Const arst_value
Definition: expose.cc:32
bool clk_polarity
Definition: expose.cc:31
RTLIL::IdString name
Definition: rtlil.h:599
#define NEW_ID
Definition: yosys.h:166
bool consider_cell(RTLIL::Design *design, std::set< RTLIL::IdString > &dff_cells, RTLIL::Cell *cell)
Definition: expose.cc:52
RTLIL::IdString name
Definition: rtlil.h:825
static const char * id2cstr(const RTLIL::IdString &str)
Definition: rtlil.h:267
std::map< RTLIL::IdString, RTLIL::Module * > modules_
Definition: rtlil.h:507
void create_dff_dq_map(std::map< RTLIL::IdString, dff_map_info_t > &map, RTLIL::Design *design, RTLIL::Module *module)
Definition: expose.cc:99
#define NULL
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
Definition: rtlil.h:596
RTLIL::SigSpec sig_arst
Definition: expose.cc:30
std::vector< RTLIL::IdString > cells
Definition: expose.cc:33
void log(const char *format,...)
Definition: log.cc:180
void extend(int width, bool is_signed=false)
Definition: rtlil.cc:2593
void add(RTLIL::SigSpec from, RTLIL::SigSpec to)
Definition: sigtools.h:347
bool cell_input(RTLIL::IdString type, RTLIL::IdString port)
Definition: celltypes.h:199
bool compare_cells(RTLIL::Cell *cell1, RTLIL::Cell *cell2)
Definition: expose.cc:69
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
Definition: register.cc:128
std::pair< SigSpec, SigSpec > SigSig
Definition: rtlil.h:71
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const
Definition: rtlil.cc:1814
const char * log_id(RTLIL::IdString str)
Definition: log.cc:283

+ 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 ExposePass::help ( )
inlinevirtual

Reimplemented from Pass.

Definition at line 223 of file expose.cc.

224  {
225  // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
226  log("\n");
227  log(" expose [options] [selection]\n");
228  log("\n");
229  log("This command exposes all selected internal signals of a module as additional\n");
230  log("outputs.\n");
231  log("\n");
232  log(" -dff\n");
233  log(" only consider wires that are directly driven by register cell.\n");
234  log("\n");
235  log(" -cut\n");
236  log(" when exposing a wire, create an input/output pair and cut the internal\n");
237  log(" signal path at that wire.\n");
238  log("\n");
239  log(" -shared\n");
240  log(" only expose those signals that are shared ammong the selected modules.\n");
241  log(" this is useful for preparing modules for equivialence checking.\n");
242  log("\n");
243  log(" -evert\n");
244  log(" also turn connections to instances of other modules to additional\n");
245  log(" inputs and outputs and remove the module instances.\n");
246  log("\n");
247  log(" -evert-dff\n");
248  log(" turn flip-flops to sets of inputs and outputs.\n");
249  log("\n");
250  log(" -sep <separator>\n");
251  log(" when creating new wire/port names, the original object name is suffixed\n");
252  log(" with this separator (default: '.') and the port name or a type\n");
253  log(" designator for the exposed signal.\n");
254  log("\n");
255  }
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: