Harmonize BRAM/LUTRAM descriptions across all of Yosys.
authorwhitequark <whitequark@whitequark.org>
Wed, 1 Jan 2020 12:30:00 +0000 (12:30 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 1 Jan 2020 12:30:00 +0000 (12:30 +0000)
This commit:
  * renames all remaining instances of "DRAM" (which is ambiguous)
    to "LUTRAM" (which is not), finishing the work started in
    the commit 698ab9be;
  * renames memory rule files to brams.txt/lutrams.txt;
  * adds/renames script labels map_bram/map_lutram;
  * extracts where necessary script labels map_ffram and map_gates;
  * adds where necessary options -nobram/-nolutram.

The end result is that BRAM/LUTRAM/FFRAM aspects of every target
are now consistent with each other.

Per architecture:
  * anlogic: rename drams.txt→lutrams.txt, add -nolutram, add
    :map_lutram, :map_ffram, :map_gates
  * ecp5: rename bram.txt→brams.txt, lutram.txt→lutrams.txt
  * efinix: rename bram.txt→brams.txt, add -nobram, add :map_ffram,
    :map_gates
  * gowin: rename bram.txt→brams.txt, dram.txt→lutrams.txt,
    rename -nodram→-nolutram (-nodram still recognized), rename
    :bram→:map_bram, :dram→:map_lutram, add :map_ffram, :map_gates

27 files changed:
techlibs/anlogic/Makefile.inc
techlibs/anlogic/dram_init_16x4.vh [deleted file]
techlibs/anlogic/drams.txt [deleted file]
techlibs/anlogic/drams_map.v [deleted file]
techlibs/anlogic/lutram_init_16x4.vh [new file with mode: 0644]
techlibs/anlogic/lutrams.txt [new file with mode: 0644]
techlibs/anlogic/lutrams_map.v [new file with mode: 0644]
techlibs/anlogic/synth_anlogic.cc
techlibs/ecp5/Makefile.inc
techlibs/ecp5/bram.txt [deleted file]
techlibs/ecp5/brams.txt [new file with mode: 0644]
techlibs/ecp5/lutram.txt [deleted file]
techlibs/ecp5/lutrams.txt [new file with mode: 0644]
techlibs/ecp5/synth_ecp5.cc
techlibs/efinix/Makefile.inc
techlibs/efinix/bram.txt [deleted file]
techlibs/efinix/brams.txt [new file with mode: 0644]
techlibs/efinix/synth_efinix.cc
techlibs/gowin/Makefile.inc
techlibs/gowin/bram.txt [deleted file]
techlibs/gowin/brams.txt [new file with mode: 0644]
techlibs/gowin/dram.txt [deleted file]
techlibs/gowin/drams_map.v [deleted file]
techlibs/gowin/lutrams.txt [new file with mode: 0644]
techlibs/gowin/lutrams_map.v [new file with mode: 0644]
techlibs/gowin/synth_gowin.cc
techlibs/intel/synth_intel.cc

index 9426b5ca545345547e228bfbcba2453edceedea1..2d8d65e2e41978e5281bbd7f5a39387ed98d76e0 100644 (file)
@@ -7,6 +7,6 @@ $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/cells_map.v))
 $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/arith_map.v))
 $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/cells_sim.v))
 $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/eagle_bb.v))
