80 log(
"Creating submodule %s (%s) of module %s.\n", submod.name.c_str(), submod.full_name.c_str(),
module->
name.
c_str());
90 flag_signal(conn.second,
true,
true,
true,
false,
false);
95 if (submod.cells.count(cell) > 0)
103 flag_signal(conn.second,
false,
false,
false,
true,
true);
110 new_mod->
name = submod.full_name;
114 std::set<RTLIL::IdString> all_wire_names;
116 all_wire_names.insert(it.first->name);
119 for (
auto &it : wire_flags)
122 wire_flags_t &flags = it.second;
125 flags.is_ext_driven =
true;
127 flags.is_ext_used =
true;
129 bool new_wire_port_input =
false;
130 bool new_wire_port_output =
false;
132 if (flags.is_int_driven && flags.is_ext_used)
133 new_wire_port_output =
true;
134 if (flags.is_ext_driven && flags.is_int_used)
135 new_wire_port_input =
true;
137 if (flags.is_int_driven && flags.is_ext_driven)
138 new_wire_port_input =
true, new_wire_port_output =
true;
140 std::string new_wire_name = wire->
name.
str();
141 if (new_wire_port_input || new_wire_port_output) {
142 while (new_wire_name[0] ==
'$') {
143 std::string next_wire_name =
stringf(
"\\n%d", auto_name_counter++);
144 if (all_wire_names.count(next_wire_name) == 0) {
145 all_wire_names.insert(next_wire_name);
146 new_wire_name = next_wire_name;
155 new_wire->attributes = wire->attributes;
166 flags.new_wire = new_wire;
174 for (
auto &bit : conn.second)
175 if (bit.wire !=
NULL) {
177 bit.wire = wire_flags[bit.wire].new_wire;
182 submod.cells.clear();
185 for (
auto &it : wire_flags)
const char * c_str() const
std::string stringf(const char *fmt,...)
void log_warning(const char *format,...)
RTLIL::Cell * addCell(RTLIL::IdString name, RTLIL::IdString type)
void add(RTLIL::Module *module)
std::map< RTLIL::Wire *, wire_flags_t > wire_flags
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
bool cell_known(RTLIL::IdString type)
bool cell_output(RTLIL::IdString type, RTLIL::IdString port)
#define log_assert(_assert_expr_)
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
bool flag_found_something
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
void remove(const std::set< RTLIL::Wire * > &wires)
void log(const char *format,...)
bool cell_input(RTLIL::IdString type, RTLIL::IdString port)
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
void flag_signal(const RTLIL::SigSpec &sig, bool create, bool set_int_driven, bool set_int_used, bool set_ext_driven, bool set_ext_used)
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const