Merge remote-tracking branch 'origin/master' into ice40dsp
[yosys.git] / techlibs / ecp5 / synth_ecp5.cc
index 3b4185930af67daaa9325de4e4a0c22c67aff8a4..3129ba929f5159779e2a1d8e6722ecd7899805ed 100644 (file)
@@ -2,7 +2,7 @@
  *  yosys -- Yosys Open SYnthesis Suite
  *
  *  Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
- *  Copyright (C) 2018 Clifford Wolf <dave@ds0.me>
+ *  Copyright (C) 2018 David Shah <dave@ds0.me>
  *
  *  Permission to use, copy, modify, and/or distribute this software for any
  *  purpose with or without fee is hereby granted, provided that the above
@@ -71,10 +71,10 @@ struct SynthEcp5Pass : public ScriptPass
                log("        do not use flipflops with CE in output netlist\n");
                log("\n");
                log("    -nobram\n");
-               log("        do not use BRAM cells in output netlist\n");
+               log("        do not use block RAM cells in output netlist\n");
                log("\n");
-               log("    -nodram\n");
-               log("        do not use distributed RAM cells in output netlist\n");
+               log("    -nolutram\n");
+               log("        do not use LUT RAM cells in output netlist\n");
                log("\n");
                log("    -nowidelut\n");
                log("        do not use PFU muxes to implement LUTs larger than LUT4s\n");
@@ -99,7 +99,7 @@ struct SynthEcp5Pass : public ScriptPass
        }
 
        string top_opt, blif_file, edif_file, json_file;
-       bool noccu2, nodffe, nobram, nodram, nowidelut, flatten, retime, abc2, abc9, dsp, vpr;
+       bool noccu2, nodffe, nobram, nolutram, nowidelut, flatten, retime, abc2, abc9, dsp, vpr;
 
        void clear_flags() YS_OVERRIDE
        {
@@ -110,7 +110,7 @@ struct SynthEcp5Pass : public ScriptPass
                noccu2 = false;
                nodffe = false;
                nobram = false;
-               nodram = false;
+               nolutram = false;
                nowidelut = false;
                flatten = true;
                retime = false;
@@ -176,11 +176,11 @@ struct SynthEcp5Pass : public ScriptPass
                                nobram = true;
                                continue;
                        }
-                       if (args[argidx] == "-nodram") {
-                               nodram = true;
+                       if (args[argidx] == "-nolutram" || /*deprecated alias*/ args[argidx] == "-nodram") {
+                               nolutram = true;
                                continue;
                        }
-                       if (args[argidx] == "-nowidelut" || args[argidx] == "-nomux") {
+                       if (args[argidx] == "-nowidelut" || /*deprecated alias*/ args[argidx] == "-nomux") {
                                nowidelut = true;
                                continue;
                        }
@@ -207,6 +207,9 @@ struct SynthEcp5Pass : public ScriptPass
                if (!design->full_selection())
                        log_cmd_error("This command only operates on fully selected designs!\n");
 
+               if (abc9 && retime)
+                               log_cmd_error("-retime option not currently compatible with -abc9!\n");
+
                log_header(design, "Executing SYNTH_ECP5 pass.\n");
                log_push();
 
@@ -257,23 +260,27 @@ struct SynthEcp5Pass : public ScriptPass
                        run("opt_clean");
                }
 
-               if (!nobram && check_label("bram", "(skip if -nobram)"))
+               if (!nobram && check_label("map_bram", "(skip if -nobram)"))
                {
                        run("memory_bram -rules +/ecp5/bram.txt");
                        run("techmap -map +/ecp5/brams_map.v");
                }
 
-               if (!nodram && check_label("dram", "(skip if -nodram)"))
+               if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
                {
-                       run("memory_bram -rules +/ecp5/dram.txt");
-                       run("techmap -map +/ecp5/drams_map.v");
+                       run("memory_bram -rules +/ecp5/lutram.txt");
+                       run("techmap -map +/ecp5/lutrams_map.v");
                }
 
-               if (check_label("fine"))
+               if (check_label("map_ffram"))
                {
                        run("opt -fast -mux_undef -undriven -fine");
                        run("memory_map");
                        run("opt -undriven -fine");
+               }
+
+               if (check_label("map_gates"))
+               {
                        if (noccu2)
                                run("techmap");
                        else