File tree 4 files changed +64
-15
lines changed
4 files changed +64
-15
lines changed Original file line number Diff line number Diff line change 10
10
PHASE_MODE_TRACKING = 2
11
11
12
12
13
+ class DDSBus (AutoDB ):
14
+ """Core device Direct Digital Synthesis (DDS) bus batching driver.
15
+
16
+ Manages batching of DDS commands on a DDS shared bus."""
17
+ class DBKeys :
18
+ core = Device ()
19
+
20
+ @kernel
21
+ def batch_enter (self ):
22
+ """Starts a DDS command batch. All DDS commands are buffered
23
+ after this call, until ``batch_exit`` is called."""
24
+ syscall ("dds_batch_enter" , time_to_cycles (now ()))
25
+
26
+ @kernel
27
+ def batch_exit (self ):
28
+ """Ends a DDS command batch. All buffered DDS commands are issued
29
+ on the bus, and FUD is pulsed at the time the batch started."""
30
+ syscall ("dds_batch_exit" )
31
+
32
+
13
33
class DDS (AutoDB ):
14
34
"""Core device Direct Digital Synthesis (DDS) driver.
15
35
16
- Controls DDS devices managed directly by the core device's runtime.
36
+ Controls one DDS channel managed directly by the core device's runtime.
17
37
18
38
:param dds_sysclk: DDS system frequency, used for computing the frequency
19
39
tuning words.
@@ -43,7 +63,7 @@ def ftw_to_frequency(self, ftw):
43
63
44
64
@kernel
45
65
def init (self ):
46
- """Resets and initializes the DDS."""
66
+ """Resets and initializes the DDS channel ."""
47
67
syscall ("dds_init" , time_to_cycles (now ()), self .channel )
48
68
49
69
@kernel
Original file line number Diff line number Diff line change 50
50
"arguments": {"channel": 18}
51
51
},
52
52
53
+ "dds_bus": {
54
+ "type": "local",
55
+ "module": "artiq.coredevice.dds",
56
+ "class": "DDSBus",
57
+ "arguments": {}
58
+ },
53
59
"dds0": {
54
60
"type": "local",
55
61
"module": "artiq.coredevice.dds",
123
129
},
124
130
125
131
"pmt": "pmt0",
126
- "bd": "dds0",
127
- "bdd": "dds1"
132
+ "bd_dds": "dds0",
133
+ "bd_sw": "ttl0",
134
+ "bdd_dds": "dds1",
135
+ "bdd_sw": "ttl1"
128
136
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class DDSTest(Experiment, AutoDB):
6
6
7
7
class DBKeys :
8
8
core = Device ()
9
+ dds_bus = Device ()
9
10
dds0 = Device ()
10
11
dds1 = Device ()
11
12
dds2 = Device ()
@@ -16,9 +17,10 @@ class DBKeys:
16
17
17
18
@kernel
18
19
def run (self ):
19
- # with dds_batch:
20
- # self.dds1.set(120*MHz)
21
- # self.dds2.set(200*MHz)
20
+ self .dds_bus .batch_enter ()
21
+ self .dds1 .set (120 * MHz )
22
+ self .dds2 .set (200 * MHz )
23
+ self .dds_bus .batch_exit ()
22
24
23
25
for i in range (10000 ):
24
26
if i & 0x200 :
Original file line number Diff line number Diff line change @@ -6,8 +6,11 @@ class PhotonHistogram(Experiment, AutoDB):
6
6
7
7
class DBKeys :
8
8
core = Device ()
9
- bd = Device ()
10
- bdd = Device ()
9
+ dds_bus = Device ()
10
+ bd_dds = Device ()
11
+ bd_sw = Device ()
12
+ bdd_dds = Device ()
13
+ bdd_sw = Device ()
11
14
pmt = Device ()
12
15
13
16
nbins = Argument (100 )
@@ -22,21 +25,37 @@ class DBKeys:
22
25
hist = Result ()
23
26
total = Result ()
24
27
28
+ @kernel
29
+ def program_cooling (self ):
30
+ self .dds_bus .batch_enter ()
31
+ self .bd_dds .set (200 * MHz )
32
+ self .bdd_dds .set (300 * MHz )
33
+ self .dds_bus .batch_exit ()
34
+
25
35
@kernel
26
36
def cool_detect (self ):
27
37
with parallel :
28
- self .bd .pulse (200 * MHz , 1 * ms )
29
- self .bdd .pulse (300 * MHz , 1 * ms )
30
- self .bd .pulse (self .cool_f , 100 * us )
38
+ self .bd_sw .pulse (1 * ms )
39
+ self .bdd_sw .pulse (1 * ms )
40
+
41
+ self .bd_dds .set (self .cool_f )
42
+ self .bd_sw .pulse (100 * us )
43
+
44
+ self .bd_dds .set (self .detect_f )
31
45
with parallel :
32
- self .bd .pulse (self . detect_f , self .detect_t )
46
+ self .bd_sw .pulse (self .detect_t )
33
47
self .pmt .gate_rising (self .detect_t )
34
- self .bd .on (200 * MHz )
35
- self .bdd .on (300 * MHz )
48
+
49
+ self .program_cooling ()
50
+ self .bd_sw .on ()
51
+ self .bdd_sw .on ()
52
+
36
53
return self .pmt .count ()
37
54
38
55
@kernel
39
56
def run (self ):
57
+ self .program_cooling ()
58
+
40
59
hist = [0 for _ in range (self .nbins )]
41
60
total = 0
42
61
You can’t perform that action at this time.
0 commit comments