156 std::map<RTLIL::SigBit, bit_ref_t> sig_bit_ref;
159 log(
" Skipping module %s as it is not selected.\n",
id2cstr(mod->
name));
164 log(
" Skipping module %s as it contains unprocessed processes.\n",
id2cstr(mod->
name));
183 std::map<std::pair<RTLIL::Wire*, int>,
int> sig_use_count;
185 for (
auto &cell_it : mod->
cells_)
188 if (!sel || sel->
selected(mod, cell))
191 sigmap.apply(conn_sig);
192 for (
auto &bit : conn_sig)
193 if (bit.wire !=
NULL)
194 sig_use_count[std::pair<RTLIL::Wire*, int>(bit.wire, bit.offset)]++;
199 for (
auto &cell_it : mod->
cells_)
202 if (sel && !sel->
selected(mod, cell))
205 std::string type = cell->
type.
str();
206 if (sel ==
NULL && type.substr(0, 2) ==
"\\$")
207 type = type.substr(1);
210 for (
auto &conn : cell->connections())
212 graph.
createPort(cell->name.str(), conn.first.str(), conn.second.size());
214 if (split && split->count(std::pair<RTLIL::IdString, RTLIL::IdString>(cell->type, conn.first)) > 0)
218 sigmap.apply(conn_sig);
220 for (
int i = 0; i < conn_sig.
size(); i++)
222 auto &bit = conn_sig[i];
224 if (bit.wire ==
NULL) {
226 std::string node =
"$const$x";
230 graph.
createConnection(cell->name.str(), conn.first.str(), i, node,
"\\Y", 0);
232 graph.
createConstant(cell->name.str(), conn.first.str(), i, int(bit.data));
236 if (max_fanout > 0 && sig_use_count[std::pair<RTLIL::Wire*, int>(bit.wire, bit.offset)] > max_fanout)
242 if (sig_bit_ref.count(bit) == 0) {
244 bit_ref.
cell = cell->name.str();
245 bit_ref.
port = conn.first.str();
256 for (
auto &cell_it : mod->
cells_)
259 if (sel && !sel->
selected(mod, cell))
263 sigmap.apply(conn_sig);
265 for (
auto &bit : conn_sig)
266 if (sig_bit_ref.count(bit) != 0) {
274 for (
auto &wire_it : mod->
wires_)
280 sigmap.apply(conn_sig);
282 for (
auto &bit : conn_sig)
283 if (sig_bit_ref.count(bit) != 0) {
bool selected(T1 *module) const
RTLIL::Wire * wire(RTLIL::IdString id)
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
void createNode(std::string nodeId, std::string typeId, void *userData=NULL, bool shared=false)
void createConstant(std::string toNodeId, std::string toPortId, int toBit, int constValue)
void markExtern(std::string nodeId, std::string portId, int bit=-1)
static const char * id2cstr(const RTLIL::IdString &str)
void createConnection(std::string fromNodeId, std::string fromPortId, int fromBit, std::string toNodeId, std::string toPortId, int toBit, int width=1)
std::map< RTLIL::IdString, RTLIL::Process * > processes
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
void log(const char *format,...)
void createPort(std::string nodeId, std::string portId, int width=1, int minWidth=-1)
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const