From ea9fe9b4e1b43b4cbb4c79dea722e469540d2530 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Tue, 23 May 2023 04:15:39 +0100 Subject: [PATCH] dma: fix off-by-one error in RawSlicer (#2090) Signed-off-by: Jonathan Coates --- artiq/gateware/rtio/dma.py | 2 +- artiq/gateware/test/rtio/test_dma.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/artiq/gateware/rtio/dma.py b/artiq/gateware/rtio/dma.py index f81559dde..68d6a3877 100644 --- a/artiq/gateware/rtio/dma.py +++ b/artiq/gateware/rtio/dma.py @@ -122,7 +122,7 @@ class RawSlicer(Module): for i in range(out_size)})), If(shift_buf, Case(self.source_consume, {i: buf.eq(buf[i*g:]) - for i in range(out_size)})), + for i in range(out_size + 1)})), ] fsm = FSM(reset_state="FETCH") diff --git a/artiq/gateware/test/rtio/test_dma.py b/artiq/gateware/test/rtio/test_dma.py index 54b996b4f..42be76183 100644 --- a/artiq/gateware/test/rtio/test_dma.py +++ b/artiq/gateware/test/rtio/test_dma.py @@ -68,6 +68,7 @@ def do_dma(dut, address): test_writes1 = [ (0x01, 0x23, 0x12, 0x33), (0x901, 0x902, 0x11, 0xeeeeeeeeeeeeeefffffffffffffffffffffffffffffff28888177772736646717738388488), + (0x82, 0x289, 0x99, int.from_bytes(b"\xf0" * 64, "little")), (0x81, 0x288, 0x88, 0x8888) ]