Another bugfix for ice40 and xilinx brams_init make rules

This commit is contained in:
Clifford Wolf 2015-08-16 21:39:34 +02:00
parent aedcfd6fd3
commit 9596fe74de
4 changed files with 9 additions and 9 deletions

View File

@ -12,7 +12,7 @@ EXTRA_OBJS += techlibs/ice40/brams_init.mk
techlibs/ice40/brams_init.mk: techlibs/ice40/brams_init.py techlibs/ice40/brams_init.mk: techlibs/ice40/brams_init.py
$(Q) mkdir -p techlibs/ice40 $(Q) mkdir -p techlibs/ice40
$(P) cd techlibs/ice40 && python $< $(P) python $<
$(Q) touch techlibs/ice40/brams_init.mk $(Q) touch techlibs/ice40/brams_init.mk
techlibs/ice40/brams_init1.vh: techlibs/ice40/brams_init.mk techlibs/ice40/brams_init1.vh: techlibs/ice40/brams_init.mk

View File

@ -11,7 +11,7 @@ def write_init_vh(filename, initbits):
print(" %s%s" % (", ".join(["INIT[%4d]" % initbits[i*256 + 255 - k*8 - l] for l in range(8)]), "," if k != 31 else ""), file=f) print(" %s%s" % (", ".join(["INIT[%4d]" % initbits[i*256 + 255 - k*8 - l] for l in range(8)]), "," if k != 31 else ""), file=f)
print("};", file=f); print("};", file=f);
write_init_vh("brams_init1.vh", [i//2 + 2048*(i%2) for i in range(4096)]) write_init_vh("techlibs/ice40/brams_init1.vh", [i//2 + 2048*(i%2) for i in range(4096)])
write_init_vh("brams_init2.vh", [i//4 + 1024*(i%4) for i in range(4096)]) write_init_vh("techlibs/ice40/brams_init2.vh", [i//4 + 1024*(i%4) for i in range(4096)])
write_init_vh("brams_init3.vh", [i//8 + 512*(i%8) for i in range(4096)]) write_init_vh("techlibs/ice40/brams_init3.vh", [i//8 + 512*(i%8) for i in range(4096)])

View File

@ -11,7 +11,7 @@ EXTRA_OBJS += techlibs/xilinx/brams_init.mk
techlibs/xilinx/brams_init.mk: techlibs/xilinx/brams_init.py techlibs/xilinx/brams_init.mk: techlibs/xilinx/brams_init.py
$(Q) mkdir -p techlibs/xilinx $(Q) mkdir -p techlibs/xilinx
$(P) cd techlibs/xilinx && python $< $(P) python $<
$(Q) touch $@ $(Q) touch $@
techlibs/xilinx/brams_init_36.vh: techlibs/xilinx/brams_init.mk techlibs/xilinx/brams_init_36.vh: techlibs/xilinx/brams_init.mk

View File

@ -3,7 +3,7 @@
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
with open("brams_init_18.vh", "w") as f: with open("techlibs/xilinx/brams_init_18.vh", "w") as f:
for i in range(8): for i in range(8):
init_snippets = ["INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)] init_snippets = ["INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)]
for k in range(4, 256, 4): for k in range(4, 256, 4):
@ -15,7 +15,7 @@ with open("brams_init_18.vh", "w") as f:
init_snippets[k] = "\n " + init_snippets[k] init_snippets[k] = "\n " + init_snippets[k]
print(".INIT_%02X({%s})," % (i, ", ".join(init_snippets)), file=f) print(".INIT_%02X({%s})," % (i, ", ".join(init_snippets)), file=f)
with open("brams_init_36.vh", "w") as f: with open("techlibs/xilinx/brams_init_36.vh", "w") as f:
for i in range(16): for i in range(16):
init_snippets = ["INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)] init_snippets = ["INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)]
for k in range(4, 256, 4): for k in range(4, 256, 4):
@ -27,11 +27,11 @@ with open("brams_init_36.vh", "w") as f:
init_snippets[k] = "\n " + init_snippets[k] init_snippets[k] = "\n " + init_snippets[k]
print(".INIT_%02X({%s})," % (i, ", ".join(init_snippets)), file=f) print(".INIT_%02X({%s})," % (i, ", ".join(init_snippets)), file=f)
with open("brams_init_16.vh", "w") as f: with open("techlibs/xilinx/brams_init_16.vh", "w") as f:
for i in range(64): for i in range(64):
print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f) print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f)
with open("brams_init_32.vh", "w") as f: with open("techlibs/xilinx/brams_init_32.vh", "w") as f:
for i in range(128): for i in range(128):
print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f) print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f)