Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 97f9c9c34f75
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 85b6a7ca241c
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Oct 21, 2014

  1. Copy the full SHA
    b962493 View commit details

Commits on Oct 22, 2014

  1. Copy the full SHA
    85b6a7c View commit details
Showing with 22 additions and 11 deletions.
  1. +2 −1 artiq/coredevice/runtime_exceptions.py
  2. +16 −6 artiq/devices/pdq2/__init__.py
  3. +4 −4 examples/transport.py
3 changes: 2 additions & 1 deletion artiq/coredevice/runtime_exceptions.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,8 @@ class RTIOUnderflow(RuntimeException):
# Raised by RTIO driver for regular RTIO.
# Raised by runtime for DDS FUD.
class RTIOSequenceError(RuntimeException):
"""Raised when an event was not submitted with an increasing timestamp.
"""Raised when an event is submitted on a given channel with a timestamp
not larger than the previous one.
The offending event is discarded and RTIO operation is not affected
further.
22 changes: 16 additions & 6 deletions artiq/devices/pdq2/__init__.py
Original file line number Diff line number Diff line change
@@ -3,11 +3,10 @@
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 @@ def __init__(self, core):
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 @@ def begin(self):
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:
8 changes: 4 additions & 4 deletions examples/transport.py
Original file line number Diff line number Diff line change
@@ -22,12 +22,12 @@ def prepare(self, stop):
# 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