aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/xilinx/brams_init.py
blob: 10057a0cbf5d2268573a0a5d98feb4ae1b86ec16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3

with open("techlibs/xilinx/brams_init_9.vh", "w") as f:
    for i in range(4):
        init_snippets = [" INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)]
        for k in range(4, 256, 4):
            init_snippets[k] = "\n           " + init_snippets[k]
        print(".INITP_%02X({%s})," % (i, ",".join(init_snippets)), file=f)
    for i in range(32):
        init_snippets = [" INIT[%3d*9 +: 8]" % (k+32*i,) for k in range(31, -1, -1)]
        for k in range(4, 32, 4):
            init_snippets[k] = "\n          " + init_snippets[k]
        print(".INIT_%02X({%s})," % (i, ",".join(init_snippets)), file=f)

with open("techlibs/xilinx/brams_init_18.vh", "w") as f:
    for i in range(8):
        init_snippets = [" INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)]
        for k in range(4, 256, 4):
            init_snippets[k] = "\n           " + init_snippets[k]
        print(".INITP_%02X({%s})," % (i, ",".join(init_snippets)), file=f)
    for i in range(64):
        init_snippets = [" INIT[%3d*9 +: 8]" % (k+32*i,) for k in range(31, -1, -1)]
        for k in range(4, 32, 4):
            init_snippets[k] = "\n          " + init_snippets[k]
        print(".INIT_%02X({%s})," % (i, ",".join(init_snippets)), file=f)

with open("techlibs/xilinx/brams_init_36.vh", "w") as f:
    for i in range(16):
        init_snippets = [" INIT[%3d*9+8]" % (k+256*i,) for k in range(255, -1, -1)]
        for k in range(4, 256, 4):
            init_snippets[k] = "\n           " + init_snippets[k]
        print(".INITP_%02X({%s})," % (i, ",".join(init_snippets)), file=f)
    for i in range(128):
        init_snippets = [" INIT[%3d*9 +: 8]" % (k+32*i,) for k in range(31, -1, -1)]
        for k in range(4, 32, 4):
            init_snippets[k] = "\n          " + init_snippets[k]
        print(".INIT_%02X({%s})," % (i, ",".join(init_snippets)), file=f)

with open("techlibs/xilinx/brams_init_8.vh", "w") as f:
    for i in range(32):
        print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f)

with open("techlibs/xilinx/brams_init_16.vh", "w") as f:
    for i in range(64):
        print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f)

with open("techlibs/xilinx/brams_init_32.vh", "w") as f:
    for i in range(128):
        print(".INIT_%02X(INIT[%3d*256 +: 256])," % (i, i), file=f)