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: e51928ee9744
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: 18eddd00e148
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 29, 2016

  1. Copy the full SHA
    43681b3 View commit details
  2. Copy the full SHA
    a1cc964 View commit details
  3. Copy the full SHA
    18eddd0 View commit details
Showing with 20 additions and 3 deletions.
  1. +2 −2 artiq/test/coredevice/test_rtio.py
  2. +13 −1 artiq/test/test_scheduler.py
  3. +5 −0 doc/manual/getting_started_core.rst
4 changes: 2 additions & 2 deletions artiq/test/coredevice/test_rtio.py
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ def run(self):
self.core.reset()
self.loop_clock_in.input()
self.loop_clock_out.stop()
delay(1*us)
delay(10*us)
with parallel:
self.loop_clock_in.gate_rising(10*us)
with sequential:
@@ -301,7 +301,7 @@ def test_pulse_rate_dds(self):
rate = self.dataset_mgr.get("pulse_rate")
print(rate)
self.assertGreater(rate, 1*us)
self.assertLess(rate, 6*us)
self.assertLess(rate, 6.2*us)

def test_loopback_count(self):
npulses = 2
14 changes: 13 additions & 1 deletion artiq/test/test_scheduler.py
Original file line number Diff line number Diff line change
@@ -138,6 +138,7 @@ def check_termination(mod):

expect = _get_basic_steps(1, expid)
background_running = asyncio.Event()
empty_ready = asyncio.Event()
empty_completed = asyncio.Event()
background_completed = asyncio.Event()
expect_idx = 0
@@ -151,8 +152,13 @@ def notify(mod):
if mod == {"path": [0],
"value": "deleting",
"key": "status",
"action": "setitem"}:
"action": "setitem"}:
background_completed.set()
if mod == {"path": [1],
"value": "prepare_done",
"key": "status",
"action": "setitem"}:
empty_ready.set()
if mod["path"] == [1] or (mod["path"] == [] and mod["key"] == 1):
self.assertEqual(mod, expect[expect_idx])
expect_idx += 1
@@ -163,11 +169,17 @@ def notify(mod):
scheduler.start()
scheduler.submit("main", expid_bg, -99, None, False)
loop.run_until_complete(background_running.wait())
self.assertFalse(scheduler.check_pause(0))
scheduler.submit("main", expid, 0, None, False)
self.assertFalse(scheduler.check_pause(0))
loop.run_until_complete(empty_ready.wait())
self.assertTrue(scheduler.check_pause(0))
loop.run_until_complete(empty_completed.wait())
self.assertFalse(scheduler.check_pause(0))

self.assertFalse(termination_ok)
scheduler.request_termination(0)
self.assertTrue(scheduler.check_pause(0))
loop.run_until_complete(background_completed.wait())
self.assertTrue(termination_ok)

5 changes: 5 additions & 0 deletions doc/manual/getting_started_core.rst
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ As a very first step, we will turn on a LED on the core device. Create a file ``

@kernel
def run(self):
self.core.reset()
self.led.on()

The central part of our code is our ``LED`` class, that derives from :class:`artiq.language.environment.EnvExperiment`. Among other features, ``EnvExperiment`` calls our ``build`` method and provides the ``setattr_device`` method that interfaces to the device database to create the appropriate device drivers and make those drivers accessible as ``self.core`` and ``self.led``. The ``@kernel`` decorator tells the system that the ``run`` method must be executed on the core device (instead of the host). The decorator uses ``self.core`` internally, which is why we request the core device using ``setattr_device`` like any other.
@@ -53,6 +54,7 @@ Modify the code as follows: ::

@kernel
def run(self):
self.core.reset()
s = input_led_state()
self.core.break_realtime()
if s:
@@ -91,6 +93,7 @@ Create a new file ``rtio.py`` containing the following: ::

@kernel
def run(self):
self.core.reset()
for i in range(1000000):
self.ttl0.pulse(2*us)
delay(2*us)
@@ -119,6 +122,7 @@ Try reducing the period of the generated waveform until the CPU cannot keep up w

@kernel
def run(self):
self.core.reset()
try:
for i in range(1000000):
self.ttl0.pulse(...)
@@ -141,6 +145,7 @@ The core device records the real-time I/O waveforms into a circular buffer. It i

@kernel
def run(self):
self.core.reset()
for i in range(100):
self.ttl0.pulse(...)
rtio_log("ttl0", "i", i)