mirror of
https://github.com/enjoy-digital/usb3_pipe.git
synced 2025-01-04 10:18:41 +08:00
training: be sure to only assert detected one cycle
This commit is contained in:
parent
68b726be80
commit
7bfd22de78
@ -14,13 +14,15 @@ class TestTraining(unittest.TestCase):
|
||||
tseq_length = len(TSEQ.to_bytes())//4
|
||||
tseq_words = [int.from_bytes(TSEQ.to_bytes()[4*i:4*(i+1)], "little") for i in range(tseq_length)]
|
||||
def generator(dut, n_loops):
|
||||
yield dut.sink.valid.eq(1)
|
||||
for i in range(n_loops):
|
||||
for j in range(tseq_length):
|
||||
yield dut.sink.valid.eq(1)
|
||||
yield dut.sink.ctrl.eq(j == 0)
|
||||
yield dut.sink.data.eq(tseq_words[j])
|
||||
yield
|
||||
for i in range(128):
|
||||
yield dut.sink.valid.eq(0)
|
||||
yield
|
||||
for i in range(1024):
|
||||
yield
|
||||
dut.run = False
|
||||
|
||||
|
@ -80,10 +80,11 @@ class TSChecker(Module):
|
||||
]
|
||||
|
||||
# Count ------------------------------------------------------------------------------------
|
||||
count = Signal(max=mem_depth*n_ordered_sets)
|
||||
count = Signal(max=mem_depth*n_ordered_sets)
|
||||
count_done = (count == (mem_depth*n_ordered_sets - 1))
|
||||
self.sync += [
|
||||
If(self.sink.valid,
|
||||
If(~error & ~self.detected,
|
||||
If(~error & ~count_done,
|
||||
count.eq(count + 1)
|
||||
).Else(
|
||||
count.eq(0)
|
||||
@ -92,7 +93,7 @@ class TSChecker(Module):
|
||||
]
|
||||
|
||||
# Result -----------------------------------------------------------------------------------
|
||||
self.comb += self.detected.eq(count == (mem_depth*n_ordered_sets - 1))
|
||||
self.comb += self.detected.eq(self.sink.valid & count_done)
|
||||
|
||||
# Training Sequence Generator ----------------------------------------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user