Skip to content

Commit 4e931c7

Browse files
committedNov 23, 2016
rtio: fix timestamp shift
1 parent 5a2edef commit 4e931c7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎artiq/gateware/rtio/core.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def __init__(self):
265265

266266

267267
class Core(Module):
268-
def __init__(self, channels, full_ts_width=63, guard_io_cycles=20):
268+
def __init__(self, channels, guard_io_cycles=20):
269269
data_width = max(rtlink.get_data_width(c.interface)
270270
for c in channels)
271271
address_width = max(rtlink.get_address_width(c.interface)
@@ -309,7 +309,7 @@ def __init__(self, channels, full_ts_width=63, guard_io_cycles=20):
309309
cmd_reset_phy | ResetSignal("rtio", allow_reset_less=True))
310310

311311
# Managers
312-
self.submodules.counter = RTIOCounter(full_ts_width - fine_ts_width)
312+
self.submodules.counter = RTIOCounter(len(self.cri.o_timestamp) - fine_ts_width)
313313

314314
i_datas, i_timestamps = [], []
315315
o_statuses, i_statuses = [], []
@@ -333,10 +333,10 @@ def __init__(self, channels, full_ts_width=63, guard_io_cycles=20):
333333
if hasattr(o_manager.ev, "address"):
334334
self.comb += o_manager.ev.address.eq(self.cri.o_address)
335335
ts_shift = len(self.cri.o_timestamp) - len(o_manager.ev.timestamp)
336+
print(n, ts_shift, channel)
336337
self.comb += o_manager.ev.timestamp.eq(self.cri.o_timestamp[ts_shift:])
337338

338-
self.comb += o_manager.we.eq(selected &
339-
(self.cri.cmd == cri.commands["write"]))
339+
self.comb += o_manager.we.eq(selected & (self.cri.cmd == cri.commands["write"]))
340340

341341
underflow = Signal()
342342
sequence_error = Signal()
@@ -372,8 +372,7 @@ def __init__(self, channels, full_ts_width=63, guard_io_cycles=20):
372372
else:
373373
i_datas.append(0)
374374
if channel.interface.i.timestamped:
375-
ts_shift = (len(self.cri.i_timestamp)
376-
- len(i_manager.ev.timestamp))
375+
ts_shift = (len(self.cri.i_timestamp) - len(i_manager.ev.timestamp))
377376
i_timestamps.append(i_manager.ev.timestamp << ts_shift)
378377
else:
379378
i_timestamps.append(0)

0 commit comments

Comments
 (0)
Please sign in to comment.