forked from M-Labs/artiq
1
0
Fork 0

wrpll: clean up matlab comparison test

This commit is contained in:
Sebastien Bourdeauducq 2020-10-08 15:40:15 +08:00
parent cd8c2ce713
commit 6248970ef8
1 changed files with 25 additions and 22 deletions

View File

@ -152,15 +152,15 @@ class WRPLL(Module, AutoCSR):
] ]
def helper_sim(N=15): class HelperTB(Module):
class WRPLL(Module):
def __init__(self, N): def __init__(self, N):
self.tag_ref = Signal(N) self.tag_ref = Signal(N)
self.input_stb = Signal() self.input_stb = Signal()
self.adpll = Signal((24, True)) self.adpll = Signal((24, True))
self.out_stb = Signal() self.out_stb = Signal()
# # # # ###
loop_filter = thls.make(filters.helper, data_width=48) loop_filter = thls.make(filters.helper, data_width=48)
self.submodules.loop_filter = loop_filter self.submodules.loop_filter = loop_filter
self.submodules.collector = collector = Collector(N) self.submodules.collector = collector = Collector(N)
@ -174,9 +174,12 @@ def helper_sim(N=15):
self.adpll.eq(self.loop_filter.output), self.adpll.eq(self.loop_filter.output),
self.out_stb.eq(self.loop_filter.output_stb), self.out_stb.eq(self.loop_filter.output_stb),
] ]
pll = WRPLL(N=N)
# check filter against output from MatLab model
# check filter against output from MatLab model
def helper_sim():
pll = HelperTB(15)
initial_helper_out = -8000 initial_helper_out = -8000
ref_tags = np.array([ ref_tags = np.array([
24778, 16789, 8801, 814, 25596, 17612, 9628, 1646, 24778, 16789, 8801, 814, 25596, 17612, 9628, 1646,