Skip to content

Commit 88ad054

Browse files
committedDec 3, 2016
Merge branch 'drtio'
2 parents 3520038 + 5d145ff commit 88ad054

35 files changed

+4112
-242
lines changed
 

Diff for: ‎artiq/examples/drtio/device_db.pyon

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# This is an example device database that needs to be adapted to your setup.
2+
# The RTIO channel numbers here are for NIST CLOCK on KC705.
3+
# The list of devices here is not exhaustive.
4+
5+
{
6+
"comm": {
7+
"type": "local",
8+
"module": "artiq.coredevice.comm_tcp",
9+
"class": "Comm",
10+
"arguments": {"host": "kc705.lab.m-labs.hk"}
11+
},
12+
"core": {
13+
"type": "local",
14+
"module": "artiq.coredevice.core",
15+
"class": "Core",
16+
"arguments": {"ref_period": 2e-9}
17+
},
18+
"core_cache": {
19+
"type": "local",
20+
"module": "artiq.coredevice.cache",
21+
"class": "CoreCache"
22+
},
23+
24+
"rled0": {
25+
"type": "local",
26+
"module": "artiq.coredevice.ttl",
27+
"class": "TTLOut",
28+
"arguments": {"channel": 0},
29+
},
30+
"rled1": {
31+
"type": "local",
32+
"module": "artiq.coredevice.ttl",
33+
"class": "TTLOut",
34+
"arguments": {"channel": 1},
35+
},
36+
"rled2": {
37+
"type": "local",
38+
"module": "artiq.coredevice.ttl",
39+
"class": "TTLOut",
40+
"arguments": {"channel": 2},
41+
},
42+
"rled3": {
43+
"type": "local",
44+
"module": "artiq.coredevice.ttl",
45+
"class": "TTLOut",
46+
"arguments": {"channel": 3},
47+
},
48+
"rled4": {
49+
"type": "local",
50+
"module": "artiq.coredevice.ttl",
51+
"class": "TTLOut",
52+
"arguments": {"channel": 4},
53+
},
54+
"rled5": {
55+
"type": "local",
56+
"module": "artiq.coredevice.ttl",
57+
"class": "TTLOut",
58+
"arguments": {"channel": 5},
59+
},
60+
"rled6": {
61+
"type": "local",
62+
"module": "artiq.coredevice.ttl",
63+
"class": "TTLOut",
64+
"arguments": {"channel": 6},
65+
},
66+
"rled7": {
67+
"type": "local",
68+
"module": "artiq.coredevice.ttl",
69+
"class": "TTLOut",
70+
"arguments": {"channel": 7},
71+
},
72+
73+
"rsmap": {
74+
"type": "local",
75+
"module": "artiq.coredevice.ttl",
76+
"class": "TTLOut",
77+
"arguments": {"channel": 8}
78+
},
79+
"rsman": {
80+
"type": "local",
81+
"module": "artiq.coredevice.ttl",
82+
"class": "TTLOut",
83+
"arguments": {"channel": 9}
84+
},
85+
86+
"led0": {
87+
"type": "local",
88+
"module": "artiq.coredevice.ttl",
89+
"class": "TTLOut",
90+
"arguments": {"channel": 0x010000},
91+
},
92+
"led1": {
93+
"type": "local",
94+
"module": "artiq.coredevice.ttl",
95+
"class": "TTLOut",
96+
"arguments": {"channel": 0x010001},
97+
},
98+
"led2": {
99+
"type": "local",
100+
"module": "artiq.coredevice.ttl",
101+
"class": "TTLOut",
102+
"arguments": {"channel": 0x010002},
103+
},
104+
"led3": {
105+
"type": "local",
106+
"module": "artiq.coredevice.ttl",
107+
"class": "TTLOut",
108+
"arguments": {"channel": 0x010003},
109+
},
110+
"led4": {
111+
"type": "local",
112+
"module": "artiq.coredevice.ttl",
113+
"class": "TTLOut",
114+
"arguments": {"channel": 0x010004},
115+
},
116+
"led5": {
117+
"type": "local",
118+
"module": "artiq.coredevice.ttl",
119+
"class": "TTLOut",
120+
"arguments": {"channel": 0x010005},
121+
},
122+
"led6": {
123+
"type": "local",
124+
"module": "artiq.coredevice.ttl",
125+
"class": "TTLOut",
126+
"arguments": {"channel": 0x010006},
127+
},
128+
"led7": {
129+
"type": "local",
130+
"module": "artiq.coredevice.ttl",
131+
"class": "TTLOut",
132+
"arguments": {"channel": 0x010007},
133+
},
134+
135+
"smap": {
136+
"type": "local",
137+
"module": "artiq.coredevice.ttl",
138+
"class": "TTLOut",
139+
"arguments": {"channel": 0x010008}
140+
},
141+
"sman": {
142+
"type": "local",
143+
"module": "artiq.coredevice.ttl",
144+
"class": "TTLOut",
145+
"arguments": {"channel": 0x010009}
146+
},
147+
148+
}

Diff for: ‎artiq/examples/drtio/repository/blink_forever.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from artiq.experiment import *
2+
3+
4+
class BlinkForever(EnvExperiment):
5+
def build(self):
6+
self.setattr_device("core")
7+
self.rleds = [self.get_device("rled" + str(i)) for i in range(8)]
8+
self.leds = [self.get_device("led" + str(i)) for i in range(8)]
9+
10+
@kernel
11+
def run(self):
12+
self.core.reset()
13+
14+
while True:
15+
with parallel:
16+
for led in self.leds:
17+
led.pulse(250*ms)
18+
for led in self.rleds:
19+
led.pulse(250*ms)
20+
t = now_mu()
21+
for led in self.leds:
22+
at_mu(t)
23+
led.pulse(500*ms)
24+
for led in self.rleds:
25+
at_mu(t)
26+
led.pulse(500*ms)
27+
delay(250*ms)

Diff for: ‎artiq/examples/drtio/repository/pulse_rate.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from artiq.experiment import *
2+
3+
4+
class PulseRate(EnvExperiment):
5+
def build(self):
6+
self.setattr_device("core")
7+
self.setattr_device("rsmap")
8+
9+
@kernel
10+
def run(self):
11+
self.core.reset()
12+
13+
dt = self.core.seconds_to_mu(300*ns)
14+
while True:
15+
for i in range(10000):
16+
try:
17+
self.rsmap.pulse_mu(dt)
18+
delay_mu(dt)
19+
except RTIOUnderflow:
20+
dt += 1
21+
self.core.break_realtime()
22+
break
23+
else:
24+
print(self.core.mu_to_seconds(dt))
25+
return

Diff for: ‎artiq/gateware/drtio/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from artiq.gateware.drtio.core import DRTIOSatellite, DRTIOMaster
2+

0 commit comments

Comments
 (0)
Please sign in to comment.