From ed0fbd566219b7c17b0573ed2ce10ca728a424c9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 24 Jan 2018 00:28:39 +0800 Subject: [PATCH] test: add test for RTIO counter (#883) --- artiq/test/coredevice/test_rtio.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index 13517084a..6393d1840 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -18,6 +18,17 @@ artiq_low_latency = os.getenv("ARTIQ_LOW_LATENCY") artiq_in_devel = os.getenv("ARTIQ_IN_DEVEL") +class RTIOCounter(EnvExperiment): + def build(self): + self.setattr_device("core") + + @kernel + def run(self): + t0 = self.core.get_rtio_counter_mu() + t1 = self.core.get_rtio_counter_mu() + self.set_dataset("dt", self.core.mu_to_seconds(t1 - t0)) + + class PulseNotReceived(Exception): pass @@ -357,6 +368,12 @@ class HandoverException(EnvExperiment): class CoredeviceTest(ExperimentCase): + def test_rtio_counter(self): + self.execute(RTIOCounter) + dt = self.dataset_mgr.get("dt") + self.assertGreater(dt, 50*ns) + self.assertLess(dt, 200*ns) + def test_loopback(self): self.execute(Loopback) rtt = self.dataset_mgr.get("rtt")