diff options
author | David Shah <dave@ds0.me> | 2018-10-09 14:19:04 +0100 |
---|---|---|
committer | David Shah <dave@ds0.me> | 2018-10-09 14:19:04 +0100 |
commit | 346cbbdbdc0dbe291bfa96b8b1e6300c911c6e89 (patch) | |
tree | 6d92eb718daee9bd297c9c2ea2abd219398b210b /techlibs/ecp5/brams_init.py | |
parent | 31e22c8b96eea5e833d32dea7d72dfe1556bf7e0 (diff) | |
download | yosys-346cbbdbdc0dbe291bfa96b8b1e6300c911c6e89.tar.gz yosys-346cbbdbdc0dbe291bfa96b8b1e6300c911c6e89.tar.bz2 yosys-346cbbdbdc0dbe291bfa96b8b1e6300c911c6e89.zip |
ecp5: Adding BRAM initialisation and config
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'techlibs/ecp5/brams_init.py')
-rwxr-xr-x | techlibs/ecp5/brams_init.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/techlibs/ecp5/brams_init.py b/techlibs/ecp5/brams_init.py new file mode 100755 index 000000000..6f650b2a9 --- /dev/null +++ b/techlibs/ecp5/brams_init.py @@ -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) |