mirror of https://github.com/m-labs/artiq.git
examples/tdr: adapt to compiler changes
This commit is contained in:
parent
81b35be574
commit
baf7b0dcf2
|
@ -39,6 +39,7 @@ class TDR(EnvExperiment):
|
||||||
n = 1000 # repetitions
|
n = 1000 # repetitions
|
||||||
latency = 50e-9 # calibrated latency without a transmission line
|
latency = 50e-9 # calibrated latency without a transmission line
|
||||||
pulse = 1e-6 # pulse length, larger than rtt
|
pulse = 1e-6 # pulse length, larger than rtt
|
||||||
|
self.t = [0 for i in range(2)]
|
||||||
try:
|
try:
|
||||||
self.many(n, seconds_to_mu(pulse, self.core))
|
self.many(n, seconds_to_mu(pulse, self.core))
|
||||||
except PulseNotReceivedError:
|
except PulseNotReceivedError:
|
||||||
|
@ -53,21 +54,19 @@ class TDR(EnvExperiment):
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def many(self, n, p):
|
def many(self, n, p):
|
||||||
t = [0 for i in range(2)]
|
|
||||||
self.core.break_realtime()
|
self.core.break_realtime()
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
self.one(t, p)
|
self.one(p)
|
||||||
self.t = t
|
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def one(self, t, p):
|
def one(self, p):
|
||||||
t0 = now_mu()
|
t0 = now_mu()
|
||||||
with parallel:
|
with parallel:
|
||||||
self.pmt0.gate_both_mu(2*p)
|
self.pmt0.gate_both_mu(2*p)
|
||||||
self.ttl2.pulse_mu(p)
|
self.ttl2.pulse_mu(p)
|
||||||
for i in range(len(t)):
|
for i in range(len(self.t)):
|
||||||
ti = self.pmt0.timestamp_mu()
|
ti = self.pmt0.timestamp_mu()
|
||||||
if ti <= 0:
|
if ti <= 0:
|
||||||
raise PulseNotReceivedError
|
raise PulseNotReceivedError()
|
||||||
t[i] += ti - t0
|
self.t[i] = int(self.t[i] + ti - t0)
|
||||||
self.pmt0.count() # flush
|
self.pmt0.count() # flush
|
||||||
|
|
Loading…
Reference in New Issue