gowin: widelut support (#3042)
authorPepijn de Vos <pepijndevos@gmail.com>
Sat, 6 Nov 2021 15:09:30 +0000 (16:09 +0100)
committerGitHub <noreply@github.com>
Sat, 6 Nov 2021 15:09:30 +0000 (16:09 +0100)
passes/opt/opt_lut_ins.cc
techlibs/gowin/synth_gowin.cc

index 99043ef7ea95141f4e75cdb48162feb319db0791..2f7c392b29a6991d59afd1fa80610ed88641e0f3 100644 (file)
@@ -193,6 +193,12 @@ struct OptLutInsPass : public Pass {
                                                                swz += extra;
                                        }
                                }
+                               if (techname == "gowin") {
+                                       // Pad the LUT to 1 input, adding consts from the front.
+                                       if (new_inputs.empty()) {
+                                               new_inputs.insert(new_inputs.begin(), State::S0);
+                                       }
+                               }
                                Const new_lut(0, 1 << GetSize(new_inputs));
                                for (int i = 0; i < GetSize(new_lut); i++) {
                                        int lidx = 0;
@@ -209,9 +215,9 @@ struct OptLutInsPass : public Pass {
                                        }
                                        new_lut[i] = lut[lidx];
                                }
-                               // For ecp5, do not replace with a const driver — the nextpnr
+                               // For ecp5, and gowin do not replace with a const driver — the nextpnr
                                // packer requires a complete set of LUTs for wide LUT muxes.
-                               if (new_inputs.empty() && techname != "ecp5") {
+                               if (new_inputs.empty() && techname != "ecp5" && techname != "gowin") {
                                        // const driver.
                                        remove_cells.push_back(cell);
                                        module->connect(output, new_lut[0]);
index 087f6b8cf45839c73de9dc81f9db7ab10fb60356..f35a7af4da01fa1480391019b2e1cb2749d1764f 100644 (file)
@@ -126,7 +126,6 @@ struct SynthGowinPass : public ScriptPass
                                json_file = args[++argidx];
                                nobram = true;
                                nolutram = true;
-                               nowidelut = true;
                                noalu = true;
                                continue;
                        }