Skip to content

Commit

Permalink
rtio: disable replace on rt2wb channels
Browse files Browse the repository at this point in the history
sbourdeauducq committed Mar 9, 2016
1 parent 1c706fa commit 03b53c3
Showing 3 changed files with 19 additions and 12 deletions.
24 changes: 14 additions & 10 deletions artiq/gateware/rtio/core.py
Original file line number Diff line number Diff line change
@@ -129,24 +129,28 @@ def __init__(self, interface, counter, fifo_depth, guard_io_cycles):
collision = Signal()
any_error = Signal()
nop = Signal()
self.sync.rsys += [
if interface.enable_replace:
# Note: replace may be asserted at the same time as collision
# when addresses are different. In that case, it is a collision.
replace.eq(self.ev.timestamp == buf.timestamp),
self.sync.rsys += replace.eq(self.ev.timestamp == buf.timestamp)
self.sync.rsys += \
# Detect sequence errors on coarse timestamps only
# so that they are mutually exclusive with collision errors.
sequence_error.eq(self.ev.timestamp[fine_ts_width:]
< buf.timestamp[fine_ts_width:])
]
if hasattr(self.ev, "a"):
different_addresses = self.ev.a != buf.a
if interface.enable_replace:
if hasattr(self.ev, "a"):
different_addresses = self.ev.a != buf.a
else:
different_addresses = 0
if fine_ts_width:
self.sync.rsys += collision.eq(
(self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:])
& ((self.ev.timestamp[:fine_ts_width] != buf.timestamp[:fine_ts_width])
|different_addresses))
else:
different_addresses = 0
if fine_ts_width:
self.sync.rsys += collision.eq(
(self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:])
& ((self.ev.timestamp[:fine_ts_width] != buf.timestamp[:fine_ts_width])
|different_addresses))
self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:])
self.comb += any_error.eq(sequence_error | collision)
if interface.suppress_nop:
# disable NOP at reset: do not suppress a first write with all 0s
3 changes: 2 additions & 1 deletion artiq/gateware/rtio/phy/wishbone.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ def __init__(self, address_width, wb=None):
rtlink.OInterface(
len(wb.dat_w),
address_width + 1,
suppress_nop=False),
suppress_nop=False,
enable_replace=False),
rtlink.IInterface(
len(wb.dat_r),
timestamped=False)
4 changes: 3 additions & 1 deletion artiq/gateware/rtio/rtlink.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@

class OInterface:
def __init__(self, data_width, address_width=0,
fine_ts_width=0, suppress_nop=True):
fine_ts_width=0, suppress_nop=True,
enable_replace=True):
self.stb = Signal()
self.busy = Signal()

@@ -15,6 +16,7 @@ def __init__(self, data_width, address_width=0,
self.fine_ts = Signal(fine_ts_width)

self.suppress_nop = suppress_nop
self.enable_replace = enable_replace

@classmethod
def like(cls, other):

0 comments on commit 03b53c3

Please sign in to comment.