From 8cfe2ec53a00f916b9d6f7771d20c2bee6042003 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 13 Sep 2017 22:11:41 +0800 Subject: [PATCH] rtio/sed: fix sequence number width computation --- artiq/gateware/rtio/sed/lane_distributor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/artiq/gateware/rtio/sed/lane_distributor.py b/artiq/gateware/rtio/sed/lane_distributor.py index 9b3a17e64..08c537994 100644 --- a/artiq/gateware/rtio/sed/lane_distributor.py +++ b/artiq/gateware/rtio/sed/lane_distributor.py @@ -25,7 +25,9 @@ class LaneDistributor(Module): if lane_count & (lane_count - 1): raise NotImplementedError("lane count must be a power of 2") - seqn_width = 4*bits_for(lane_count*fifo_size-1) + # There must be a unique sequence number for every possible event in every FIFO. + # Plus 2 bits to detect and handle wraparounds. + seqn_width = bits_for(lane_count*fifo_size-1) + 2 self.cri = cri.Interface() self.minimum_coarse_timestamp = Signal(64-fine_ts_width)