-$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/drams.txt))
-$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/drams_map.v))
-$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/dram_init_16x4.vh))
+$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/lutrams.txt))
+$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/lutrams_map.v))
+$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/lutram_init_16x4.vh))
diff --git a/techlibs/anlogic/dram_init_16x4.vh b/techlibs/anlogic/dram_init_16x4.vh
deleted file mode 100644 (file)
index 32fb157..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-.INIT_D0({INIT[15*4+0], INIT[14*4+0], INIT[13*4+0], INIT[12*4+0],
-         INIT[11*4+0], INIT[10*4+0], INIT[9*4+0], INIT[8*4+0],
-         INIT[7*4+0], INIT[6*4+0], INIT[5*4+0], INIT[4*4+0],
-         INIT[3*4+0], INIT[2*4+0], INIT[1*4+0], INIT[0*4+0]}),
-.INIT_D1({INIT[15*4+1], INIT[14*4+1], INIT[13*4+1], INIT[12*4+1],
-         INIT[11*4+1], INIT[10*4+1], INIT[9*4+1], INIT[8*4+1],
-         INIT[7*4+1], INIT[6*4+1], INIT[5*4+1], INIT[4*4+1],
-         INIT[3*4+1], INIT[2*4+1], INIT[1*4+1], INIT[0*4+1]}),
-.INIT_D2({INIT[15*4+2], INIT[14*4+2], INIT[13*4+2], INIT[12*4+2],
-         INIT[11*4+2], INIT[10*4+2], INIT[9*4+2], INIT[8*4+2],
-         INIT[7*4+2], INIT[6*4+2], INIT[5*4+2], INIT[4*4+2],
-         INIT[3*4+2], INIT[2*4+2], INIT[1*4+2], INIT[0*4+2]}),
-.INIT_D3({INIT[15*4+3], INIT[14*4+3], INIT[13*4+3], INIT[12*4+3],
-         INIT[11*4+3], INIT[10*4+3], INIT[9*4+3], INIT[8*4+3],
-         INIT[7*4+3], INIT[6*4+3], INIT[5*4+3], INIT[4*4+3],
-         INIT[3*4+3], INIT[2*4+3], INIT[1*4+3], INIT[0*4+3]})
diff --git a/techlibs/anlogic/drams.txt b/techlibs/anlogic/drams.txt
deleted file mode 100644 (file)
index 4e903c0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-bram $__ANLOGIC_DRAM16X4
-  init 1
-  abits 4
-  dbits 4
-  groups 2
-  ports  1 1
-  wrmode 0 1
-  enable 0 1
-  transp 0 0
-  clocks 0 1
-  clkpol 0 1
-endbram
-
-match $__ANLOGIC_DRAM16X4
-  make_outreg
-endmatch
diff --git a/techlibs/anlogic/drams_map.v b/techlibs/anlogic/drams_map.v
deleted file mode 100644 (file)
index 084e2a2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-module \$__ANLOGIC_DRAM16X4 (CLK1, A1ADDR, A1DATA, B1ADDR, B1DATA, B1EN);
-       parameter [63:0]INIT = 64'bx;
-       input CLK1;
-
-       input [3:0] A1ADDR;
-       output [3:0] A1DATA;
-
-       input [3:0] B1ADDR;
-       input [3:0] B1DATA;
-       input B1EN;
-
-       EG_LOGIC_DRAM16X4 #(
-               `include "dram_init_16x4.vh"
-       ) _TECHMAP_REPLACE_ (
-               .di(B1DATA),
-               .waddr(B1ADDR),
-               .wclk(CLK1),
-               .we(B1EN),
-               .raddr(A1ADDR),
-               .do(A1DATA)
-       );
-endmodule
diff --git a/techlibs/anlogic/lutram_init_16x4.vh b/techlibs/anlogic/lutram_init_16x4.vh
new file mode 100644 (file)
index 0000000..32fb157
--- /dev/null
@@ -0,0 +1,16 @@
+.INIT_D0({INIT[15*4+0], INIT[14*4+0], INIT[13*4+0], INIT[12*4+0],
+         INIT[11*4+0], INIT[10*4+0], INIT[9*4+0], INIT[8*4+0],
+         INIT[7*4+0], INIT[6*4+0], INIT[5*4+0], INIT[4*4+0],
+         INIT[3*4+0], INIT[2*4+0], INIT[1*4+0], INIT[0*4+0]}),
+.INIT_D1({INIT[15*4+1], INIT[14*4+1], INIT[13*4+1], INIT[12*4+1],
+         INIT[11*4+1], INIT[10*4+1], INIT[9*4+1], INIT[8*4+1],
+         INIT[7*4+1], INIT[6*4+1], INIT[5*4+1], INIT[4*4+1],
+         INIT[3*4+1], INIT[2*4+1], INIT[1*4+1], INIT[0*4+1]}),
+.INIT_D2({INIT[15*4+2], INIT[14*4+2], INIT[13*4+2], INIT[12*4+2],
+         INIT[11*4+2], INIT[10*4+2], INIT[9*4+2], INIT[8*4+2],
+         INIT[7*4+2], INIT[6*4+2], INIT[5*4+2], INIT[4*4+2],
+         INIT[3*4+2], INIT[2*4+2], INIT[1*4+2], INIT[0*4+2]}),
+.INIT_D3({INIT[15*4+3], INIT[14*4+3], INIT[13*4+3], INIT[12*4+3],
+         INIT[11*4+3], INIT[10*4+3], INIT[9*4+3], INIT[8*4+3],
+         INIT[7*4+3], INIT[6*4+3], INIT[5*4+3], INIT[4*4+3],
+         INIT[3*4+3], INIT[2*4+3], INIT[1*4+3], INIT[0*4+3]})
diff --git a/techlibs/anlogic/lutrams.txt b/techlibs/anlogic/lutrams.txt
new file mode 100644 (file)
index 0000000..4e903c0
--- /dev/null
@@ -0,0 +1,16 @@
+bram $__ANLOGIC_DRAM16X4
+  init 1
+  abits 4
+  dbits 4
+  groups 2
+  ports  1 1
+  wrmode 0 1
+  enable 0 1
+  transp 0 0
+  clocks 0 1
+  clkpol 0 1
+endbram
+
+match $__ANLOGIC_DRAM16X4
+  make_outreg
+endmatch
diff --git a/techlibs/anlogic/lutrams_map.v b/techlibs/anlogic/lutrams_map.v
new file mode 100644 (file)
index 0000000..5a464ca
--- /dev/null
@@ -0,0 +1,22 @@
+module \$__ANLOGIC_DRAM16X4 (CLK1, A1ADDR, A1DATA, B1ADDR, B1DATA, B1EN);
+       parameter [63:0]INIT = 64'bx;
+       input CLK1;
+
+       input [3:0] A1ADDR;
+       output [3:0] A1DATA;
+
+       input [3:0] B1ADDR;
+       input [3:0] B1DATA;
+       input B1EN;
+
+       EG_LOGIC_DRAM16X4 #(
+               `include "lutram_init_16x4.vh"
+       ) _TECHMAP_REPLACE_ (
+               .di(B1DATA),
+               .waddr(B1ADDR),
+               .wclk(CLK1),
+               .we(B1EN),
+               .raddr(A1ADDR),
+               .do(A1DATA)
+       );
+endmodule
index b87fc8566e2fa815ad4e90784e06686b38e54005..3a199258881fb7035e31521994484d83556afe44 100644 (file)
@@ -60,6 +60,9 @@ struct SynthAnlogicPass : public ScriptPass
                log("    -retime\n");
                log("        run 'abc' with -dff option\n");
                log("\n");
