Skip to content

Commit 2881d5f

Browse files
committedJul 2, 2015
gateware: add RTIO clock generator
1 parent 74f0709 commit 2881d5f

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed
 

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

+18
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,21 @@ def __init__(self, pad):
7575
]
7676

7777
self.probes += [i, ts.oe]
78+
79+
80+
class ClockGen(Module):
81+
def __init__(self, pad, ftw_width=16):
82+
self.rtlink = rtlink.Interface(
83+
rtlink.OInterface(ftw_width, suppress_nop=False))
84+
85+
# # #
86+
87+
ftw = Signal(ftw_width)
88+
acc = Signal(ftw_width)
89+
self.sync.rio += If(self.rtlink.o.stb, ftw.eq(self.rtlink.o.data))
90+
self.sync.rio_phy += [
91+
acc.eq(acc + ftw),
92+
# known phase on write: at rising edge
93+
If(self.rtlink.o.stb, acc.eq(2**(ftw_width - 1))),
94+
pad.eq(acc[-1])
95+
]

Diff for: ‎doc/manual/fpga_board_ports.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ When plugged to an adapter, the NIST QC1 hardware can be used. The TTL lines are
2020
+--------------+----------+------------+
2121
| 1 | PMT1 | Input |
2222
+--------------+----------+------------+
23-
| 2-17 | TTL0-15 | Output |
23+
| 2-16 | TTL0-14 | Output |
24+
+--------------+----------+------------+
25+
| 17 | TTL15 | Clock |
2426
+--------------+----------+------------+
2527
| 18 | EXT_LED | Output |
2628
+--------------+----------+------------+

Diff for: ‎soc/targets/artiq_kc705.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
9595
phy = ttl_simple.Inout(platform.request("pmt", i))
9696
self.submodules += phy
9797
rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=512))
98-
for i in range(16):
98+
for i in range(15):
9999
phy = ttl_simple.Output(platform.request("ttl", i))
100100
self.submodules += phy
101101
rtio_channels.append(rtio.Channel.from_phy(phy))
@@ -105,6 +105,10 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
105105
rtio_channels.append(rtio.Channel.from_phy(phy))
106106
self.add_constant("RTIO_TTL_COUNT", len(rtio_channels))
107107

108+
phy = ttl_simple.ClockGen(platform.request("ttl", 15))
109+
self.submodules += phy
110+
rtio_channels.append(rtio.Channel.from_phy(phy))
111+
108112
self.add_constant("RTIO_DDS_CHANNEL", len(rtio_channels))
109113
self.add_constant("DDS_CHANNEL_COUNT", 8)
110114
self.add_constant("DDS_AD9858")
@@ -123,6 +127,9 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
123127

124128
rtio_channels = []
125129
for i in range(16):
130+
if i == 14:
131+
# TTL14 is for the clock generator
132+
break
126133
if i % 4 == 3:
127134
phy = ttl_simple.Inout(platform.request("ttl", i))
128135
self.submodules += phy
@@ -137,6 +144,10 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
137144
rtio_channels.append(rtio.Channel.from_phy(phy))
138145
self.add_constant("RTIO_TTL_COUNT", len(rtio_channels))
139146

147+
phy = ttl_simple.ClockGen(platform.request("ttl", 14))
148+
self.submodules += phy
149+
rtio_channels.append(rtio.Channel.from_phy(phy))
150+
140151
self.add_constant("RTIO_DDS_CHANNEL", len(rtio_channels))
141152
self.add_constant("DDS_CHANNEL_COUNT", 11)
142153
self.add_constant("DDS_AD9914")

Diff for: ‎soc/targets/artiq_pipistrello.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
100100
rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=512,
101101
ofifo_depth=4))
102102

103-
for i in range(16):
103+
for i in range(15):
104104
phy = ttl_simple.Output(platform.request("ttl", i))
105105
self.submodules += phy
106106
rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=256))
@@ -115,6 +115,10 @@ def __init__(self, platform, cpu_type="or1k", **kwargs):
115115

116116
self.add_constant("RTIO_TTL_COUNT", len(rtio_channels))
117117

118+
phy = ttl_simple.ClockGen(platform.request("ttl", 15))
119+
self.submodules += phy
120+
rtio_channels.append(rtio.Channel.from_phy(phy))
121+
118122
self.add_constant("RTIO_DDS_CHANNEL", len(rtio_channels))
119123
self.add_constant("DDS_CHANNEL_COUNT", 8)
120124
phy = dds.AD9858(platform.request("dds"), 8)

0 commit comments

Comments
 (0)
Please sign in to comment.