yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
expose.cc
Go to the documentation of this file.
1 /*
2  * yosys -- Yosys Open SYnthesis Suite
3  *
4  * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  *
18  */
19 
20 #include "kernel/register.h"
21 #include "kernel/celltypes.h"
22 #include "kernel/sigtools.h"
23 #include "kernel/rtlil.h"
24 #include "kernel/log.h"
25 
28 
33  std::vector<RTLIL::IdString> cells;
34 };
35 
41 };
42 
43 bool consider_wire(RTLIL::Wire *wire, std::map<RTLIL::IdString, dff_map_info_t> &dff_dq_map)
44 {
45  if (wire->name[0] == '$' || dff_dq_map.count(wire->name))
46  return false;
47  if (wire->port_input)
48  return false;
49  return true;
50 }
51 
52 bool consider_cell(RTLIL::Design *design, std::set<RTLIL::IdString> &dff_cells, RTLIL::Cell *cell)
53 {
54  if (cell->name[0] == '$' || dff_cells.count(cell->name))
55  return false;
56  if (cell->type[0] == '\\' && !design->modules_.count(cell->type))
57  return false;
58  return true;
59 }
60 
62 {
63  log_assert(wire1->name == wire2->name);
64  if (wire1->width != wire2->width)
65  return false;
66  return true;
67 }
68 
70 {
71  log_assert(cell1->name == cell2->name);
72  if (cell1->type != cell2->type)
73  return false;
74  if (cell1->parameters != cell2->parameters)
75  return false;
76  return true;
77 }
78 
79 void find_dff_wires(std::set<RTLIL::IdString> &dff_wires, RTLIL::Module *module)
80 {
81  CellTypes ct;
83  ct.setup_stdcells_mem();
84 
85  SigMap sigmap(module);
86  SigPool dffsignals;
87 
88  for (auto &it : module->cells_) {
89  if (ct.cell_known(it.second->type) && it.second->hasPort("\\Q"))
90  dffsignals.add(sigmap(it.second->getPort("\\Q")));
91  }
92 
93  for (auto &it : module->wires_) {
94  if (dffsignals.check_any(it.second))
95  dff_wires.insert(it.first);
96  }
97 }
98 
99 void create_dff_dq_map(std::map<RTLIL::IdString, dff_map_info_t> &map, RTLIL::Design *design, RTLIL::Module *module)
100 {
101  std::map<RTLIL::SigBit, dff_map_bit_info_t> bit_info;
102  SigMap sigmap(module);
103 
104  for (auto &it : module->cells_)
105  {
106  if (!design->selected(module, it.second))
107  continue;
108 
109  dff_map_bit_info_t info;
110  info.bit_d = RTLIL::State::Sm;
111  info.bit_clk = RTLIL::State::Sm;
112  info.bit_arst = RTLIL::State::Sm;
113  info.clk_polarity = false;
114  info.arst_polarity = false;
116  info.cell = it.second;
117 
118  if (info.cell->type == "$dff") {
119  info.bit_clk = sigmap(info.cell->getPort("\\CLK")).to_single_sigbit();
120  info.clk_polarity = info.cell->parameters.at("\\CLK_POLARITY").as_bool();
121  std::vector<RTLIL::SigBit> sig_d = sigmap(info.cell->getPort("\\D")).to_sigbit_vector();
122  std::vector<RTLIL::SigBit> sig_q = sigmap(info.cell->getPort("\\Q")).to_sigbit_vector();
123  for (size_t i = 0; i < sig_d.size(); i++) {
124  info.bit_d = sig_d.at(i);
125  bit_info[sig_q.at(i)] = info;
126  }
127  continue;
128  }
129 
130  if (info.cell->type == "$adff") {
131  info.bit_clk = sigmap(info.cell->getPort("\\CLK")).to_single_sigbit();
132  info.bit_arst = sigmap(info.cell->getPort("\\ARST")).to_single_sigbit();
133  info.clk_polarity = info.cell->parameters.at("\\CLK_POLARITY").as_bool();
134  info.arst_polarity = info.cell->parameters.at("\\ARST_POLARITY").as_bool();
135  std::vector<RTLIL::SigBit> sig_d = sigmap(info.cell->getPort("\\D")).to_sigbit_vector();
136  std::vector<RTLIL::SigBit> sig_q = sigmap(info.cell->getPort("\\Q")).to_sigbit_vector();
137  std::vector<RTLIL::State> arst_value = info.cell->parameters.at("\\ARST_VALUE").bits;
138  for (size_t i = 0; i < sig_d.size(); i++) {
139  info.bit_d = sig_d.at(i);
140  info.arst_value = arst_value.at(i);
141  bit_info[sig_q.at(i)] = info;
142  }
143  continue;
144  }
145 
146  if (info.cell->type == "$_DFF_N_" || info.cell->type == "$_DFF_P_") {
147  info.bit_clk = sigmap(info.cell->getPort("\\C")).to_single_sigbit();
148  info.clk_polarity = info.cell->type == "$_DFF_P_";
149  info.bit_d = sigmap(info.cell->getPort("\\D")).to_single_sigbit();
150  bit_info[sigmap(info.cell->getPort("\\Q")).to_single_sigbit()] = info;
151  continue;
152  }
153 
154  if (info.cell->type.size() == 10 && info.cell->type.substr(0, 6) == "$_DFF_") {
155  info.bit_clk = sigmap(info.cell->getPort("\\C")).to_single_sigbit();
156  info.bit_arst = sigmap(info.cell->getPort("\\R")).to_single_sigbit();
157  info.clk_polarity = info.cell->type[6] == 'P';
158  info.arst_polarity = info.cell->type[7] == 'P';
159  info.arst_value = info.cell->type[0] == '1' ? RTLIL::State::S1 : RTLIL::State::S0;
160  info.bit_d = sigmap(info.cell->getPort("\\D")).to_single_sigbit();
161  bit_info[sigmap(info.cell->getPort("\\Q")).to_single_sigbit()] = info;
162  continue;
163  }
164  }
165 
166  std::map<RTLIL::IdString, dff_map_info_t> empty_dq_map;
167  for (auto &it : module->wires_)
168  {
169  if (!consider_wire(it.second, empty_dq_map))
170  continue;
171 
172  std::vector<RTLIL::SigBit> bits_q = sigmap(it.second).to_sigbit_vector();
173  std::vector<RTLIL::SigBit> bits_d;
174  std::vector<RTLIL::State> arst_value;
175  std::set<RTLIL::Cell*> cells;
176 
177  if (bits_q.empty() || !bit_info.count(bits_q.front()))
178  continue;
179 
180  dff_map_bit_info_t ref_info = bit_info.at(bits_q.front());
181  for (auto &bit : bits_q) {
182  if (!bit_info.count(bit))
183  break;
184  dff_map_bit_info_t info = bit_info.at(bit);
185  if (info.bit_clk != ref_info.bit_clk)
186  break;
187  if (info.bit_arst != ref_info.bit_arst)
188  break;
189  if (info.clk_polarity != ref_info.clk_polarity)
190  break;
191  if (info.arst_polarity != ref_info.arst_polarity)
192  break;
193  bits_d.push_back(info.bit_d);
194  arst_value.push_back(info.arst_value);
195  cells.insert(info.cell);
196  }
197 
198  if (bits_d.size() != bits_q.size())
199  continue;
200 
201  dff_map_info_t info;
202  info.sig_d = bits_d;
203  info.sig_clk = ref_info.bit_clk;
204  info.sig_arst = ref_info.bit_arst;
205  info.clk_polarity = ref_info.clk_polarity;
206  info.arst_polarity = ref_info.arst_polarity;
207  info.arst_value = arst_value;
208  for (auto it : cells)
209  info.cells.push_back(it->name);
210  map[it.first] = info;
211  }
212 }
213 
215 {
216  if (module->count_id(name))
217  log_error("Attempting to create wire %s, but a wire of this name exists already! Hint: Try another value for -sep.\n", log_id(name));
218  return module->addWire(name, width);
219 }
220 
221 struct ExposePass : public Pass {
222  ExposePass() : Pass("expose", "convert internal signals to module ports") { }
223  virtual void help()
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  }
256  virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
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  }
648 } ExposePass;
649 
bool selected(T1 *module) const
Definition: rtlil.h:551
RTLIL::SigBit bit_clk
Definition: expose.cc:37
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 setup_internals_mem()
Definition: celltypes.h:115
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
void log_error(const char *format,...)
Definition: log.cc:204
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 arst_polarity
Definition: expose.cc:38
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
RTLIL::SigBit bit_d
Definition: expose.cc:37
bool cell_known(RTLIL::IdString type)
Definition: celltypes.h:188
bool check_any(RTLIL::SigSpec sig)
Definition: sigtools.h:100
#define PRIVATE_NAMESPACE_BEGIN
Definition: yosys.h:97
RTLIL::SigBit bit_arst
Definition: expose.cc:37
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
ExposePass()
Definition: expose.cc:222
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
#define log_assert(_assert_expr_)
Definition: log.h:85
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
Definition: rtlil.cc:1331
RTLIL::IdString name
Definition: rtlil.h:599
#define NEW_ID
Definition: yosys.h:166
#define PRIVATE_NAMESPACE_END
Definition: yosys.h:98
bool consider_cell(RTLIL::Design *design, std::set< RTLIL::IdString > &dff_cells, RTLIL::Cell *cell)
Definition: expose.cc:52
Definition: register.h:27
RTLIL::IdString name
Definition: rtlil.h:825
static const char * id2cstr(const RTLIL::IdString &str)
Definition: rtlil.h:267
void add(RTLIL::SigSpec sig)
Definition: sigtools.h:41
std::string substr(size_t pos=0, size_t len=std::string::npos) const
Definition: rtlil.h:208
#define USING_YOSYS_NAMESPACE
Definition: yosys.h:102
virtual size_t count_id(RTLIL::IdString id)
Definition: rtlil.cc:472
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
RTLIL::Cell * cell
Definition: expose.cc:40
#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
RTLIL::State arst_value
Definition: expose.cc:39
void setup_stdcells_mem()
Definition: celltypes.h:149
State
Definition: rtlil.h:29
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
virtual void help()
Definition: expose.cc:223
const char * log_id(RTLIL::IdString str)
Definition: log.cc:283
size_t size() const
Definition: rtlil.h:215
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
Definition: expose.cc:256
ExposePass ExposePass