@@ -14,39 +14,40 @@ def __init__(self, ftw_base, pads, nchannels, **kwargs):
14
14
15
15
# # #
16
16
17
+ # buffer the current address/data on the rtlink output
18
+ current_address = Signal .like (self .rtlink .o .address )
19
+ current_data = Signal .like (self .rtlink .o .data )
20
+ self .sync .rio += If (self .rtlink .o .stb ,
21
+ current_address .eq (self .rtlink .o .address ),
22
+ current_data .eq (self .rtlink .o .data ))
23
+
17
24
# keep track of the currently selected channel
18
25
current_channel = Signal (max = nchannels )
19
- self .sync .rio += If (self .rtlink .o .stb &
20
- (self .rtlink .o .address == 2 ** flen (pads .a )+ 1 ),
21
- current_channel .eq (self .rtlink .o .data ))
26
+ self .sync .rio += If (current_address == 2 ** flen (pads .a ) + 1 ,
27
+ current_channel .eq (current_data ))
22
28
23
29
# keep track of frequency tuning words, before they are FUDed
24
30
ftws = [Signal (32 ) for i in range (nchannels )]
25
31
for c , ftw in enumerate (ftws ):
26
32
if flen (pads .d ) == 8 :
27
- for i in range (4 ):
28
- self .sync .rio += \
29
- If (self .rtlink .o .stb & \
30
- (self .rtlink .o .address == ftw_base + i ) & \
31
- (current_channel == c ),
32
- ftw [i * 8 :(i + 1 )* 8 ].eq (self .rtlink .o .data )
33
- )
33
+ self .sync .rio += \
34
+ If (current_channel == c , [
35
+ If (current_address == ftw_base + i ,
36
+ ftw [i * 8 :(i + 1 )* 8 ].eq (current_data ))
37
+ for i in range (4 )])
34
38
elif flen (pads .d ) == 16 :
35
- for i in range (2 ):
36
- self .sync .rio += \
37
- If (self .rtlink .o .stb & \
38
- (self .rtlink .o .address == ftw_base + 2 * i ) & \
39
- (current_channel == c ),
40
- ftw [i * 16 :(i + 1 )* 16 ].eq (self .rtlink .o .data )
41
- )
39
+ self .sync .rio += \
40
+ If (current_channel == c , [
41
+ If (current_address == ftw_base + 2 * i ,
42
+ ftw [i * 16 :(i + 1 )* 16 ].eq (current_data ))
43
+ for i in range (2 )])
42
44
else :
43
45
raise NotImplementedError
44
46
45
47
# FTW to probe on FUD
46
- for c , (probe , ftw ) in enumerate (zip (self .probes , ftws )):
47
- fud = self .rtlink .o .stb & \
48
- (self .rtlink .o .address == 2 ** flen (pads .a ))
49
- self .sync .rio += If (fud & (current_channel == c ), probe .eq (ftw ))
48
+ self .sync .rio += If (current_address == 2 ** flen (pads .a ), [
49
+ If (current_channel == c , probe .eq (ftw ))
50
+ for c , (probe , ftw ) in enumerate (zip (self .probes , ftws ))])
50
51
51
52
52
53
class AD9858 (_AD9xxx ):
0 commit comments