ecp5: ECP5 synthesis fixes
authorDavid Shah <davey1576@gmail.com>
Mon, 16 Jul 2018 12:33:13 +0000 (14:33 +0200)
committerDavid Shah <davey1576@gmail.com>
Mon, 16 Jul 2018 12:33:13 +0000 (14:33 +0200)
Signed-off-by: David Shah <davey1576@gmail.com>
techlibs/ecp5/arith_map.v
techlibs/ecp5/cells_sim.v
techlibs/ecp5/synth_ecp5.cc

index 05d44b9b4718c6ba566ede133b195d12ad9de3bd..1094c5f8a9aef11e490d2124bff009c4ca68b1f2 100644 (file)
@@ -42,7 +42,7 @@ module _80_ecp5_alu (A, B, CI, BI, X, Y, CO);
        function integer round_up2;
                input integer N;
                begin
-                       round_up2 = ((N / 2) + 1) * 2;
+                       round_up2 = ((N + 1) / 2) * 2;
                end
        endfunction
 
@@ -69,7 +69,7 @@ module _80_ecp5_alu (A, B, CI, BI, X, Y, CO);
                );
 
                assign CO[i] = (AA[i] && BB[i]) || (C[i] && (AA[i] || BB[i]));
-               if (i < Y_WIDTH) begin
+               if (i+1 < Y_WIDTH) begin
                        assign CO[i+1] = FCO[i];
                        assign Y[i+1] = Y1[i];
                end
index 6c53a78ebc7aefb6fb88c708433d55878227828e..1755da24b935130bf0540fbc9593f9309d4a818f 100644 (file)
@@ -67,10 +67,15 @@ module TRELLIS_RAM16X2 (
 
        wire muxwck = (WCKMUX == "INV") ? ~WCK : WCK;
 
-       wire muxwre = (WREMUX == "1") ? 1'b1 :
-                                                         (WREMUX == "0") ? 1'b0 :
-                                                         (WREMUX == "INV") ? ~WRE :
-                                                         WRE;
+       reg muxwre;
+       always @(*)
+               case (WREMUX)
+                       "1": muxwre = 1'b1;
+                       "0": muxwre = 1'b0;
+                       "INV": muxwre = ~WRE;
+                       default: muxwre = WRE;
+               endcase
+
 
        always @(posedge muxwck)
                if (muxwre)
@@ -108,10 +113,14 @@ module TRELLIS_DPR16X4 (
 
        wire muxwck = (WCKMUX == "INV") ? ~WCK : WCK;
 
-       wire muxwre = (WREMUX == "1") ? 1'b1 :
-                                                         (WREMUX == "0") ? 1'b0 :
-                                                         (WREMUX == "INV") ? ~WRE :
-                                                         WRE;
+       reg muxwre;
+       always @(*)
+               case (WREMUX)
+                       "1": muxwre = 1'b1;
+                       "0": muxwre = 1'b0;
+                       "INV": muxwre = ~WRE;
+                       default: muxwre = WRE;
+               endcase
 
        always @(posedge muxwck)
                if (muxwre)
@@ -167,7 +176,7 @@ module DPR16X4C (
        integer i;
        initial begin
                for (i = 0; i < 15; i = i + 1) begin
-                       ram[i] = conv_initval[4*i +: 4];
+                       ram[i] <= conv_initval[4*i +: 4];
                end
        end
 
@@ -189,10 +198,14 @@ module TRELLIS_FF(input CLK, LSR, CE, DI, output reg Q);
        parameter SRMODE = "LSR_OVER_CE";
        parameter REGSET = "RESET";
 
-       wire muxce = (CEMUX == "1") ? 1'b1 :
-                    (CEMUX == "0") ? 1'b0 :
-                                                        (CEMUX == "INV") ? ~CE :
-                                                        CE;
+       reg muxce;
+       always @(*)
+               case (CEMUX)
+                       "1": muxce = 1'b1;
+                       "0": muxce = 1'b0;
+                       "INV": muxce = ~CE;
+                       default: muxce = CE;
+               endcase
 
        wire muxlsr = (LSRMUX == "INV") ? ~LSR : LSR;
        wire muxclk = (CLKMUX == "INV") ? ~CLK : CLK;
index b54bf4204907417f9d779ac10b7a2549b9cc55e7..76051d1a236477fa351a768d1531a73a87d40fef 100644 (file)
@@ -172,6 +172,10 @@ struct SynthEcp5Pass : public ScriptPass
                                nodram = true;
                                continue;
                        }
+                       if (args[argidx] == "-nomux") {
+                               nomux = true;
+                               continue;
+                       }
                        if (args[argidx] == "-abc2") {
                                abc2 = true;
                                continue;