Fixed writing of $lut cells in BLIF backend
authorClifford Wolf <clifford@clifford.at>
Wed, 17 Dec 2014 10:13:57 +0000 (11:13 +0100)
committerClifford Wolf <clifford@clifford.at>
Wed, 17 Dec 2014 10:13:57 +0000 (11:13 +0100)
backends/blif/blif.cc

index aaf85f46086a267f6c679cf6e61c7f285f0ce55f..366ed0369abe2b94c3716648a7ab9b00d5cb3e9b 100644 (file)
@@ -227,14 +227,14 @@ struct BlifDumper
                                log_assert(output.size() == 1);
                                f << stringf(" %s", cstr(output));
                                f << stringf("\n");
-                               auto mask = cell->parameters.at("\\LUT").as_string();
-                               for (int i = 0; i < (1 << width); i++) {
-                                       if (mask[i] == '0') continue;
-                                       for (int j = width-1; j >= 0; j--) {
-                                               f << ((i>>j)&1 ? '1' : '0');
+                               RTLIL::SigSpec mask = cell->parameters.at("\\LUT");
+                               for (int i = 0; i < (1 << width); i++)
+                                       if (mask[i] == RTLIL::S1) {
+                                               for (int j = width-1; j >= 0; j--) {
+                                                       f << ((i>>j)&1 ? '1' : '0');
+                                               }
+                                               f << " 1\n";
                                        }
-                                       f << stringf(" %c\n", mask[i]);
-                               }
                                continue;
                        }