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,31 +152,34 @@ 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)
self.submodules.loop_filter = loop_filter
self.submodules.collector = collector = Collector(N)
self.comb += [ loop_filter = thls.make(filters.helper, data_width=48)
self.collector.tag_ref.eq(self.tag_ref), self.submodules.loop_filter = loop_filter
self.collector.ref_stb.eq(self.input_stb), self.submodules.collector = collector = Collector(N)
self.collector.main_stb.eq(self.input_stb),
self.loop_filter.input.eq(self.collector.out_helper << 22), self.comb += [
self.loop_filter.input_stb.eq(self.collector.out_stb), self.collector.tag_ref.eq(self.tag_ref),
self.adpll.eq(self.loop_filter.output), self.collector.ref_stb.eq(self.input_stb),
self.out_stb.eq(self.loop_filter.output_stb), self.collector.main_stb.eq(self.input_stb),
] self.loop_filter.input.eq(self.collector.out_helper << 22),
pll = WRPLL(N=N) self.loop_filter.input_stb.eq(self.collector.out_stb),
self.adpll.eq(self.loop_filter.output),
self.out_stb.eq(self.loop_filter.output_stb),
]
# check filter against output from MatLab model
def helper_sim():
pll = HelperTB(15)
# check filter against output from MatLab model
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,