From 15ae994ad6eef4ba897a0291a8cf5421ddae8165 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Wed, 24 Aug 2022 12:18:39 -0400 Subject: [PATCH] tb: Fix incorrect valid in send_recovered_bits At the end of the bitstream, we might not have enough bits for valid=2. If we don't change it to valid=1, instead of marking an X as valid. Fixes: d351291 ("Initial commit") Signed-off-by: Sean Anderson --- tb/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tb/util.py b/tb/util.py index 9ff972f..ed8c12f 100644 --- a/tb/util.py +++ b/tb/util.py @@ -90,11 +90,11 @@ class saw_valid: return self.last async def send_recovered_bits(clk, data, valid, bits, valids): + bits = iter(bits) await FallingEdge(clk) try: while True: v = valids() - valid.value = v if v == 0: d = 'XX' elif v == 1: @@ -105,8 +105,10 @@ async def send_recovered_bits(clk, data, valid, bits, valids): second = next(bits) except StopIteration: second = 'X' + v = 1 d = (first, second) data.value = LogicArray(d) + valid.value = v await FallingEdge(clk) except StopIteration: pass