mirror of https://github.com/m-labs/artiq.git
test.coredevice.rtio: update for new compiler.
This commit is contained in:
parent
156779007a
commit
c9d8fd837e
|
@ -2,8 +2,7 @@ from math import sqrt
|
||||||
|
|
||||||
from artiq.language import *
|
from artiq.language import *
|
||||||
from artiq.test.hardware_testbench import ExperimentCase
|
from artiq.test.hardware_testbench import ExperimentCase
|
||||||
from artiq.coredevice.runtime_exceptions import RTIOUnderflow
|
from artiq.coredevice.exceptions import RTIOUnderflow, RTIOSequenceError
|
||||||
from artiq.coredevice import runtime_exceptions
|
|
||||||
|
|
||||||
|
|
||||||
class RTT(EnvExperiment):
|
class RTT(EnvExperiment):
|
||||||
|
@ -159,7 +158,7 @@ class TimeKeepsRunning(EnvExperiment):
|
||||||
def build(self):
|
def build(self):
|
||||||
self.attr_device("core")
|
self.attr_device("core")
|
||||||
|
|
||||||
def set_time_at_start(self, time_at_start):
|
def set_time_at_start(self, time_at_start) -> TNone:
|
||||||
self.set_result("time_at_start", time_at_start)
|
self.set_result("time_at_start", time_at_start)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -176,6 +175,7 @@ class Handover(EnvExperiment):
|
||||||
self.time_at_start = now_mu()
|
self.time_at_start = now_mu()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
self.time_at_start = int(0, width=64)
|
||||||
self.get_now()
|
self.get_now()
|
||||||
self.set_result("t1", self.time_at_start)
|
self.set_result("t1", self.time_at_start)
|
||||||
self.get_now()
|
self.get_now()
|
||||||
|
@ -216,11 +216,11 @@ class CoredeviceTest(ExperimentCase):
|
||||||
self.assertEqual(count, npulses)
|
self.assertEqual(count, npulses)
|
||||||
|
|
||||||
def test_underflow(self):
|
def test_underflow(self):
|
||||||
with self.assertRaises(runtime_exceptions.RTIOUnderflow):
|
with self.assertRaises(RTIOUnderflow):
|
||||||
self.execute(Underflow)
|
self.execute(Underflow)
|
||||||
|
|
||||||
def test_sequence_error(self):
|
def test_sequence_error(self):
|
||||||
with self.assertRaises(runtime_exceptions.RTIOSequenceError):
|
with self.assertRaises(RTIOSequenceError):
|
||||||
self.execute(SequenceError)
|
self.execute(SequenceError)
|
||||||
|
|
||||||
def test_watchdog(self):
|
def test_watchdog(self):
|
||||||
|
@ -236,7 +236,7 @@ class CoredeviceTest(ExperimentCase):
|
||||||
dead_time = mu_to_seconds(t2 - t1, self.dmgr.get("core"))
|
dead_time = mu_to_seconds(t2 - t1, self.dmgr.get("core"))
|
||||||
print(dead_time)
|
print(dead_time)
|
||||||
self.assertGreater(dead_time, 1*ms)
|
self.assertGreater(dead_time, 1*ms)
|
||||||
self.assertLess(dead_time, 300*ms)
|
self.assertLess(dead_time, 500*ms)
|
||||||
|
|
||||||
def test_handover(self):
|
def test_handover(self):
|
||||||
self.execute(Handover)
|
self.execute(Handover)
|
||||||
|
@ -248,12 +248,11 @@ class RPCTiming(EnvExperiment):
|
||||||
self.attr_device("core")
|
self.attr_device("core")
|
||||||
self.attr_argument("repeats", FreeValue(100))
|
self.attr_argument("repeats", FreeValue(100))
|
||||||
|
|
||||||
def nop(self, x):
|
def nop(self, x) -> TNone:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def bench(self):
|
def bench(self):
|
||||||
self.ts = [0. for _ in range(self.repeats)]
|
|
||||||
for i in range(self.repeats):
|
for i in range(self.repeats):
|
||||||
t1 = self.core.get_rtio_counter_mu()
|
t1 = self.core.get_rtio_counter_mu()
|
||||||
self.nop(1)
|
self.nop(1)
|
||||||
|
@ -261,6 +260,7 @@ class RPCTiming(EnvExperiment):
|
||||||
self.ts[i] = mu_to_seconds(t2 - t1)
|
self.ts[i] = mu_to_seconds(t2 - t1)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
self.ts = [0. for _ in range(self.repeats)]
|
||||||
self.bench()
|
self.bench()
|
||||||
mean = sum(self.ts)/self.repeats
|
mean = sum(self.ts)/self.repeats
|
||||||
self.set_result("rpc_time_stddev", sqrt(
|
self.set_result("rpc_time_stddev", sqrt(
|
||||||
|
|
Loading…
Reference in New Issue