diff --git a/artiq/devices/pdq2/__init__.py b/artiq/devices/pdq2/__init__.py index 9b8b810e8..098536bfb 100644 --- a/artiq/devices/pdq2/__init__.py +++ b/artiq/devices/pdq2/__init__.py @@ -3,11 +3,10 @@ from artiq.language.units import * from artiq.coredevice import rtio -# FIXME: check those numbers frame_setup = 20*ns -trigger_duration = 100*ns -frame_wait = 100*ns -sample_period = 10*us +trigger_duration = 50*ns +frame_wait = 20*ns +sample_period = 10*us # FIXME: check this class SegmentSequenceError(Exception): @@ -50,13 +49,19 @@ class _Frame: self.segment_count = 0 self.closed = False - def append(self, name, t, u, trigger=False): + def append(self, t, u, trigger=False, name=None): if self.closed: raise FrameCloseError sn = self.segment_count duration = (t[-1] - t[0])*sample_period segment = _Segment(self, sn, duration, (t, u, trigger)) - setattr(self, name, segment) + if name is None: + # TODO + raise NotImplementedError("Anonymous segments are not supported yet") + else: + if hasattr(self, name): + raise NameError("Segment name already exists") + setattr(self, name, segment) self.segment_count += 1 def close(self): @@ -80,6 +85,11 @@ class _Frame: self.pdq.trigger.on(t) self.pdq.trigger.off(t + time_to_cycles(trigger_duration)) + @kernel + def advance(self): + # TODO + raise NotImplementedError + @kernel def finish(self): if self.pdq.current_frame != self.fn: diff --git a/examples/transport.py b/examples/transport.py index 6d5f347f5..2b917cd15 100644 --- a/examples/transport.py +++ b/examples/transport.py @@ -22,12 +22,12 @@ class Transport(AutoContext): # stores duration and the fact that this segment needs to be triggered # both (duration and segment triggering flag) to be retrieved during # kernel compilation, see transport() - self.tf.append("to_stop", - t, u, trigger=True) + self.tf.append(t, u, trigger=True, + name="to_stop") # append the reverse transport (from stop to 0) # both durations are the same in this case - self.tf.append("from_stop", - t[-1] - t[::-1], u[::-1], trigger=True) + self.tf.append(t[-1] - t[::-1], u[::-1], trigger=True, + name="from_stop") # closes the frame with a wait line before jumping back into # the jump table so that frame signal can be set before the jump # also mark the frame as closed and prevent further append()ing