ttl: Remove error-prone sync() calls

These methods are problematic, as with DMA in the picture, the
timestamp member variables did not necessarily reflect the last
submitted event timestamp (see GitHub #1113).

sync() is only very rarely used in typical experimental code, so
the methods are removed without a transition period.
Core.wait_until() can be used to busy-wait for a specified RTIO
timestamp value on the core device CPU instead.
This commit is contained in:
David Nadlinger 2018-07-23 14:36:03 +01:00 committed by Sébastien Bourdeauducq
parent 11e8c9d5f7
commit 17a5fb2dce
1 changed files with 0 additions and 21 deletions

View File

@ -35,9 +35,6 @@ class TTLOut:
self.core = dmgr.get(core_device) self.core = dmgr.get(core_device)
self.channel = channel self.channel = channel
# in RTIO cycles
self.o_previous_timestamp = numpy.int64(0)
@kernel @kernel
def output(self): def output(self):
pass pass
@ -45,14 +42,6 @@ class TTLOut:
@kernel @kernel
def set_o(self, o): def set_o(self, o):
rtio_output(now_mu(), self.channel, 0, 1 if o else 0) rtio_output(now_mu(), self.channel, 0, 1 if o else 0)
self.o_previous_timestamp = now_mu()
@kernel
def sync(self):
"""Busy-wait until all programmed level switches have been
effected."""
while self.core.get_rtio_counter_mu() < self.o_previous_timestamp:
pass
@kernel @kernel
def on(self): def on(self):
@ -123,8 +112,6 @@ class TTLInOut:
self.core = dmgr.get(core_device) self.core = dmgr.get(core_device)
self.channel = channel self.channel = channel
# in RTIO cycles
self.o_previous_timestamp = numpy.int64(0)
self.i_previous_timestamp = numpy.int64(0) self.i_previous_timestamp = numpy.int64(0)
self.queued_samples = 0 self.queued_samples = 0
@ -153,14 +140,6 @@ class TTLInOut:
@kernel @kernel
def set_o(self, o): def set_o(self, o):
rtio_output(now_mu(), self.channel, 0, 1 if o else 0) rtio_output(now_mu(), self.channel, 0, 1 if o else 0)
self.o_previous_timestamp = now_mu()
@kernel
def sync(self):
"""Busy-wait until all programmed level switches have been
effected."""
while self.core.get_rtio_counter_mu() < self.o_previous_timestamp:
pass
@kernel @kernel
def on(self): def on(self):