Closed ghost closed 9 years ago
Peter, have you had a chance to look at this?
Context: trigger Core Device based on external stimulus from another laboratory instrument. e.g. Apply 1 KHz square wave to PMT1, ideally QRTIQ generates TTL0 pulse in response after well-defined (short) delay § What is latency? □ 55 us with observation that at(t0); delay(55_us) is faster than at(t0+55_us) □ 1.900 us with a trick to bypass the compiler to remove all rational math ® use syscall() in python Can this optimization be built-in to compiler?
@jboulder Yes, this should be optimized when the new-py2llvm branch lands.
With the new APIs:
from artiq import *
class PulseNotReceived(Exception):
pass
class Test(EnvExperiment):
def build(self):
self.attr_device("core")
self.attr_device("ttl0")
self.attr_device("pmt1")
@kernel
def run(self):
self.pmt1.gate_rising(3*ms)
t0 = self.pmt1.timestamp_mu()
if t0 < 0:
raise PulseNotReceived
at_mu(t0)
delay(3*us)
self.ttl0.pulse(10*ms)
The performance should already be much better since there is no rational math anymore.
Yes. This works. Nice! My KC705 requires a delay of 5 us (instead of 3 us).