artiq-zynq/test.py

31 lines
729 B
Python
Raw Normal View History

from math import lcm
word_dw = 32
size = 8
sink_dw, source_dw = word_dw, size * 4
shift_reg_size = lcm(sink_dw, source_dw)
if (shift_reg_size // sink_dw) < 2:
shift_reg_size = shift_reg_size * 2
if (shift_reg_size // source_dw) < 2:
shift_reg_size = shift_reg_size * 2
sink_aligned_bound = sink_dw
result = []
for i in range(4, shift_reg_size // size):
if i % 4 == 0:
while not (sink_aligned_bound + sink_dw >= i * size >= sink_aligned_bound):
sink_aligned_bound += word_dw
else:
if sink_aligned_bound + sink_dw >= i * size >= sink_aligned_bound:
result.append(i)
# print(i * size, sink_aligned_bound, sink_aligned_bound + sink_dw)
print(source_dw % sink_dw)