forked from M-Labs/artiq
1
0
Fork 0

examples/tdr: adapt to compiler changes

This commit is contained in:
Robert Jördens 2016-03-01 19:04:03 +01:00
parent 81b35be574
commit baf7b0dcf2
1 changed files with 6 additions and 7 deletions

View File

@ -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