abc9: tolerate ABC nonzero exit code if output.aig; write before &mfs
authorEddie Hung <eddie@fpgeh.com>
Mon, 20 Apr 2020 18:26:11 +0000 (11:26 -0700)
committerEddie Hung <eddie@fpgeh.com>
Mon, 20 Apr 2020 18:26:11 +0000 (11:26 -0700)
Re-enable mfs for xilinx/ecp5 speculatively -- if it fails, use pre-mfs
result

passes/techmap/abc9_exe.cc
techlibs/ecp5/synth_ecp5.cc
techlibs/xilinx/synth_xilinx.cc

index 1aabbd396020867e20bead2f153a033de311e4c5..bad91a2243ecddfb9f533d69c95a780e4ad06b66 100644 (file)
@@ -222,6 +222,13 @@ void abc9_module(RTLIL::Design *design, std::string script_file, std::string exe
        if (design->scratchpad_get_bool("abc9.nomfs"))
                for (size_t pos = abc9_script.find("&mfs"); pos != std::string::npos; pos = abc9_script.find("&mfs", pos))
                        abc9_script = abc9_script.erase(pos, strlen("&mfs"));
+       else {
+               auto s = stringf("&write -n %s/output.aig; ", tempdir_name.c_str());
+               for (size_t pos = abc9_script.find("&mfs"); pos != std::string::npos; pos = abc9_script.find("&mfs", pos)) {
+                       abc9_script = abc9_script.insert(pos, s);
+                       pos += GetSize(s) + strlen("&mfs");
+               }
+       }
 
        abc9_script += stringf("; &ps -l; &write -n %s/output.aig", tempdir_name.c_str());
        if (design->scratchpad_get_bool("abc9.verify")) {
@@ -276,8 +283,12 @@ void abc9_module(RTLIL::Design *design, std::string script_file, std::string exe
        free(abc9_argv[2]);
        free(abc9_argv[3]);
 #endif
-       if (ret != 0)
-               log_error("ABC: execution of command \"%s\" failed: return code %d.\n", buffer.c_str(), ret);
+       if (ret != 0) {
+               if (check_file_exists(stringf("%s/output.aig", tempdir_name.c_str())))
+                       log_warning("ABC: execution of command \"%s\" failed: return code %d.\n", buffer.c_str(), ret);
+               else
+                       log_error("ABC: execution of command \"%s\" failed: return code %d.\n", buffer.c_str(), ret);
+       }
 }
 
 struct Abc9ExePass : public Pass {
index 31794797812d84092d55ae25d1098cab47b9d769..ab740ea0dfe4e49bba35a9740cf4f81b50a3a649 100644 (file)
@@ -324,8 +324,6 @@ struct SynthEcp5Pass : public ScriptPass
 
                        if (abc9) {
                                run("read_verilog -icells -lib -specify +/abc9_model.v +/ecp5/abc9_model.v");
-                               if (!help_mode && !active_design->scratchpad.count("abc9.nomfs"))
-                                       active_design->scratchpad_set_bool("abc9.nomfs", true);
                                if (nowidelut)
                                        run("abc9 -maxlut 4 -W 200");
                                else
index eb9fa1e8265d2048a246467f4a420457f28310ad..1c190d37e5b6dbb2298c6c7ccaa73d15c15389c5 100644 (file)
@@ -613,8 +613,6 @@ struct SynthXilinxPass : public ScriptPass
                                if (family != "xc7")
                                        log_warning("'synth_xilinx -abc9' not currently supported for the '%s' family, "
                                                        "will use timing for 'xc7' instead.\n", family.c_str());
-                               if (!help_mode && !active_design->scratchpad.count("abc9.nomfs"))
-                                       active_design->scratchpad_set_bool("abc9.nomfs", true);
                                std::string techmap_args = "-map +/xilinx/abc9_map.v -max_iter 1";
                                if (dff_mode)
                                        techmap_args += " -D DFF_MODE";