From f3a2b3a67ed682d34af3689e7062d56e840af451 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 10 Mar 2016 12:16:18 +0800 Subject: [PATCH] test/rtio: raise exception when pulse is not received --- artiq/test/coredevice/test_rtio.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index 8f5dcb48c..881c16ae9 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -12,6 +12,10 @@ from artiq.test.hardware_testbench import ExperimentCase artiq_low_latency = os.getenv("ARTIQ_LOW_LATENCY") +class PulseNotReceived(Exception): + pass + + class RTT(EnvExperiment): def build(self): self.setattr_device("core") @@ -29,7 +33,10 @@ class RTT(EnvExperiment): delay(1*us) t0 = now_mu() self.ttl_inout.pulse(1*us) - self.set_dataset("rtt", mu_to_seconds(self.ttl_inout.timestamp_mu() - t0)) + t1 = self.ttl_inout.timestamp_mu() + if t1 < 0: + raise PulseNotReceived() + self.set_dataset("rtt", mu_to_seconds(t1 - t0)) class Loopback(EnvExperiment): @@ -48,7 +55,10 @@ class Loopback(EnvExperiment): delay(1*us) t0 = now_mu() self.loop_out.pulse(1*us) - self.set_dataset("rtt", mu_to_seconds(self.loop_in.timestamp_mu() - t0)) + t1 = self.loop_in.timestamp_mu() + if t1 < 0: + raise PulseNotReceived() + self.set_dataset("rtt", mu_to_seconds(t1 - t0)) class ClockGeneratorLoopback(EnvExperiment):