50 int cell_counter = 0, conn_counter = 0, nc_counter = 0;
52 for (
auto &cell_it : module->
cells_)
55 f <<
stringf(
"X%d", cell_counter++);
57 std::vector<RTLIL::SigSpec> port_sigs;
61 log_warning(
"no (blackbox) module for cell type `%s' (%s.%s) found! Guessing order of ports.\n",
65 port_sigs.push_back(sig);
72 std::vector<RTLIL::Wire*> ports;
73 for (
auto wire_it : mod->
wires_) {
77 while (
int(ports.size()) < wire->
port_id)
78 ports.push_back(
NULL);
79 ports.at(wire->
port_id-1) = wire;
87 sig.extend(wire->
width,
false);
89 port_sigs.push_back(sig);
93 for (
auto &sig : port_sigs) {
94 for (
int i = 0; i < sig.size(); i++) {
104 for (
int i = 0; i < conn.first.size(); i++) {
105 f <<
stringf(
"V%d", conn_counter++);
106 print_spice_net(f, conn.first.extract(i, 1), neg, pos, ncpf, nc_counter);
107 print_spice_net(f, conn.second.extract(i, 1), neg, pos, ncpf, nc_counter);
std::string stringf(const char *fmt,...)
void log_warning(const char *format,...)
const std::vector< RTLIL::SigSig > & connections() const
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
RTLIL_ATTRIBUTE_MEMBERS bool hasPort(RTLIL::IdString portname) const
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
#define log_assert(_assert_expr_)
static const char * id2cstr(const RTLIL::IdString &str)
std::map< RTLIL::IdString, RTLIL::Module * > modules_
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
USING_YOSYS_NAMESPACE static PRIVATE_NAMESPACE_BEGIN void print_spice_net(std::ostream &f, RTLIL::SigBit s, std::string &neg, std::string &pos, std::string &ncpf, int &nc_counter)
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const