+               log("    -nolutram\n");
+               log("        do not use EG_LOGIC_DRAM16X4 cells in output netlist\n");
+               log("\n");
                log("\n");
                log("The following commands are executed by this synthesis command:\n");
                help_script();
@@ -67,7 +70,7 @@ struct SynthAnlogicPass : public ScriptPass
        }
 
        string top_opt, edif_file, json_file;
-       bool flatten, retime;
+       bool flatten, retime, nolutram;
 
        void clear_flags() YS_OVERRIDE
        {
@@ -76,6 +79,7 @@ struct SynthAnlogicPass : public ScriptPass
                json_file = "";
                flatten = true;
                retime = false;
+               nolutram = false;
        }
 
        void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
@@ -110,6 +114,10 @@ struct SynthAnlogicPass : public ScriptPass
                                flatten = false;
                                continue;
                        }
+                       if (args[argidx] == "-nolutram") {
+                               nolutram = true;
+                               continue;
+                       }
                        if (args[argidx] == "-retime") {
                                retime = true;
                                continue;
@@ -150,18 +158,22 @@ struct SynthAnlogicPass : public ScriptPass
                        run("synth -run coarse");
                }
 
-               if (check_label("dram"))
+               if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
                {
-                       run("memory_bram -rules +/anlogic/drams.txt");
-                       run("techmap -map +/anlogic/drams_map.v");
+                       run("memory_bram -rules +/anlogic/lutrams.txt");
+                       run("techmap -map +/anlogic/lutrams_map.v");
                        run("setundef -zero -params t:EG_LOGIC_DRAM16X4");
                }
 
-               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"))
+               {
                        run("techmap -map +/techmap.v -map +/anlogic/arith_map.v");
                        if (retime || help_mode)
                                run("abc -dff", "(only if -retime)");
@@ -187,7 +199,7 @@ struct SynthAnlogicPass : public ScriptPass
                        run("techmap -map +/anlogic/cells_map.v");
                        run("clean");
                }
