47 id = prefix +
"." +
id.substr(1);
49 id =
"$techmap" + prefix +
"." +
id;
54 std::vector<RTLIL::SigChunk> chunks = sig;
55 for (
auto &chunk : chunks)
56 if (chunk.wire !=
NULL) {
57 std::string wire_name = chunk.wire->name.str();
60 chunk.wire = module->
wires_[wire_name];
70 std::set<RTLIL::Module*, RTLIL::IdString::compare_ptr_by_name<RTLIL::Module>>
module_queue;
77 typedef std::map<std::string, std::vector<TechmapWireData>>
TechmapWires;
96 std::string constmap_info;
97 std::map<RTLIL::SigBit, std::pair<RTLIL::IdString, int>> connbits_map;
100 for (
int i = 0; i <
GetSize(conn.second); i++) {
102 if (bit.
wire ==
nullptr) {
106 }
else if (connbits_map.count(bit)) {
108 log(
" Bit %d of port %s and bit %d of port %s are connected.\n", i,
log_id(conn.first),
109 connbits_map.at(bit).second,
log_id(connbits_map.at(bit).first));
110 constmap_info +=
stringf(
"|%s %d %s %d",
log_id(conn.first), i,
111 log_id(connbits_map.at(bit).first), connbits_map.at(bit).second);
113 connbits_map[bit] = std::pair<RTLIL::IdString, int>(conn.first, i);
128 for (
auto &it : module->
wires_) {
129 const char *p = it.first.c_str();
133 const char *q = strrchr(p+1,
'.');
136 if (!strncmp(p,
"_TECHMAP_", 9)) {
138 record.
wire = it.second;
139 record.
value = it.second;
140 result[p].push_back(record);
142 it.second->attributes[
"\\_techmap_special_"] =
RTLIL::Const(1);
146 if (!result.empty()) {
148 for (
auto &it1 : result)
149 for (
auto &it2 : it1.second)
150 sigmap.
apply(it2.value);
159 log_error(
"Technology map yielded memories -> this is not supported.\n");
162 log(
"Technology map yielded processes:\n");
169 log_error(
"Technology map yielded processes -> this is not supported (use -autoproc to run 'proc' automatically).\n");
172 std::string orig_cell_name;
174 for (
auto &it : tpl->
cells_)
175 if (it.first ==
"\\_TECHMAP_REPLACE_") {
176 orig_cell_name = cell->
name.
str();
181 std::map<RTLIL::IdString, RTLIL::IdString> positional_ports;
183 for (
auto &it : tpl->
wires_) {
184 if (it.second->port_id > 0)
185 positional_ports[
stringf(
"$%d", it.second->port_id)] = it.first;
186 std::string w_name = it.second->name.str();
190 w->port_output =
false;
192 if (it.second->get_bool_attribute(
"\\_techmap_special_"))
193 w->attributes.clear();
194 design->
select(module, w);
201 if (positional_ports.count(portname) > 0)
202 portname = positional_ports.at(portname);
203 if (tpl->
wires_.count(portname) == 0 || tpl->
wires_.at(portname)->port_id == 0) {
204 if (portname.
substr(0, 1) ==
"$")
216 c.second = it.second;
219 if (c.second.size() > c.first.size())
220 c.second.remove(c.first.size(), c.second.size() - c.first.size());
221 if (c.second.size() < c.first.size())
223 log_assert(c.first.size() == c.second.size());
232 port_signal_map.
add(c.second, c.first);
234 port_signal_map.
add(c.first, c.second);
238 for (
auto &it : tpl->
cells_)
240 std::string c_name = it.second->name.str();
243 c_name = orig_cell_name;
248 design->
select(module, c);
251 c->type = c->type.substr(1);
253 for (
auto &it2 : c->connections_) {
255 port_signal_map.
apply(it2.second);
263 port_signal_map.
apply(c.first);
264 port_signal_map.
apply(c.second);
272 const std::map<
RTLIL::IdString, std::set<RTLIL::IdString, RTLIL::sort_by_id_str>> &celltypeMap,
bool in_recursion)
274 std::string mapmsg_prefix = in_recursion ?
"Recursively mapping" :
"Mapping";
279 bool log_continue =
false;
285 std::map<RTLIL::Cell*, std::set<RTLIL::SigBit>> cell_to_inbit;
286 std::map<RTLIL::SigBit, std::set<RTLIL::Cell*>> outbit_to_cell;
288 for (
auto cell : module->
cells())
290 if (!design->
selected(module, cell) || handled_cells.count(cell) > 0)
293 std::string cell_type = cell->type.str();
294 if (in_recursion && cell_type.substr(0, 2) ==
"\\$")
295 cell_type = cell_type.substr(1);
297 if (celltypeMap.count(cell_type) == 0) {
299 log_error(
"(ASSERT MODE) No matching template cell for type %s found.\n",
log_id(cell_type));
303 for (
auto &conn : cell->connections())
311 for (
auto &tpl_name : celltypeMap.at(cell_type)) {
315 cell_to_inbit[cell].insert(sig.
begin(), sig.
end());
317 for (
auto &bit : sig)
318 outbit_to_cell[bit].insert(cell);
325 for (
auto &it_right : cell_to_inbit)
326 for (
auto &it_sigbit : it_right.second)
327 for (
auto &it_left : outbit_to_cell[it_sigbit])
328 cells.
edge(it_left, it_right.first);
332 for (
auto cell : cells.
sorted)
336 bool mapped_cell =
false;
338 std::string cell_type = cell->type.str();
339 if (in_recursion && cell_type.substr(0, 2) ==
"\\$")
340 cell_type = cell_type.substr(1);
342 for (
auto &tpl_name : celltypeMap.at(cell_type))
346 std::map<RTLIL::IdString, RTLIL::Const> parameters = cell->parameters;
348 if (tpl->get_bool_attribute(
"\\blackbox"))
353 std::string extmapper_name;
355 if (tpl->get_bool_attribute(
"\\techmap_simplemap"))
356 extmapper_name =
"simplemap";
358 if (tpl->get_bool_attribute(
"\\techmap_maccmap"))
359 extmapper_name =
"maccmap";
361 if (tpl->attributes.count(
"\\techmap_wrap"))
362 extmapper_name =
"wrap";
364 if (!extmapper_name.empty())
366 cell->type = cell_type;
368 if ((
extern_mode && !in_recursion) || extmapper_name ==
"wrap")
370 std::string m_name =
stringf(
"$extern:%s:%s", extmapper_name.c_str(),
log_id(cell->type));
372 for (
auto &c : cell->parameters)
375 if (extmapper_name ==
"wrap")
376 m_name +=
":" +
sha1(tpl->attributes.at(
"\\techmap_wrap").decode_string());
379 RTLIL::Module *extmapper_module = extmapper_design->module(m_name);
381 if (extmapper_module ==
nullptr)
383 extmapper_module = extmapper_design->addModule(m_name);
389 if (w->
name ==
"\\Y" || w->
name ==
"\\Q")
398 extmapper_module->
check();
400 if (extmapper_name ==
"simplemap") {
401 log(
"Creating %s with simplemap.\n",
log_id(extmapper_module));
405 extmapper_module->
remove(extmapper_cell);
408 if (extmapper_name ==
"maccmap") {
409 log(
"Creating %s with maccmap.\n",
log_id(extmapper_module));
410 if (extmapper_cell->
type !=
"$macc")
411 log_error(
"The maccmap mapper can only map $macc (not %s) cells!\n",
log_id(extmapper_cell->
type));
412 maccmap(extmapper_module, extmapper_cell);
413 extmapper_module->
remove(extmapper_cell);
416 if (extmapper_name ==
"wrap") {
417 std::string cmd_string = tpl->attributes.at(
"\\techmap_wrap").decode_string();
418 log(
"Running \"%s\" on wrapper %s.\n", cmd_string.c_str(),
log_id(extmapper_module));
424 cell->type = extmapper_module->
name;
425 cell->parameters.
clear();
428 tpl = extmapper_module;
429 goto use_wrapper_tpl;
436 log(
"%s %s.%s (%s) with %s.\n", mapmsg_prefix.c_str(),
log_id(module),
log_id(cell),
log_id(cell->type), extmapper_name.c_str());
438 if (extmapper_name ==
"simplemap") {
444 if (extmapper_name ==
"maccmap") {
445 if (cell->type !=
"$macc")
446 log_error(
"The maccmap mapper can only map $macc (not %s) cells!\n",
log_id(cell->type));
454 did_something =
true;
459 for (
auto conn : cell->connections()) {
460 if (conn.first.substr(0, 1) ==
"$")
462 if (tpl->
wires_.count(conn.first) > 0 && tpl->
wires_.at(conn.first)->port_id > 0)
464 if (!conn.second.is_fully_const() || parameters.count(conn.first) > 0 || tpl->
avail_parameters.count(conn.first) == 0)
466 parameters[conn.first] = conn.second.as_const();
477 for (
auto conn : cell->connections()) {
479 std::vector<RTLIL::SigBit> v = sigmap(conn.second).to_sigbit_vector();
485 std::vector<RTLIL::SigBit> v = sigmap(conn.second).to_sigbit_vector();
487 if (bit.wire !=
NULL)
493 int unique_bit_id_counter = 0;
494 std::map<RTLIL::SigBit, int> unique_bit_id;
500 for (
auto conn : cell->connections())
502 for (
auto &bit : sigmap(conn.second).to_sigbit_vector())
503 if (unique_bit_id.count(bit) == 0)
504 unique_bit_id[bit] = unique_bit_id_counter++;
508 for (
int i = 0; i < 32; i++)
509 if (((unique_bit_id_counter-1) & (1 << i)) != 0)
512 parameters[
"\\_TECHMAP_BITS_CONNMAP_"] = bits;
514 for (
auto conn : cell->connections())
517 for (
auto &bit : sigmap(conn.second).to_sigbit_vector()) {
519 value.
bits.insert(value.
bits.end(), chunk.bits.begin(), chunk.bits.end());
529 std::pair<RTLIL::IdString, std::map<RTLIL::IdString, RTLIL::Const>> key(tpl_name, parameters);
533 if (cell->parameters.size() != 0) {
534 derived_name = tpl->
derive(map, parameters);
535 tpl = map->
module(derived_name);
546 if (constmapped_tpl !=
nullptr)
547 tpl = constmapped_tpl;
552 bool keep_running =
true;
555 std::set<std::string> techmap_wire_names;
560 keep_running =
false;
563 techmap_wire_names.insert(it.first);
565 for (
auto &it : twd[
"_TECHMAP_FAIL_"]) {
568 log(
"Not using module `%s' from techmap as it contains a %s marker wire with non-zero value %s.\n",
579 if (it.first.substr(0, 12) !=
"_TECHMAP_DO_" || it.second.empty())
582 auto &data = it.second.front();
584 if (!data.value.is_fully_const())
587 techmap_wire_names.erase(it.first);
589 const char *p = data.wire->name.c_str();
590 const char *q = strrchr(p+1,
'.');
593 std::string cmd_string = data.value.as_const().decode_string();
595 restart_eval_cmd_string:
596 if (cmd_string.rfind(
"CONSTMAP; ", 0) == 0)
598 cmd_string = cmd_string.substr(strlen(
"CONSTMAP; "));
600 log(
"Analyzing pattern of constant bits for this cell:\n");
602 log(
"Creating constmapped module `%s'.\n",
log_id(new_tpl_name));
612 std::map<RTLIL::SigBit, RTLIL::SigBit> port_new2old_map;
613 std::map<RTLIL::SigBit, RTLIL::SigBit> port_connmap;
614 std::map<RTLIL::SigBit, RTLIL::SigBit> cellbits_to_tplbits;
616 for (
auto wire : tpl->wires().to_vector())
618 if (!wire->port_input || wire->port_output)
622 tpl->rename(wire,
NEW_ID);
624 RTLIL::Wire *new_wire = tpl->addWire(port_name, wire);
628 for (
int i = 0; i < wire->width; i++) {
634 for (
auto conn : cell->connections())
635 for (
int i = 0; i <
GetSize(conn.second); i++)
640 if (bit.
wire ==
nullptr)
643 port_connmap.at(oldbit) = bit;
645 else if (cellbits_to_tplbits.count(bit))
648 port_connmap.at(oldbit) = cellbits_to_tplbits[bit];
651 cellbits_to_tplbits[bit] = tplbit;
655 for (
auto &it : port_connmap) {
656 port_conn.first.append_bit(it.first);
657 port_conn.second.append_bit(it.second);
659 tpl->connect(port_conn);
662 goto restart_eval_cmd_string;
665 if (cmd_string.rfind(
"RECURSION; ", 0) == 0)
667 cmd_string = cmd_string.substr(strlen(
"RECURSION; "));
668 while (
techmap_module(map, tpl, map, handled_cells, celltypeMap,
true)) { }
669 goto restart_eval_cmd_string;
675 std::string new_name = data.wire->name.substr(0, q-p) +
"_TECHMAP_DONE_" + data.wire->name.substr(q-p+12);
676 while (tpl->wires_.count(new_name))
678 tpl->rename(data.wire->name, new_name);
686 for (
auto &it : twd) {
687 if (it.first !=
"_TECHMAP_FAIL_" && it.first.substr(0, 12) !=
"_TECHMAP_DO_" && it.first.substr(0, 14) !=
"_TECHMAP_DONE_")
688 log_error(
"Techmap yielded unknown config wire %s.\n", it.first.c_str());
690 for (
auto &it2 : it.second)
691 if (!it2.value.is_fully_const())
693 techmap_wire_names.erase(it.first);
696 for (
auto &it : techmap_wire_names)
702 log_continue =
false;
704 while (
techmap_module(map, tpl, map, handled_cells, celltypeMap,
true)) { }
713 log_continue =
false;
720 if (!design->
module(m_name))
725 for (
auto cell : m->
cells()) {
726 if (cell->type.substr(0, 2) ==
"\\$")
727 cell->type = cell->type.substr(1);
733 log(
"%s %s.%s to imported %s.\n", mapmsg_prefix.c_str(),
log_id(module),
log_id(cell),
log_id(m_name));
735 cell->parameters.clear();
743 did_something =
true;
751 handled_cells.insert(cell);
756 log_continue =
false;
769 log(
" techmap [-map filename] [selection]\n");
771 log(
"This pass implements a very simple technology mapper that replaces cells in\n");
772 log(
"the design with implementations given in form of a verilog or ilang source\n");
775 log(
" -map filename\n");
776 log(
" the library of cell implementations to be used.\n");
777 log(
" without this parameter a builtin library is used that\n");
778 log(
" transforms the internal RTL cells to the internal gate\n");
781 log(
" -map %%<design-name>\n");
782 log(
" like -map above, but with an in-memory design instead of a file.\n");
784 log(
" -share_map filename\n");
785 log(
" like -map, but look for the file in the share directory (where the\n");
786 log(
" yosys data files are). this is mainly used internally when techmap\n");
787 log(
" is called from other commands.\n");
790 log(
" load the cell implementations as separate modules into the design\n");
791 log(
" instead of inlining them.\n");
793 log(
" -max_iter <number>\n");
794 log(
" only run the specified number of iterations.\n");
796 log(
" -recursive\n");
797 log(
" instead of the iterative breadth-first algorithm use a recursive\n");
798 log(
" depth-first algorithm. both methods should yield equivialent results,\n");
799 log(
" but may differ in performance.\n");
802 log(
" Automatically call \"proc\" on implementations that contain processes.\n");
805 log(
" this option will cause techmap to exit with an error if it can't map\n");
806 log(
" a selected cell. only cell types that end on an underscore are accepted\n");
807 log(
" as final cell types by this mode.\n");
809 log(
" -D <define>, -I <incdir>\n");
810 log(
" this options are passed as-is to the verilog frontend for loading the\n");
811 log(
" map file. Note that the verilog frontend is also called with the\n");
812 log(
" '-ignore_redef' option set.\n");
814 log(
"When a module in the map file has the 'techmap_celltype' attribute set, it will\n");
815 log(
"match cells with a type that match the text value of this attribute. Otherwise\n");
816 log(
"the module name will be used to match the cell.\n");
818 log(
"When a module in the map file has the 'techmap_simplemap' attribute set, techmap\n");
819 log(
"will use 'simplemap' (see 'help simplemap') to map cells matching the module.\n");
821 log(
"When a module in the map file has the 'techmap_maccmap' attribute set, techmap\n");
822 log(
"will use 'maccmap' (see 'help maccmap') to map cells matching the module.\n");
824 log(
"When a module in the map file has the 'techmap_wrap' attribute set, techmap\n");
825 log(
"will create a wrapper for the cell and then run the command string that the\n");
826 log(
"attribute is set to on the wrapper module.\n");
828 log(
"All wires in the modules from the map file matching the pattern _TECHMAP_*\n");
829 log(
"or *._TECHMAP_* are special wires that are used to pass instructions from\n");
830 log(
"the mapping module to the techmap command. At the moment the following special\n");
831 log(
"wires are supported:\n");
833 log(
" _TECHMAP_FAIL_\n");
834 log(
" When this wire is set to a non-zero constant value, techmap will not\n");
835 log(
" use this module and instead try the next module with a matching\n");
836 log(
" 'techmap_celltype' attribute.\n");
838 log(
" When such a wire exists but does not have a constant value after all\n");
839 log(
" _TECHMAP_DO_* commands have been executed, an error is generated.\n");
841 log(
" _TECHMAP_DO_*\n");
842 log(
" This wires are evaluated in alphabetical order. The constant text value\n");
843 log(
" of this wire is a yosys command (or sequence of commands) that is run\n");
844 log(
" by techmap on the module. A common use case is to run 'proc' on modules\n");
845 log(
" that are written using always-statements.\n");
847 log(
" When such a wire has a non-constant value at the time it is to be\n");
848 log(
" evaluated, an error is produced. That means it is possible for such a\n");
849 log(
" wire to start out as non-constant and evaluate to a constant value\n");
850 log(
" during processing of other _TECHMAP_DO_* commands.\n");
852 log(
" A _TECHMAP_DO_* command may start with the special token 'CONSTMAP; '.\n");
853 log(
" in this case techmap will create a copy for each distinct configuration\n");
854 log(
" of constant inputs and shorted inputs at this point and import the\n");
855 log(
" constant and connected bits into the map module. All further commands\n");
856 log(
" are executed in this copy. This is a very convenient way of creating\n");
857 log(
" optimizied specializations of techmap modules without using the special\n");
858 log(
" parameters described below.\n");
860 log(
" A _TECHMAP_DO_* command may start with the special token 'RECURSION; '.\n");
861 log(
" then techmap will recursively replace the cells in the module with their\n");
862 log(
" implementation. This is not affected by the -max_iter option.\n");
864 log(
" It is possible to combine both prefixes to 'RECURSION; CONSTMAP; '.\n");
866 log(
"In addition to this special wires, techmap also supports special parameters in\n");
867 log(
"modules in the map file:\n");
869 log(
" _TECHMAP_CELLTYPE_\n");
870 log(
" When a parameter with this name exists, it will be set to the type name\n");
871 log(
" of the cell that matches the module.\n");
873 log(
" _TECHMAP_CONSTMSK_<port-name>_\n");
874 log(
" _TECHMAP_CONSTVAL_<port-name>_\n");
875 log(
" When this pair of parameters is available in a module for a port, then\n");
876 log(
" former has a 1-bit for each constant input bit and the latter has the\n");
877 log(
" value for this bit. The unused bits of the latter are set to undef (x).\n");
879 log(
" _TECHMAP_BITS_CONNMAP_\n");
880 log(
" _TECHMAP_CONNMAP_<port-name>_\n");
881 log(
" For an N-bit port, the _TECHMAP_CONNMAP_<port-name>_ parameter, if it\n");
882 log(
" exists, will be set to an N*_TECHMAP_BITS_CONNMAP_ bit vector containing\n");
883 log(
" N words (of _TECHMAP_BITS_CONNMAP_ bits each) that assign each single\n");
884 log(
" bit driver a unique id. The values 0-3 are reserved for 0, 1, x, and z.\n");
885 log(
" This can be used to detect shorted inputs.\n");
887 log(
"When a module in the map file has a parameter where the according cell in the\n");
888 log(
"design has a port, the module from the map file is only used if the port in\n");
889 log(
"the design is connected to a constant value. The parameter is then set to the\n");
890 log(
"constant value.\n");
892 log(
"A cell with the name _TECHMAP_REPLACE_ in the map file will inherit the name\n");
893 log(
"of the cell that is beeing replaced.\n");
895 log(
"See 'help extract' for a pass that does the opposite thing.\n");
897 log(
"See 'help flatten' for a pass that does flatten the design (which is\n");
898 log(
"esentially techmap but using the design itself as map library).\n");
903 log_header(
"Executing TECHMAP pass (map to technology primitives).\n");
909 std::vector<std::string> map_files;
910 std::string verilog_frontend =
"verilog -ignore_redef";
914 for (argidx = 1; argidx < args.size(); argidx++) {
915 if (args[argidx] ==
"-map" && argidx+1 < args.size()) {
916 if (args[argidx+1].substr(0, 2) ==
"+/")
919 map_files.push_back(args[++argidx]);
922 if (args[argidx] ==
"-share_map" && argidx+1 < args.size()) {
926 if (args[argidx] ==
"-max_iter" && argidx+1 < args.size()) {
927 max_iter = atoi(args[++argidx].c_str());
930 if (args[argidx] ==
"-D" && argidx+1 < args.size()) {
931 verilog_frontend +=
" -D " + args[++argidx];
934 if (args[argidx] ==
"-I" && argidx+1 < args.size()) {
935 verilog_frontend +=
" -I " + args[++argidx];
938 if (args[argidx] ==
"-assert") {
942 if (args[argidx] ==
"-extern") {
946 if (args[argidx] ==
"-recursive") {
950 if (args[argidx] ==
"-autoproc") {
959 if (map_files.empty()) {
960 std::istringstream f(stdcells_code);
963 for (
auto &fn : map_files)
964 if (fn.substr(0, 1) ==
"%") {
970 if (!map->
has(mod->name))
971 map->
add(mod->clone());
977 Frontend::frontend_call(map, &f, fn, (fn.size() > 3 && fn.substr(fn.size()-3) ==
".il") ?
"ilang" : verilog_frontend);
980 std::map<RTLIL::IdString, RTLIL::Module*> modules_new;
982 if (it.first.substr(0, 2) ==
"\\$")
983 it.second->name = it.first.substr(1);
984 modules_new[it.second->name] = it.second;
988 std::map<RTLIL::IdString, std::set<RTLIL::IdString, RTLIL::sort_by_id_str>> celltypeMap;
990 if (it.second->attributes.count(
"\\techmap_celltype") && !it.second->attributes.at(
"\\techmap_celltype").bits.empty()) {
991 char *p = strdup(it.second->attributes.at(
"\\techmap_celltype").decode_string().c_str());
992 for (
char *q = strtok(p,
" \t\r\n"); q; q = strtok(
NULL,
" \t\r\n"))
996 celltypeMap[it.first].insert(it.first);
1008 std::set<RTLIL::Cell*> handled_cells;
1009 while (did_something) {
1010 did_something =
false;
1011 if (worker.
techmap_module(design, module, map, handled_cells, celltypeMap,
false))
1012 did_something =
true;
1015 if (max_iter > 0 && --max_iter == 0)
1020 log(
"No more expansions possible.\n");
1033 log(
" flatten [selection]\n");
1035 log(
"This pass flattens the design by replacing cells by their implementation. This\n");
1036 log(
"pass is very simmilar to the 'techmap' pass. The only difference is that this\n");
1037 log(
"pass is using the current design as mapping library.\n");
1042 log_header(
"Executing FLATTEN pass (flatten design).\n");
1050 std::map<RTLIL::IdString, std::set<RTLIL::IdString, RTLIL::sort_by_id_str>> celltypeMap;
1052 celltypeMap[it.first].insert(it.first);
1056 for (
auto mod : design->
modules())
1057 if (mod->get_bool_attribute(
"\\top"))
1061 std::set<RTLIL::Cell*> handled_cells;
1062 while (did_something) {
1063 did_something =
false;
1064 if (top_mod !=
NULL) {
1065 if (worker.
techmap_module(design, top_mod, design, handled_cells, celltypeMap,
false))
1066 did_something =
true;
1068 for (
auto mod : design->
modules())
1069 if (worker.
techmap_module(design, mod, design, handled_cells, celltypeMap,
false))
1070 did_something =
true;
1074 log(
"No more expansions possible.\n");
1076 if (top_mod !=
NULL) {
1077 std::map<RTLIL::IdString, RTLIL::Module*> new_modules;
1078 for (
auto mod : design->
modules())
1079 if (mod == top_mod || mod->get_bool_attribute(
"\\blackbox")) {
1080 new_modules[mod->name] = mod;
1082 log(
"Deleting now unused module %s.\n",
log_id(mod));
1085 design->
modules_.swap(new_modules);
const char * c_str() const
bool selected(T1 *module) const
void cloneInto(RTLIL::Module *new_mod) const
YOSYS_NAMESPACE_END USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN void apply_prefix(std::string prefix, std::string &id)
RTLIL::Wire * wire(RTLIL::IdString id)
std::set< RTLIL::Module *, RTLIL::IdString::compare_ptr_by_name< RTLIL::Module > > module_queue
std::string stringf(const char *fmt,...)
RTLIL::Cell * addCell(RTLIL::IdString name, RTLIL::IdString type)
void add(RTLIL::Module *module)
void log_header(const char *format,...)
const std::vector< RTLIL::SigSig > & connections() const
#define YOSYS_NAMESPACE_END
RTLIL::Const as_const() const
std::map< RTLIL::Module *, bool > techmap_do_cache
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
static std::string unescape_id(std::string str)
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
static void frontend_call(RTLIL::Design *design, std::istream *f, std::string filename, std::string command)
std::map< std::pair< RTLIL::IdString, std::map< RTLIL::IdString, RTLIL::Const > >, RTLIL::Module * > techmap_cache
std::map< RTLIL::IdString, void(*)(RTLIL::Module *, RTLIL::Cell *)> simplemap_mappers
std::map< RTLIL::IdString, RTLIL::Memory * > memories
void log_error(const char *format,...)
std::set< RTLIL::IdString > avail_parameters
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
void select(T1 *module, T2 *member)
virtual RTLIL::IdString derive(RTLIL::Design *design, std::map< RTLIL::IdString, RTLIL::Const > parameters)
YOSYS_NAMESPACE_BEGIN void simplemap_get_mappers(std::map< RTLIL::IdString, void(*)(RTLIL::Module *, RTLIL::Cell *)> &mappers)
void apply(RTLIL::SigBit &bit) const
static std::string escape_id(std::string str)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool did_something
std::map< std::string, RTLIL::Design * > saved_designs
std::map< std::string, std::vector< TechmapWireData > > TechmapWires
bool techmap_module(RTLIL::Design *design, RTLIL::Module *module, RTLIL::Design *map, std::set< RTLIL::Cell * > &handled_cells, const std::map< RTLIL::IdString, std::set< RTLIL::IdString, RTLIL::sort_by_id_str >> &celltypeMap, bool in_recursion)
void connect(const RTLIL::SigSig &conn)
bool full_selection() const
#define PRIVATE_NAMESPACE_BEGIN
void edge(T left, T right)
int GetSize(RTLIL::Wire *wire)
RTLIL::SigSpecIterator begin()
#define log_assert(_assert_expr_)
bool is_fully_const() const
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
#define PRIVATE_NAMESPACE_END
static const char * id2cstr(const RTLIL::IdString &str)
void log_cmd_error(const char *format,...)
RTLIL::Module * addModule(RTLIL::IdString name)
RTLIL::Module * module(RTLIL::IdString name)
std::map< RTLIL::IdString, RTLIL::Process * > processes
std::string substr(size_t pos=0, size_t len=std::string::npos) const
bool has(RTLIL::IdString id) const
#define USING_YOSYS_NAMESPACE
RTLIL::ObjRange< RTLIL::Cell * > cells()
RTLIL::ObjRange< RTLIL::Module * > modules()
std::map< RTLIL::IdString, RTLIL::Module * > modules_
RTLIL::Cell * cell(RTLIL::IdString id)
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
#define YOSYS_NAMESPACE_BEGIN
static void call_on_module(RTLIL::Design *design, RTLIL::Module *module, std::string command)
void remove(const std::set< RTLIL::Wire * > &wires)
void log(const char *format,...)
std::string sha1(const std::string &string)
std::vector< RTLIL::State > bits
virtual void execute(std::vector< std::string > args, RTLIL::Design *design)
std::string proc_share_dirname()
void maccmap(RTLIL::Module *module, RTLIL::Cell *cell, bool unmap=false)
void add(RTLIL::SigSpec from, RTLIL::SigSpec to)
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
std::string id(RTLIL::IdString internal_id, bool may_rename=true)
void extra_args(std::vector< std::string > args, size_t argidx, RTLIL::Design *design, bool select=true)
std::string constmap_tpl_name(SigMap &sigmap, RTLIL::Module *tpl, RTLIL::Cell *cell, bool verbose)
std::pair< SigSpec, SigSpec > SigSig
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const
void techmap_module_worker(RTLIL::Design *design, RTLIL::Module *module, RTLIL::Cell *cell, RTLIL::Module *tpl)
const char * log_id(RTLIL::IdString str)
RTLIL::SigSpecIterator end()
YOSYS_NAMESPACE_BEGIN int autoidx
void rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
TechmapWires techmap_find_special_wires(RTLIL::Module *module)