synth_ice40: add -noabc option, to use built-in LUT techmapping.
authorwhitequark <whitequark@whitequark.org>
Wed, 5 Dec 2018 05:24:15 +0000 (05:24 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 5 Dec 2018 17:13:46 +0000 (17:13 +0000)
This should be combined with -relut to get sensible results.

techlibs/ice40/synth_ice40.cc

index cc4627cd35ae32b581b17ecfaf832e97f9e50906..931a190e7c81ad7e8632eea45c52427f0b8369c1 100644 (file)
@@ -79,6 +79,9 @@ struct SynthIce40Pass : public ScriptPass
                log("    -nobram\n");
                log("        do not use SB_RAM40_4K* cells in output netlist\n");
                log("\n");
+               log("    -noabc\n");
+               log("        use built-in Yosys LUT techmapping instead of abc\n");
+               log("\n");
                log("    -abc2\n");
                log("        run two passes of 'abc' for slightly improved logic density\n");
                log("\n");
@@ -93,7 +96,7 @@ struct SynthIce40Pass : public ScriptPass
        }
 
        string top_opt, blif_file, edif_file, json_file;
-       bool nocarry, nodffe, nobram, flatten, retime, relut, abc2, vpr;
+       bool nocarry, nodffe, nobram, flatten, retime, relut, noabc, abc2, vpr;
        int min_ce_use;
 
        void clear_flags() YS_OVERRIDE
@@ -109,6 +112,7 @@ struct SynthIce40Pass : public ScriptPass
                flatten = true;
                retime = false;
                relut = false;
+               noabc = false;
                abc2 = false;
                vpr = false;
        }
@@ -177,6 +181,10 @@ struct SynthIce40Pass : public ScriptPass
                                nobram = true;
                                continue;
                        }
+                       if (args[argidx] == "-noabc") {
+                               noabc = true;
+                               continue;
+                       }
                        if (args[argidx] == "-abc2") {
                                abc2 = true;
                                continue;
@@ -265,7 +273,13 @@ struct SynthIce40Pass : public ScriptPass
                                run("ice40_opt", "(only if -abc2)");
                        }
                        run("techmap -map +/ice40/latches_map.v");
-                       run("abc -lut 4");
+                       if (noabc || help_mode) {
+                               run("simplemap", "                               (only if -noabc)");
+                               run("techmap -map +/gate2lut.v -D LUT_WIDTH=4", "(only if -noabc)");
+                       }
+                       if (!noabc) {
+                               run("abc -lut 4", "(skip if -noabc)");
+                       }
                        run("clean");
                        if (relut || help_mode) {
                                run("ice40_unlut", "                            (only if -relut)");