-               
+
                if (check_label("map_anlogic"))
                {
                        run("anlogic_fixcarry");
index 46463f51051105ec4c8573e82838d0cf69a283f0..2c33f23b9b599cf2c94ab98eca796a8c45865cdd 100644 (file)
@@ -8,9 +8,9 @@ $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_map.v))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_sim.v))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_bb.v))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutrams_map.v))
-$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutram.txt))
+$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutrams.txt))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/brams_map.v))
-$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/bram.txt))
+$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/brams.txt))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/arith_map.v))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/latches_map.v))
 $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/dsp_map.v))
diff --git a/techlibs/ecp5/bram.txt b/techlibs/ecp5/bram.txt
deleted file mode 100644 (file)
index 777ccaa..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-bram $__ECP5_PDPW16KD
-  init 1
-
-  abits 9
-  dbits 36
-
-  groups 2
-  ports 1 1
-  wrmode 1 0
-  enable 4 1
-  transp 0 0
-  clocks 2 3
-  clkpol 2 3
-endbram
-
-bram $__ECP5_DP16KD
-  init 1
-
-  abits 10 @a10d18
-  dbits 18 @a10d18
-  abits 11 @a11d9
-  dbits 9  @a11d9
-  abits 12 @a12d4
-  dbits 4  @a12d4
-  abits 13 @a13d2
-  dbits 2  @a13d2
-  abits 14 @a14d1
-  dbits 1  @a14d1
-
-  groups 2
-  ports 1 1
-  wrmode 1 0
-  enable 2 1 @a10d18
-  enable 1 1 @a11d9 @a12d4 @a13d2 @a14d1
-  transp 0 2
-  clocks 2 3
-  clkpol 2 3
-endbram
-
-match $__ECP5_PDPW16KD
-  min bits 2048
-  min efficiency 5
-  shuffle_enable A
-  make_transp
-  or_next_if_better
-endmatch
-
-match $__ECP5_DP16KD
-  min bits 2048
-  min efficiency 5
-  shuffle_enable A
-endmatch
diff --git a/techlibs/ecp5/brams.txt b/techlibs/ecp5/brams.txt
new file mode 100644 (file)
index 0000000..777ccaa
--- /dev/null
@@ -0,0 +1,52 @@
+bram $__ECP5_PDPW16KD
+  init 1
+
+  abits 9
+  dbits 36
+
+  groups 2
+  ports 1 1
+  wrmode 1 0
+  enable 4 1
+  transp 0 0
+  clocks 2 3
+  clkpol 2 3
+endbram
+
+bram $__ECP5_DP16KD
+  init 1
+
+  abits 10 @a10d18
+  dbits 18 @a10d18
+  abits 11 @a11d9
+  dbits 9  @a11d9
+  abits 12 @a12d4
+  dbits 4  @a12d4
+  abits 13 @a13d2
+  dbits 2  @a13d2
+  abits 14 @a14d1
+  dbits 1  @a14d1
+
+  groups 2
+  ports 1 1
+  wrmode 1 0
+  enable 2 1 @a10d18
+  enable 1 1 @a11d9 @a12d4 @a13d2 @a14d1
+  transp 0 2
+  clocks 2 3
+  clkpol 2 3
+endbram
+
+match $__ECP5_PDPW16KD
+  min bits 2048
+  min efficiency 5
+  shuffle_enable A
+  make_transp
+  or_next_if_better
+endmatch
+
+match $__ECP5_DP16KD
+  min bits 2048
+  min efficiency 5
+  shuffle_enable A
+endmatch
diff --git a/techlibs/ecp5/lutram.txt b/techlibs/ecp5/lutram.txt
deleted file mode 100644 (file)
index b943574..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-bram $__TRELLIS_DPR16X4
-  init 1
-  abits 4
-  dbits 4
-  groups 2
-  ports  1 1
-  wrmode 0 1
-  enable 0 1
-  transp 0 0
-  clocks 0 1
-  clkpol 0 2
-endbram
-
-match $__TRELLIS_DPR16X4
-  make_outreg
-  min wports 1
-endmatch
diff --git a/techlibs/ecp5/lutrams.txt b/techlibs/ecp5/lutrams.txt
new file mode 100644 (file)
index 0000000..b943574
--- /dev/null
@@ -0,0 +1,17 @@
+bram $__TRELLIS_DPR16X4
+  init 1
+  abits 4
+  dbits 4
+  groups 2
+  ports  1 1
+  wrmode 0 1
+  enable 0 1
+  transp 0 0
+  clocks 0 1
+  clkpol 0 2
+endbram
+
+match $__TRELLIS_DPR16X4
+  make_outreg
+  min wports 1
+endmatch
index a0ea6d1f98521bbfa0513470b26e16b3c4bcdeed..3985da57af12b478816ad76e51ccae3fe12e6449 100644 (file)
@@ -266,13 +266,13 @@ struct SynthEcp5Pass : public ScriptPass
 
                if (!nobram && check_label("map_bram", "(skip if -nobram)"))
                {
-                       run("memory_bram -rules +/ecp5/bram.txt");
+                       run("memory_bram -rules +/ecp5/brams.txt");
                        run("techmap -map +/ecp5/brams_map.v");
                }
 
                if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
                {
-                       run("memory_bram -rules +/ecp5/lutram.txt");
+                       run("memory_bram -rules +/ecp5/lutrams.txt");
                        run("techmap -map +/ecp5/lutrams_map.v");
                }
 
