-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_init_xx.py
66 lines (56 loc) · 1.39 KB
/
gen_init_xx.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmdstr = (
"set_property INIT_{} {} [get_cells video_pipeline_inst/fb0"
"/ramb64x1_inst_{}/RAMB36E1_lower]"
)
init_vectors = []
# Generate vectors
for i in range(0, 256):
init_vectors.append("{:02X}".format(i))
test_string = """
This is a test string. One, two, three, four, five, six, seven, eight,
nine, ten. Yes, this is quite functional. The following will test the
special characters: ¬!"£$%^&*()_+}{~@?><:,./;'#][=-0987654321`\|"""
memory_rep = []
# Generate memory rep
for i in test_string:
memory_rep.append("{:08b}".format(ord(i)));
# Generate individual vectors
v0 = []
v1 = []
v2 = []
v3 = []
v4 = []
v5 = []
v6 = []
v7 = []
for i in reversed(memory_rep):
v7.append(i[0])
v6.append(i[1])
v5.append(i[2])
v4.append(i[3])
v3.append(i[4])
v2.append(i[5])
v1.append(i[6])
v0.append(i[7])
ramb0 = hex(int("".join(v0), 2))
ramb1 = hex(int("".join(v1), 2))
ramb2 = hex(int("".join(v2), 2))
ramb3 = hex(int("".join(v3), 2))
ramb4 = hex(int("".join(v4), 2))
ramb5 = hex(int("".join(v5), 2))
ramb6 = hex(int("".join(v6), 2))
ramb7 = hex(int("".join(v7), 2))
#print("v7 = " + ramb7)
#print("v6 = " + ramb6)
#print("v5 = " + ramb5)
#print("v4 = " + ramb4)
#print("v3 = " + ramb3)
#print("v2 = " + ramb2)
#print("v1 = " + ramb1)
#print("v0 = " + ramb0)
cmdfile = ""
j = 0
for i in [ramb0, ramb1, ramb2, ramb3, ramb4, ramb5, ramb6, ramb7]:
cmdfile += cmdstr.format("00", i, j) + "\n"
j += 1
print(cmdfile)