mirror of https://github.com/YosysHQ/yosys.git
ecp5: Adding BRAM initialisation and config
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
31e22c8b96
commit
346cbbdbdc
|
@ -0,0 +1,3 @@
|
||||||
|
bram_init_1_2_4.vh
|
||||||
|
bram_init_9_18_36.vh
|
||||||
|
brams_init.mk
|
|
@ -5,4 +5,19 @@ $(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_sim.v))
|
||||||
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/drams_map.v))
|
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/drams_map.v))
|
||||||
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/dram.txt))
|
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/dram.txt))
|
||||||
|
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/bram.txt))
|
||||||
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/arith_map.v))
|
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/arith_map.v))
|
||||||
|
|
||||||
|
EXTRA_OBJS += techlibs/ecp5/brams_init.mk
|
||||||
|
.SECONDARY: techlibs/ecp5/brams_init.mk
|
||||||
|
|
||||||
|
techlibs/ecp5/brams_init.mk: techlibs/ecp5/brams_init.py
|
||||||
|
$(Q) mkdir -p techlibs/ecp5
|
||||||
|
$(P) python3 $<
|
||||||
|
$(Q) touch $@
|
||||||
|
|
||||||
|
techlibs/ecp5/bram_init_1_2_4.vh: techlibs/ecp5/brams_init.mk
|
||||||
|
techlibs/ecp5/bram_init_9_18_36.vh: techlibs/ecp5/brams_init.mk
|
||||||
|
|
||||||
|
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/bram_init_1_2_4.vh))
|
||||||
|
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/bram_init_9_18_36.vh))
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
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 1 2
|
||||||
|
clkpol 2 2
|
||||||
|
endbram
|
||||||
|
|
||||||
|
match $__ECP5_DP16KD
|
||||||
|
min bits 2048
|
||||||
|
min efficiency 5
|
||||||
|
shuffle_enable B
|
||||||
|
endmatch
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
with open("techlibs/ecp5/bram_init_1_2_4.vh", "w") as f:
|
||||||
|
for i in range(0, 0x40):
|
||||||
|
init_snippets = []
|
||||||
|
for j in range(32):
|
||||||
|
init_snippets.append("INIT[%4d*8 +: 8]" % (32 * i + j))
|
||||||
|
init_snippets.append("3'b000" if (j % 2 == 1) else "1'b0")
|
||||||
|
init_snippets = list(reversed(init_snippets))
|
||||||
|
for k in range(8, 64, 8):
|
||||||
|
init_snippets[k] = "\n " + init_snippets[k]
|
||||||
|
print(".INIT_%02X({%s})," % (i, ", ".join(init_snippets)), file=f)
|
||||||
|
|
||||||
|
with open("techlibs/ecp5/bram_init_9_18_36.vh", "w") as f:
|
||||||
|
for i in range(0, 0x40):
|
||||||
|
init_snippets = []
|
||||||
|
for j in range(16):
|
||||||
|
init_snippets.append("INIT[%3d*18 +: 18]" % (16 * i + j))
|
||||||
|
init_snippets.append("2'b00")
|
||||||
|
init_snippets = list(reversed(init_snippets))
|
||||||
|
for k in range(8, 32, 8):
|
||||||
|
init_snippets[k] = "\n " + init_snippets[k]
|
||||||
|
print(".INIT_%02X({%s})," % (i, ", ".join(init_snippets)), file=f)
|
|
@ -472,6 +472,10 @@ module DP16KD(
|
||||||
parameter CSDECODE_A = "0b000";
|
parameter CSDECODE_A = "0b000";
|
||||||
parameter CSDECODE_B = "0b000";
|
parameter CSDECODE_B = "0b000";
|
||||||
|
|
||||||
|
parameter WRITEMODE_A = "NORMAL";
|
||||||
|
parameter WRITEMODE_B = "NORMAL";
|
||||||
|
|
||||||
|
|
||||||
parameter GSR = "ENABLED";
|
parameter GSR = "ENABLED";
|
||||||
|
|
||||||
parameter INITVAL_00 = "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000";
|
parameter INITVAL_00 = "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000";
|
||||||
|
|
Loading…
Reference in New Issue