index 5013f7fc135f0cc937a227350863d5e2a0cb873b..69665982c88c5b63cea38ecedb6a04e3f4b67111 100644 (file)
@@ -7,4 +7,4 @@ $(eval $(call add_share_file,share/efinix,techlibs/efinix/cells_map.v))
 $(eval $(call add_share_file,share/efinix,techlibs/efinix/arith_map.v))
 $(eval $(call add_share_file,share/efinix,techlibs/efinix/cells_sim.v))
 $(eval $(call add_share_file,share/efinix,techlibs/efinix/brams_map.v))
-$(eval $(call add_share_file,share/efinix,techlibs/efinix/bram.txt))
+$(eval $(call add_share_file,share/efinix,techlibs/efinix/brams.txt))
diff --git a/techlibs/efinix/bram.txt b/techlibs/efinix/bram.txt
deleted file mode 100644 (file)
index 0b3fd93..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-bram $__EFINIX_5K
-  init 1
-
-  abits 8  @a8d16
-  dbits 16 @a8d16
-  abits 9  @a9d8
-  dbits 8  @a9d8
-  abits 10 @a10d4
-  dbits 4  @a10d4
-  abits 11 @a11d2
-  dbits 2  @a11d2
-  abits 12 @a12d1
-  dbits 1  @a12d1
-  abits 8  @a8d20
-  dbits 20 @a8d20
-  abits 9  @a9d10
-  dbits 10 @a9d10
-
-  groups 2
-  ports 1 1
-  wrmode 1 0
-  enable 1 1
-  transp 0 2
-  clocks 2 3
-  clkpol 2 3
-endbram
-
-match $__EFINIX_5K
-  min bits 256
-  min efficiency 5
-  shuffle_enable B
-endmatch
diff --git a/techlibs/efinix/brams.txt b/techlibs/efinix/brams.txt
new file mode 100644 (file)
index 0000000..0b3fd93
--- /dev/null
@@ -0,0 +1,32 @@
+bram $__EFINIX_5K
+  init 1
+
+  abits 8  @a8d16
+  dbits 16 @a8d16
+  abits 9  @a9d8
+  dbits 8  @a9d8
+  abits 10 @a10d4
+  dbits 4  @a10d4
+  abits 11 @a11d2
+  dbits 2  @a11d2
+  abits 12 @a12d1
+  dbits 1  @a12d1
+  abits 8  @a8d20
+  dbits 20 @a8d20
+  abits 9  @a9d10
+  dbits 10 @a9d10
+
+  groups 2
+  ports 1 1
+  wrmode 1 0
+  enable 1 1
+  transp 0 2
+  clocks 2 3
+  clkpol 2 3
+endbram
+
+match $__EFINIX_5K
+  min bits 256
+  min efficiency 5
+  shuffle_enable B
+endmatch
index 26a8d4edac05258562837eedc431b5b183825d37..3e52743855afc02f05d4299bc714563ded5af5b8 100644 (file)
@@ -60,6 +60,9 @@ struct SynthEfinixPass : public ScriptPass
                log("    -retime\n");
                log("        run 'abc' with -dff option\n");
                log("\n");
+               log("    -nobram\n");
+               log("        do not use EFX_RAM_5K cells in output netlist\n");
+               log("\n");
                log("\n");
                log("The following commands are executed by this synthesis command:\n");
                help_script();
