-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_tb.py
27 lines (22 loc) · 941 Bytes
/
generate_tb.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
# File paths
x_memcpy_file = "x_memcpy_operations.txt"
w_memcpy_file = "w_memcpy_operations.txt"
ref_memcpy_file = "ref_memcpy_operations.txt"
# Open files for writing
x_memcpy = open(x_memcpy_file, "w")
w_memcpy = open(w_memcpy_file, "w")
ref_memcpy = open(ref_memcpy_file, "w")
# Memcpy operations for x
for i in range(384):
x_memcpy.write("memcpy(x[" + str(i) + "].X_c, X_c" + str(i + 1) + ", sizeof(X_c" + str(i + 1) + "));\n")
# Memcpy operations for w
for i in range(384):
for j in range(384):
w_memcpy.write("memcpy(w[" + str(i) + "].ith_filter[" + str(j) + "].W_c, filter" + str(i+1) + "_" + str(j+1) + ", sizeof(filter" + str(i) + "_" + str(j) + "));\n")
# Memcpy operations for ref
for i in range(384):
ref_memcpy.write("memcpy(ref[" + str(i) + "].Z_out, zc" + str(i + 1) + ", sizeof(zc" + str(i + 1) + "));\n")
# Close files
x_memcpy.close()
w_memcpy.close()
ref_memcpy.close()