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: 486fe9764917
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: 1cb8f642b4d8
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Sep 7, 2016

  1. Copy the full SHA
    2b28245 View commit details
  2. Copy the full SHA
    1cb8f64 View commit details
Showing with 68 additions and 1 deletion.
  1. +3 −1 artiq/coredevice/ttl.py
  2. +65 −0 artiq/test/coredevice/test_rtio.py
4 changes: 3 additions & 1 deletion artiq/coredevice/ttl.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,9 @@

from artiq.language.core import *
from artiq.language.types import *
from artiq.coredevice.rtio import rtio_output, rtio_input_timestamp
from artiq.coredevice.rtio import (rtio_output, rtio_input_timestamp,
rtio_input_data)
from artiq.coredevice.exceptions import RTIOOverflow


# RTIO TTL address map:
65 changes: 65 additions & 0 deletions artiq/test/coredevice/test_rtio.py
Original file line number Diff line number Diff line change
@@ -172,6 +172,65 @@ def run(self):
self.set_dataset("count", self.loop_in.count())


class IncorrectLevel(Exception):
pass


class Level(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("loop_in")
self.setattr_device("loop_out")

@kernel
def run(self):
self.core.reset()
self.loop_in.input()
self.loop_out.output()
delay(5*us)

self.loop_out.off()
delay(5*us)
if self.loop_in.sample_get_nonrt():
raise IncorrectLevel

self.loop_out.on()
delay(5*us)
if not self.loop_in.sample_get_nonrt():
raise IncorrectLevel


class Watch(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("loop_in")
self.setattr_device("loop_out")

@kernel
def run(self):
self.core.reset()
self.loop_in.input()
self.loop_out.output()
delay(5*us)

self.loop_out.off()
delay(5*us)
if not self.loop_in.watch_stay_off():
raise IncorrectLevel
delay(10*us)
if not self.loop_in.watch_done():
raise IncorrectLevel

delay(10*us)
if not self.loop_in.watch_stay_off():
raise IncorrectLevel
delay(3*us)
self.loop_out.on()
delay(10*us)
if self.loop_in.watch_done():
raise IncorrectLevel


class Underflow(EnvExperiment):
def build(self):
self.setattr_device("core")
@@ -309,6 +368,12 @@ def test_loopback_count(self):
count = self.dataset_mgr.get("count")
self.assertEqual(count, npulses)

def test_level(self):
self.execute(Level)

def test_watch(self):
self.execute(Watch)

def test_underflow(self):
with self.assertRaises(RTIOUnderflow):
self.execute(Underflow)