@@ -67,7 +70,7 @@ struct SynthEfinixPass : public ScriptPass
        }
 
        string top_opt, edif_file, json_file;
-       bool flatten, retime;
+       bool flatten, retime, nobram;
 
        void clear_flags() YS_OVERRIDE
        {
@@ -76,6 +79,7 @@ struct SynthEfinixPass : public ScriptPass
                json_file = "";
                flatten = true;
                retime = false;
+               nobram = false;
        }
 
        void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
@@ -114,6 +118,10 @@ struct SynthEfinixPass : public ScriptPass
                                retime = true;
                                continue;
                        }
+                       if (args[argidx] == "-nobram") {
+                               nobram = true;
+                               continue;
+                       }
                        break;
                }
                extra_args(args, argidx, design);
@@ -150,18 +158,22 @@ struct SynthEfinixPass : public ScriptPass
                        run("synth -run coarse");
                }
 
-               if (check_label("map_bram", "(skip if -nobram)"))
+               if (!nobram || check_label("map_bram", "(skip if -nobram)"))
                {
-                       run("memory_bram -rules +/efinix/bram.txt");
+                       run("memory_bram -rules +/efinix/brams.txt");
                        run("techmap -map +/efinix/brams_map.v");
                        run("setundef -zero -params t:EFX_RAM_5K");
                }
 
-               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"))
+               {
                        run("techmap -map +/techmap.v -map +/efinix/arith_map.v");
                        if (retime || help_mode)
                                run("abc -dff", "(only if -retime)");
@@ -194,7 +206,7 @@ struct SynthEfinixPass : public ScriptPass
                        run("efinix_fixcarry");
                        run("clean");
                }
-               
+
                if (check_label("check"))
                {
                        run("hierarchy -check");
index d2853704bc2438833cc7f4b4e4c0ae6a7b7fc3dd..fe5d9d6e620738b812a3efec3b429d0a019c4484 100644 (file)
@@ -7,9 +7,9 @@ $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_map.v))
 $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_sim.v))
 $(eval $(call add_share_file,share/gowin,techlibs/gowin/arith_map.v))
 $(eval $(call add_share_file,share/gowin,techlibs/gowin/brams_map.v))
-$(eval $(call add_share_file,share/gowin,techlibs/gowin/bram.txt))
-$(eval $(call add_share_file,share/gowin,techlibs/gowin/drams_map.v))
-$(eval $(call add_share_file,share/gowin,techlibs/gowin/dram.txt))
+$(eval $(call add_share_file,share/gowin,techlibs/gowin/brams.txt))
+$(eval $(call add_share_file,share/gowin,techlibs/gowin/lutrams_map.v))
+$(eval $(call add_share_file,share/gowin,techlibs/gowin/lutrams.txt))
 
 
 
