mirror of https://github.com/m-labs/artiq.git
test/coredevice: WA for lack of constant string support in compiler (see issue #68)
This commit is contained in:
parent
32d141f5ac
commit
820ff2da2c
|
@ -11,6 +11,9 @@ class RTT(EnvExperiment):
|
||||||
self.attr_device("core")
|
self.attr_device("core")
|
||||||
self.attr_device("ttl_inout")
|
self.attr_device("ttl_inout")
|
||||||
|
|
||||||
|
def set_rtt(self, rtt):
|
||||||
|
self.set_result("rtt", rtt)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ttl_inout.output()
|
self.ttl_inout.output()
|
||||||
|
@ -23,8 +26,7 @@ class RTT(EnvExperiment):
|
||||||
delay(1*us)
|
delay(1*us)
|
||||||
t0 = now_mu()
|
t0 = now_mu()
|
||||||
self.ttl_inout.pulse(1*us)
|
self.ttl_inout.pulse(1*us)
|
||||||
self.set_result("rtt",
|
self.set_rtt(mu_to_seconds(self.ttl_inout.timestamp() - t0))
|
||||||
mu_to_seconds(self.ttl_inout.timestamp() - t0))
|
|
||||||
|
|
||||||
|
|
||||||
class Loopback(EnvExperiment):
|
class Loopback(EnvExperiment):
|
||||||
|
@ -33,6 +35,9 @@ class Loopback(EnvExperiment):
|
||||||
self.attr_device("loop_in")
|
self.attr_device("loop_in")
|
||||||
self.attr_device("loop_out")
|
self.attr_device("loop_out")
|
||||||
|
|
||||||
|
def set_rtt(self, rtt):
|
||||||
|
self.set_result("rtt", rtt)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
self.loop_in.input()
|
self.loop_in.input()
|
||||||
|
@ -43,8 +48,7 @@ class Loopback(EnvExperiment):
|
||||||
delay(1*us)
|
delay(1*us)
|
||||||
t0 = now_mu()
|
t0 = now_mu()
|
||||||
self.loop_out.pulse(1*us)
|
self.loop_out.pulse(1*us)
|
||||||
self.set_result("rtt",
|
self.set_rtt(mu_to_seconds(self.loop_in.timestamp() - t0))
|
||||||
mu_to_seconds(self.loop_in.timestamp() - t0))
|
|
||||||
|
|
||||||
|
|
||||||
class ClockGeneratorLoopback(EnvExperiment):
|
class ClockGeneratorLoopback(EnvExperiment):
|
||||||
|
@ -53,6 +57,9 @@ class ClockGeneratorLoopback(EnvExperiment):
|
||||||
self.attr_device("loop_clock_in")
|
self.attr_device("loop_clock_in")
|
||||||
self.attr_device("loop_clock_out")
|
self.attr_device("loop_clock_out")
|
||||||
|
|
||||||
|
def set_count(self, count):
|
||||||
|
self.set_result("count", count)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
self.loop_clock_in.input()
|
self.loop_clock_in.input()
|
||||||
|
@ -63,8 +70,7 @@ class ClockGeneratorLoopback(EnvExperiment):
|
||||||
with sequential:
|
with sequential:
|
||||||
delay(200*ns)
|
delay(200*ns)
|
||||||
self.loop_clock_out.set(1*MHz)
|
self.loop_clock_out.set(1*MHz)
|
||||||
self.set_result("count",
|
self.set_count(self.loop_clock_in.count())
|
||||||
self.loop_clock_in.count())
|
|
||||||
|
|
||||||
|
|
||||||
class PulseRate(EnvExperiment):
|
class PulseRate(EnvExperiment):
|
||||||
|
@ -72,6 +78,9 @@ class PulseRate(EnvExperiment):
|
||||||
self.attr_device("core")
|
self.attr_device("core")
|
||||||
self.attr_device("loop_out")
|
self.attr_device("loop_out")
|
||||||
|
|
||||||
|
def set_pulse_rate(self, pulse_rate):
|
||||||
|
self.set_result("pulse_rate", pulse_rate)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
dt = seconds_to_mu(1000*ns)
|
dt = seconds_to_mu(1000*ns)
|
||||||
|
@ -84,8 +93,7 @@ class PulseRate(EnvExperiment):
|
||||||
dt += 1
|
dt += 1
|
||||||
self.core.break_realtime()
|
self.core.break_realtime()
|
||||||
else:
|
else:
|
||||||
self.set_result("pulse_rate",
|
self.set_pulse_rate(mu_to_seconds(2*dt))
|
||||||
mu_to_seconds(2*dt))
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,6 +114,9 @@ class LoopbackCount(EnvExperiment):
|
||||||
self.attr_device("ttl_inout")
|
self.attr_device("ttl_inout")
|
||||||
self.attr_argument("npulses")
|
self.attr_argument("npulses")
|
||||||
|
|
||||||
|
def set_count(self, count):
|
||||||
|
self.set_result("count", count)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ttl_inout.output()
|
self.ttl_inout.output()
|
||||||
|
@ -116,8 +127,7 @@ class LoopbackCount(EnvExperiment):
|
||||||
for i in range(self.npulses):
|
for i in range(self.npulses):
|
||||||
delay(25*ns)
|
delay(25*ns)
|
||||||
self.ttl_inout.pulse(25*ns)
|
self.ttl_inout.pulse(25*ns)
|
||||||
self.set_result("count",
|
self.set_count(self.ttl_inout.count())
|
||||||
self.ttl_inout.count())
|
|
||||||
|
|
||||||
|
|
||||||
class Underflow(EnvExperiment):
|
class Underflow(EnvExperiment):
|
||||||
|
@ -149,9 +159,12 @@ 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):
|
||||||
|
self.set_result("time_at_start", time_at_start)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
self.set_result("time_at_start", now_mu())
|
self.set_time_at_start(now_mu())
|
||||||
|
|
||||||
|
|
||||||
class Handover(EnvExperiment):
|
class Handover(EnvExperiment):
|
||||||
|
|
Loading…
Reference in New Issue