Skip to content

Commit 8e77e56

Browse files
author
whitequark
committedFeb 25, 2016
test: bring back test_loopback_count (fixes #295).
1 parent 51e831c commit 8e77e56

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎artiq/test/coredevice/test_rtio.py

+28
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ def run(self):
101101
pass
102102

103103

104+
class LoopbackCount(EnvExperiment):
105+
def build(self):
106+
self.setattr_device("core")
107+
self.setattr_device("ttl_inout")
Has a comment. Original line has a comment.
108+
self.setattr_argument("npulses")
109+
110+
def set_count(self, count):
111+
self.set_dataset("count", count)
112+
113+
@kernel
114+
def run(self):
115+
self.loop_out.output()
116+
delay(5*us)
117+
with parallel:
118+
self.loop_in.gate_rising(10*us)
119+
with sequential:
120+
for i in range(self.npulses):
121+
delay(25*ns)
122+
self.loop_out.pulse(25*ns)
123+
self.set_dataset("count", self.loop_in.count())
124+
125+
104126
class Underflow(EnvExperiment):
105127
def build(self):
106128
self.setattr_device("core")
@@ -182,6 +204,12 @@ def test_pulse_rate(self):
182204
self.assertGreater(rate, 100*ns)
183205
self.assertLess(rate, 2500*ns)
184206

207+
def test_loopback_count(self):
208+
npulses = 2
209+
self.execute(LoopbackCount, npulses=npulses)
210+
count = self.dataset_mgr.get("count")
211+
self.assertEqual(count, npulses)
212+
185213
def test_underflow(self):
186214
with self.assertRaises(RTIOUnderflow):
187215
self.execute(Underflow)

0 commit comments

Comments
 (0)
Please sign in to comment.