diff --git a/techlibs/gowin/bram.txt b/techlibs/gowin/bram.txt
deleted file mode 100644 (file)
index e406f9c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-bram $__GW1NR_SDP
-  init 1
-  abits 9 @a9d36
-  dbits 32 @a9d36
-  abits 10 @a10d18
-  dbits 16 @a10d18
-  abits 11 @a11d9
-  dbits 8  @a11d9
-  abits 12 @a12d4
-  dbits 4  @a12d4
-  abits 13 @a13d2
-  dbits 2  @a13d2
-  abits 14 @a14d1
-  dbits 1  @a14d1
-  groups 2
-  ports  1 1
-  wrmode 1 0
-  enable 4 1 @a9d36
-  enable 2 1 @a10d18
-  enable 1 1 @a11d9 @a12d4 @a13d2 @a14d1
-  transp 0 0
-  clocks 2 3
-  clkpol 2 3
-endbram
-
-match $__GW1NR_SDP
-  min bits 2048
-  min efficiency 5
-  shuffle_enable A
-  make_transp
-endmatch
diff --git a/techlibs/gowin/brams.txt b/techlibs/gowin/brams.txt
new file mode 100644 (file)
index 0000000..e406f9c
--- /dev/null
@@ -0,0 +1,31 @@
+bram $__GW1NR_SDP
+  init 1
+  abits 9 @a9d36
+  dbits 32 @a9d36
+  abits 10 @a10d18
+  dbits 16 @a10d18
+  abits 11 @a11d9
+  dbits 8  @a11d9
+  abits 12 @a12d4
+  dbits 4  @a12d4
+  abits 13 @a13d2
+  dbits 2  @a13d2
+  abits 14 @a14d1
+  dbits 1  @a14d1
+  groups 2
+  ports  1 1
+  wrmode 1 0
+  enable 4 1 @a9d36
+  enable 2 1 @a10d18
+  enable 1 1 @a11d9 @a12d4 @a13d2 @a14d1
+  transp 0 0
+  clocks 2 3
+  clkpol 2 3
+endbram
+
+match $__GW1NR_SDP
+  min bits 2048
+  min efficiency 5
+  shuffle_enable A
+  make_transp
+endmatch
diff --git a/techlibs/gowin/dram.txt b/techlibs/gowin/dram.txt
deleted file mode 100644 (file)
index 9db5302..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-bram $__GW1NR_RAM16S4
-  init 1
-  abits 4
-  dbits 4
-  groups 2
-  ports  1 1
-  wrmode 0 1
-  enable 0 1
-  transp 0 1
-  clocks 0 1
-  clkpol 0 1
-endbram
-
-match $__GW1NR_RAM16S4
-  make_outreg
-  min wports 1
-endmatch
diff --git a/techlibs/gowin/drams_map.v b/techlibs/gowin/drams_map.v
deleted file mode 100644 (file)
index a50ab36..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-module \$__GW1NR_RAM16S4 (CLK1, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN);
-       parameter CFG_ABITS = 4;
-       parameter CFG_DBITS = 4;
-
-        parameter [63:0] INIT = 64'bx;
-       input CLK1;
-
-       input  [CFG_ABITS-1:0] A1ADDR;
-       output [CFG_DBITS-1:0] A1DATA;   
-        input                  A1EN;
-
-       input  [CFG_ABITS-1:0] B1ADDR;
-       input  [CFG_DBITS-1:0] B1DATA;
-       input  B1EN;
-
-        `include "brams_init3.vh"
-
-  RAM16S4
-   #(.INIT_0(INIT_0),
-     .INIT_1(INIT_1),
-     .INIT_2(INIT_2),
-     .INIT_3(INIT_3))
-   _TECHMAP_REPLACE_
-     (.AD(B1ADDR),
-      .DI(B1DATA),
-      .DO(A1DATA),
-      .CLK(CLK1),
-      .WRE(B1EN));
-
-       
-endmodule
diff --git a/techlibs/gowin/lutrams.txt b/techlibs/gowin/lutrams.txt
new file mode 100644 (file)
index 0000000..9db5302
--- /dev/null
@@ -0,0 +1,17 @@
+bram $__GW1NR_RAM16S4
+  init 1
+  abits 4
+  dbits 4
+  groups 2
+  ports  1 1
+  wrmode 0 1
+  enable 0 1
+  transp 0 1
+  clocks 0 1
+  clkpol 0 1
+endbram
+
+match $__GW1NR_RAM16S4
+  make_outreg
+  min wports 1
+endmatch
diff --git a/techlibs/gowin/lutrams_map.v b/techlibs/gowin/lutrams_map.v
new file mode 100644 (file)
index 0000000..a50ab36
--- /dev/null
@@ -0,0 +1,31 @@
+module \$__GW1NR_RAM16S4 (CLK1, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN);
+       parameter CFG_ABITS = 4;
+       parameter CFG_DBITS = 4;
+
+        parameter [63:0] INIT = 64'bx;
+       input CLK1;
+
+       input  [CFG_ABITS-1:0] A1ADDR;
+       output [CFG_DBITS-1:0] A1DATA;   
+        input                  A1EN;
+
+       input  [CFG_ABITS-1:0] B1ADDR;
+       input  [CFG_DBITS-1:0] B1DATA;
+       input  B1EN;
+
+        `include "brams_init3.vh"
+
+  RAM16S4
+   #(.INIT_0(INIT_0),
+     .INIT_1(INIT_1),
+     .INIT_2(INIT_2),
+     .INIT_3(INIT_3))
+   _TECHMAP_REPLACE_
+     (.AD(B1ADDR),
+      .DI(B1DATA),
+      .DO(A1DATA),
+      .CLK(CLK1),
+      .WRE(B1EN));
+
+       
+endmodule
index 6cf058f292a8ea0f22b06fc6c55e7f113e96d241..785f2802b349f12c0fdd21e66b7705ef6515788a 100644 (file)
@@ -55,7 +55,7 @@ struct SynthGowinPass : public ScriptPass
                log("    -nobram\n");
                log("        do not use BRAM cells in output netlist\n");
                log("\n");
