2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-19 00:16:29 +08:00
artiq/benchmarks/rtio_skew.py

30 lines
621 B
Python
Raw Normal View History

2014-10-14 15:54:28 +08:00
from artiq import *
2015-01-30 19:07:51 +08:00
class PulseNotReceived(Exception):
pass
2014-10-14 15:54:28 +08:00
class RTIOSkew(Experiment, AutoDB):
"""RTIO skew"""
class DBKeys:
2015-03-08 18:37:53 +08:00
core = Device()
pmt0 = Device()
2015-02-18 07:14:18 +08:00
rtio_skew = Result()
2015-01-30 19:07:51 +08:00
2014-10-14 15:54:28 +08:00
@kernel
def run(self):
self.pmt0.output()
delay(1*us)
2014-10-14 15:54:28 +08:00
with parallel:
2014-12-03 18:20:30 +08:00
self.pmt0.gate_rising(10*us)
2014-10-14 15:54:28 +08:00
with sequential:
delay(5*us)
out_t = now()
self.pmt0.pulse(5*us)
2014-12-03 18:20:30 +08:00
in_t = self.pmt0.timestamp()
2014-10-14 15:54:28 +08:00
if in_t < 0*s:
2015-01-30 19:07:51 +08:00
raise PulseNotReceived
2015-02-18 07:14:18 +08:00
self.rtio_skew = out_t - in_t