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: 82ec76af3e3c
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: 1c36ae06720c
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 26, 2015

  1. Copy the full SHA
    7eb4067 View commit details
  2. Copy the full SHA
    1c36ae0 View commit details
Showing with 24 additions and 8 deletions.
  1. +3 −1 artiq/coredevice/analyzer.py
  2. +21 −7 artiq/test/coredevice/analyzer.py
4 changes: 3 additions & 1 deletion artiq/coredevice/analyzer.py
Original file line number Diff line number Diff line change
@@ -148,12 +148,14 @@ def process_message(self, message):
self.last_value = str(message.data)
if self.oe:
self.channel_value.set_value(self.last_value)
elif messages.address == 1:
elif message.address == 1:
self.oe = bool(message.data)
if self.oe:
self.channel_value.set_value(self.last_value)
else:
self.channel_value.set_value("X")
elif isinstance(message, InputMessage):
self.channel_value.set_value(str(message.data))


class DDSHandler:
28 changes: 21 additions & 7 deletions artiq/test/coredevice/analyzer.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
from artiq.language import *
from artiq.coredevice.analyzer import decode_dump, OutputMessage
from artiq.coredevice.analyzer import decode_dump, OutputMessage, InputMessage
from artiq.test.hardware_testbench import ExperimentCase


class CreateTTLPulse(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("ttl_out")
self.setattr_device("ttl_inout")

@kernel
def run(self):
self.ttl_out.pulse_mu(1000)
self.ttl_inout.output()
delay_mu(100)
with parallel:
self.ttl_inout.gate_both_mu(1200)
with sequential:
delay_mu(100)
self.ttl_inout.pulse_mu(1000)
self.ttl_inout.count()


class AnalyzerTest(ExperimentCase):
@@ -24,9 +31,16 @@ def test_ttl_pulse(self):
exp.run()

dump = decode_dump(comm.get_analyzer_dump())
ttl_messages = [msg for msg in dump.messages
if isinstance(msg, OutputMessage)]
self.assertEqual(len(ttl_messages), 2)
output_messages = [msg for msg in dump.messages
if isinstance(msg, OutputMessage)
and msg.address == 0]
self.assertEqual(len(output_messages), 2)
self.assertEqual(
abs(ttl_messages[0].timestamp - ttl_messages[1].timestamp),
abs(output_messages[0].timestamp - output_messages[1].timestamp),
1000)
input_messages = [msg for msg in dump.messages
if isinstance(msg, InputMessage)]
self.assertEqual(len(input_messages), 2)
self.assertAlmostEqual(
abs(input_messages[0].timestamp - input_messages[1].timestamp),
1000, delta=1)