-               log("    -nodram\n");
+               log("    -nolutram\n");
                log("        do not use distributed RAM cells in output netlist\n");
                log("\n");
                log("    -noflatten\n");
@@ -80,7 +80,7 @@ struct SynthGowinPass : public ScriptPass
        }
 
        string top_opt, vout_file;
-       bool retime, nobram, nodram, flatten, nodffe, nowidelut, abc9, noiopads;
+       bool retime, nobram, nolutram, flatten, nodffe, nowidelut, abc9, noiopads;
 
        void clear_flags() YS_OVERRIDE
        {
@@ -90,7 +90,7 @@ struct SynthGowinPass : public ScriptPass
                flatten = true;
                nobram = false;
                nodffe = false;
-               nodram = false;
+               nolutram = false;
                nowidelut = false;
                abc9 = false;
                noiopads = false;
@@ -128,8 +128,8 @@ struct SynthGowinPass : public ScriptPass
                                nobram = true;
                                continue;
                        }
-                       if (args[argidx] == "-nodram") {
-                               nodram = true;
+                       if (args[argidx] == "-nolutram" || /*deprecated*/args[argidx] == "-nodram") {
+                               nolutram = true;
                                continue;
                        }
                        if (args[argidx] == "-nodffe") {
@@ -188,24 +188,28 @@ struct SynthGowinPass : public ScriptPass
                        run("synth -run coarse");
                }
 
-               if (!nobram && check_label("bram", "(skip if -nobram)"))
+               if (!nobram && check_label("map_bram", "(skip if -nobram)"))
                {
-                       run("memory_bram -rules +/gowin/bram.txt");
+                       run("memory_bram -rules +/gowin/brams.txt");
                        run("techmap -map +/gowin/brams_map.v -map +/gowin/cells_sim.v");
                }
 
-               if (!nodram && check_label("dram", "(skip if -nodram)"))
+               if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
                {
-                       run("memory_bram -rules +/gowin/dram.txt");
-                       run("techmap -map +/gowin/drams_map.v");
+                       run("memory_bram -rules +/gowin/lutrams.txt");
+                       run("techmap -map +/gowin/lutrams_map.v");
                        run("determine_init");
                }
 
-               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"))
+               {
                        run("techmap -map +/techmap.v -map +/gowin/arith_map.v");
                        run("techmap -map +/techmap.v");
                        if (retime || help_mode)
@@ -248,7 +252,6 @@ struct SynthGowinPass : public ScriptPass
                                run("iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O "
                                        "-toutpad TBUF OEN:I:O -tinoutpad IOBUF OEN:O:I:IO", "(unless -noiopads)");
                        run("clean");
-
                }
 
                if (check_label("check"))
index c8c690e45a930433b3241779afdaa779f754e420..5aa1a12d4094bd7fe0cce9090e9669aa4d3dfd46 100644 (file)
@@ -187,10 +187,10 @@ struct SynthIntelPass : public ScriptPass {
                }
 
                if (!nobram && check_label("map_bram", "(skip if -nobram)")) {
-                        if (family_opt == "cycloneiv" ||
-                            family_opt == "cycloneive" ||
-                            family_opt == "max10" ||
-                            help_mode) {
+                               if (family_opt == "cycloneiv" ||
+                                   family_opt == "cycloneive" ||
+                                   family_opt == "max10" ||
+                                   help_mode) {
                                run("memory_bram -rules +/intel/common/brams_m9k.txt", "(if applicable for family)");
                                run("techmap -map +/intel/common/brams_map_m9k.v", "(if applicable for family)");
                        } else {
@@ -224,7 +224,7 @@ struct SynthIntelPass : public ScriptPass {
                if (check_label("map_cells")) {
                        if (iopads || help_mode)
                                run("iopadmap -bits -outpad $__outpad I:O -inpad $__inpad O:I", "(if -iopads)");
-                        run(stringf("techmap -map +/intel/%s/cells_map.v", family_opt.c_str()));
+                       run(stringf("techmap -map +/intel/%s/cells_map.v", family_opt.c_str()));
                        run("dffinit -highlow -ff dffeas q power_up");
                        run("clean -purge");
                }