111 std::map<int, RTLIL::Wire*> inputs, outputs;
122 for (
auto &it : inputs) {
124 for (
int i = 0; i < wire->
width; i++)
130 for (
auto &it : outputs) {
132 for (
int i = 0; i < wire->
width; i++)
137 if (
module->get_bool_attribute(
"\\blackbox")) {
182 f <<
stringf(
".names %s %s %s\n11 1\n",
188 f <<
stringf(
".names %s %s %s\n1- 1\n-1 1\n",
194 f <<
stringf(
".names %s %s %s\n10 1\n01 1\n",
200 f <<
stringf(
".names %s %s %s %s\n1-0 1\n-11 1\n",
207 f <<
stringf(
".latch %s %s fe %s\n",
213 f <<
stringf(
".latch %s %s re %s\n",
220 auto &inputs = cell->
getPort(
"\\A");
221 auto width = cell->
parameters.at(
"\\WIDTH").as_int();
223 for (
int i = 0; i < inputs.size(); i++) {
226 auto &output = cell->
getPort(
"\\Y");
230 auto mask = cell->
parameters.at(
"\\LUT").as_string();
231 for (
int i = 0; i < (1 << width); i++) {
232 if (mask[i] ==
'0')
continue;
233 for (
int j = width-1; j >= 0; j--) {
234 f << ((i>>j)&1 ?
'1' :
'0');
243 for (
int i = 0; i < conn.second.size(); i++) {
244 if (conn.second.size() == 1)
256 std::string str = param.second.decode_string();
259 if (ch ==
'"' || ch ==
'\\')
261 else if (ch < 32 || ch >= 127)
267 f <<
stringf(
"%s\n", param.second.as_string().c_str());
272 for (
int i = 0; i < conn.first.size(); i++)
274 f <<
stringf(
".conn %s %s\n",
cstr(conn.second.extract(i, 1)),
cstr(conn.first.extract(i, 1)));
279 f <<
stringf(
".names %s %s\n1 1\n",
cstr(conn.second.extract(i, 1)),
cstr(conn.first.extract(i, 1)));
std::map< RTLIL::IdString, std::pair< RTLIL::IdString, RTLIL::IdString > > unbuf_types
std::string stringf(const char *fmt,...)
BlifDumperConfig * config
const std::vector< RTLIL::SigSig > & connections() const
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
std::map< RTLIL::IdString, RTLIL::Const > parameters
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::Cell * > cells_
const char * subckt_or_gate(std::string cell_type)
const char * cstr(RTLIL::IdString id)
const std::map< RTLIL::IdString, RTLIL::SigSpec > & connections() const