Skip to content

Commit 90ce54d

Browse files
committedAug 27, 2015
gateware/dds/monitor: support onehot selection, strip reset
1 parent 0fe0f4d commit 90ce54d

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed
 

Diff for: ‎artiq/gateware/rtio/phy/dds.py

+17-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class _AD9xxx(Module):
8-
def __init__(self, ftw_base, pads, nchannels, **kwargs):
8+
def __init__(self, ftw_base, pads, nchannels, onehot=False, **kwargs):
99
self.submodules._ll = RenameClockDomains(
1010
ad9xxx.AD9xxx(pads, **kwargs), "rio")
1111
self.submodules._rt2wb = RT2WB(flen(pads.a)+1, self._ll.bus)
@@ -21,23 +21,29 @@ def __init__(self, ftw_base, pads, nchannels, **kwargs):
2121
current_address.eq(self.rtlink.o.address),
2222
current_data.eq(self.rtlink.o.data))
2323

24-
# keep track of the currently selected channel
25-
current_channel = Signal(max=nchannels)
24+
# keep track of the currently selected channel(s)
25+
current_sel = Signal(flen(current_data)-1)
2626
self.sync.rio += If(current_address == 2**flen(pads.a) + 1,
27-
current_channel.eq(current_data))
27+
current_sel.eq(current_data[1:])) # strip reset
28+
29+
def selected(c):
30+
if onehot:
31+
return current_sel[c]
32+
else:
33+
return current_sel == c
2834

2935
# keep track of frequency tuning words, before they are FUDed
3036
ftws = [Signal(32) for i in range(nchannels)]
3137
for c, ftw in enumerate(ftws):
3238
if flen(pads.d) == 8:
3339
self.sync.rio += \
34-
If(current_channel == c, [
40+
If(selected(c), [
3541
If(current_address == ftw_base+i,
3642
ftw[i*8:(i+1)*8].eq(current_data))
3743
for i in range(4)])
3844
elif flen(pads.d) == 16:
3945
self.sync.rio += \
40-
If(current_channel == c, [
46+
If(selected(c), [
4147
If(current_address == ftw_base+2*i,
4248
ftw[i*16:(i+1)*16].eq(current_data))
4349
for i in range(2)])
@@ -46,15 +52,15 @@ def __init__(self, ftw_base, pads, nchannels, **kwargs):
4652

4753
# FTW to probe on FUD
4854
self.sync.rio += If(current_address == 2**flen(pads.a), [
49-
If(current_channel == c, probe.eq(ftw))
55+
If(selected(c), probe.eq(ftw))
5056
for c, (probe, ftw) in enumerate(zip(self.probes, ftws))])
5157

5258

5359
class AD9858(_AD9xxx):
54-
def __init__(self, pads, nchannels, **kwargs):
55-
_AD9xxx.__init__(self, 0x0a, pads, nchannels, **kwargs)
60+
def __init__(self, *args, **kwargs):
61+
_AD9xxx.__init__(self, 0x0a, *args, **kwargs)
5662

5763

5864
class AD9914(_AD9xxx):
59-
def __init__(self, pads, nchannels, **kwargs):
60-
_AD9xxx.__init__(self, 0x2d, pads, nchannels, **kwargs)
65+
def __init__(self, *args, **kwargs):
66+
_AD9xxx.__init__(self, 0x2d, *args, **kwargs)

Diff for: ‎soc/targets/artiq_kc705.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
206206
self.add_constant("DDS_CHANNEL_COUNT", 11)
207207
self.add_constant("DDS_AD9914")
208208
self.add_constant("DDS_ONEHOT_SEL")
209-
phy = dds.AD9914(platform.request("dds"), 11)
209+
phy = dds.AD9914(platform.request("dds"), 11, onehot=True)
210210
self.submodules += phy
211211
rtio_channels.append(rtio.Channel.from_phy(phy,
212212
ofifo_depth=512,

0 commit comments

Comments
 (0)
Please sign in to comment.