From 8e77e561cdd015d4fd807051ca01010ec29b60b5 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 25 Feb 2016 18:46:49 +0000 Subject: [PATCH] test: bring back test_loopback_count (fixes #295). --- artiq/test/coredevice/test_rtio.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index ba05b8f73..a4e90b236 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -101,6 +101,28 @@ class Watchdog(EnvExperiment): pass +class LoopbackCount(EnvExperiment): + def build(self): + self.setattr_device("core") + self.setattr_device("ttl_inout") + self.setattr_argument("npulses") + + def set_count(self, count): + self.set_dataset("count", count) + + @kernel + def run(self): + self.loop_out.output() + delay(5*us) + with parallel: + self.loop_in.gate_rising(10*us) + with sequential: + for i in range(self.npulses): + delay(25*ns) + self.loop_out.pulse(25*ns) + self.set_dataset("count", self.loop_in.count()) + + class Underflow(EnvExperiment): def build(self): self.setattr_device("core") @@ -182,6 +204,12 @@ class CoredeviceTest(ExperimentCase): self.assertGreater(rate, 100*ns) self.assertLess(rate, 2500*ns) + def test_loopback_count(self): + npulses = 2 + self.execute(LoopbackCount, npulses=npulses) + count = self.dataset_mgr.get("count") + self.assertEqual(count, npulses) + def test_underflow(self): with self.assertRaises(RTIOUnderflow): self.execute(Underflow)