Restored blif "-true - .." behavior, use "-true + .." for eddiehung-vtr behavior
authorClifford Wolf <clifford@clifford.at>
Fri, 8 Jul 2016 09:49:55 +0000 (11:49 +0200)
committerClifford Wolf <clifford@clifford.at>
Fri, 8 Jul 2016 09:51:04 +0000 (11:51 +0200)
backends/blif/blif.cc

index d5787c23a429819dd439af0d7278b33fcae7e7cb..6a379e67fc665b98c6dc6aa85b3d33a8d62f65aa 100644 (file)
@@ -104,9 +104,9 @@ struct BlifDumper
                cstr_bits_seen.insert(sig);
 
                if (sig.wire == NULL) {
-                       if (sig == RTLIL::State::S0) return config->false_type == "-" ? config->false_out.c_str() : "$false";
-                       if (sig == RTLIL::State::S1) return config->true_type == "-" ? config->true_out.c_str() : "$true";
-                       return config->undef_type == "-" ? config->undef_out.c_str() : "$undef";
+                       if (sig == RTLIL::State::S0) return config->false_type == "-" || config->false_type == "+" ? config->false_out.c_str() : "$false";
+                       if (sig == RTLIL::State::S1) return config->true_type == "-" || config->true_type == "+" ? config->true_out.c_str() : "$true";
+                       return config->undef_type == "-" || config->undef_type == "+" ? config->undef_out.c_str() : "$undef";
                }
 
                std::string str = RTLIL::unescape_id(sig.wire->name);
@@ -204,27 +204,27 @@ struct BlifDumper
 
                if (!config->impltf_mode) {
                        if (!config->false_type.empty()) {
-                               if (config->false_type != "-")
+                               if (config->false_type == "+")
+                                       f << stringf(".names %s\n", config->false_out.c_str());
+                               else if (config->false_type != "-")
                                        f << stringf(".%s %s %s=$false\n", subckt_or_gate(config->false_type),
                                                        config->false_type.c_str(), config->false_out.c_str());
-                               else
-                                       f << stringf(".names %s\n", config->false_out.c_str());
                        } else
                                f << stringf(".names $false\n");
                        if (!config->true_type.empty()) {
-                               if (config->true_type != "-")
+                               if (config->true_type == "+")
+                                       f << stringf(".names %s\n1\n", config->true_out.c_str());
+                               else if (config->true_type != "-")
                                        f << stringf(".%s %s %s=$true\n", subckt_or_gate(config->true_type),
                                                        config->true_type.c_str(), config->true_out.c_str());
-                               else
-                                       f << stringf(".names %s\n1\n", config->true_out.c_str());
                        } else
                                f << stringf(".names $true\n1\n");
                        if (!config->undef_type.empty()) {
-                               if (config->undef_type != "-")
+                               if (config->undef_type == "+")
+                                       f << stringf(".names %s\n", config->undef_out.c_str());
+                               else if (config->undef_type != "-")
                                        f << stringf(".%s %s %s=$undef\n", subckt_or_gate(config->undef_type),
                                                        config->undef_type.c_str(), config->undef_out.c_str());
-                               else
-                                       f << stringf(".names %s\n", config->undef_out.c_str());
                        } else
                                f << stringf(".names $undef\n");
                }
@@ -462,7 +462,9 @@ struct BlifBackend : public Backend {
                log("        use the specified cell types to drive nets that are constant 1, 0, or\n");
                log("        undefined. when '-' is used as <cell-type>, then <out-port> specifies\n");
                log("        the wire name to be used for the constant signal and no cell driving\n");
-               log("        that wire is generated.\n");
+               log("        that wire is generated. when '+' is used as <cell-type>, then <out-port>\n");
+               log("        specifies the wire name to be used for the constant signal and a .names\n");
+               log("        statement is generated to drive the wire.\n");
                log("\n");
                log("    -noalias\n");
                log("        if a net name is aliasing another net name, then by default a net\n");