Skip to content

Commit c591f1a

Browse files
committedDec 1, 2014
targets/ARTIQMiniSoC: support dynamic switching of RTIO clock to XTRIG
1 parent 57d633f commit c591f1a

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed
 

‎doc/manual/fpga_board_ports.rst

+2
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ When plugged to a QC-DAQ LVDS adapter, the AD9858 DDS hardware can be used in ad
3636
+--------------+----------+-----------------+
3737

3838
The input only limitation on channels 0 and 1 comes from the QC-DAQ adapter. When the adapter is not used (and physically unplugged from the Papilio Pro board), the corresponding pins on the Papilio Pro can be used as outputs. Do not configure these channels as outputs when the adapter is plugged, as this would cause electrical contention.
39+
40+
The board can accept an external RTIO clock connected to XTRIG.

‎soc/targets/artiq.py

+23-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from migen.fhdl.std import *
2+
from migen.bank.description import *
23
from migen.bank import wbgen
34
from mibuild.generic_platform import *
45

@@ -13,6 +14,7 @@
1314

1415
("pmt", 0, Pins("C:13"), IOStandard("LVTTL")),
1516
("pmt", 1, Pins("C:14"), IOStandard("LVTTL")),
17+
("xtrig", 0, Pins("C:12"), IOStandard("LVTTL")), # used for DDS clock
1618

1719
("ttl", 0, Pins("C:11"), IOStandard("LVTTL")),
1820
("ttl", 1, Pins("C:10"), IOStandard("LVTTL")),
@@ -51,27 +53,42 @@ def __init__(self, pad):
5153
self.comb += pad.eq(sr[0])
5254

5355

54-
class _RTIOMiniCRG(Module):
56+
class _RTIOMiniCRG(Module, AutoCSR):
5557
def __init__(self, platform):
58+
self._r_clock_sel = CSRStorage()
5659
self.clock_domains.cd_rtio = ClockDomain()
60+
5761
# 80MHz -> 125MHz
62+
rtio_internal_clk = Signal()
5863
self.specials += Instance("DCM_CLKGEN",
59-
p_CLKFXDV_DIVIDE=2, p_CLKFX_DIVIDE=16, p_CLKFX_MD_MAX=1.6, p_CLKFX_MULTIPLY=25,
60-
p_CLKIN_PERIOD=12.5, p_SPREAD_SPECTRUM="NONE", p_STARTUP_WAIT="FALSE",
64+
p_CLKFXDV_DIVIDE=2,
65+
p_CLKFX_DIVIDE=16, p_CLKFX_MD_MAX=1.6, p_CLKFX_MULTIPLY=25,
66+
p_CLKIN_PERIOD=12.5, p_SPREAD_SPECTRUM="NONE",
67+
p_STARTUP_WAIT="FALSE",
6168

62-
i_CLKIN=ClockSignal(), o_CLKFX=self.cd_rtio.clk,
69+
i_CLKIN=ClockSignal(), o_CLKFX=rtio_internal_clk,
6370
i_FREEZEDCM=0, i_RST=ResetSignal())
71+
72+
rtio_external_clk = platform.request("xtrig")
73+
platform.add_period_constraint(rtio_external_clk, 8.0)
74+
self.specials += Instance("BUFGMUX",
75+
i_I0=rtio_internal_clk,
76+
i_I1=rtio_external_clk,
77+
i_S=self._r_clock_sel.storage,
78+
o_O=self.cd_rtio.clk)
79+
6480
platform.add_platform_command("""
6581
NET "{rtio_clk}" TNM_NET = "GRPrtio_clk";
6682
NET "sys_clk" TNM_NET = "GRPsys_clk";
6783
TIMESPEC "TSfix_ise1" = FROM "GRPrtio_clk" TO "GRPsys_clk" TIG;
6884
TIMESPEC "TSfix_ise2" = FROM "GRPsys_clk" TO "GRPrtio_clk" TIG;
69-
""", rtio_clk=self.cd_rtio.clk)
85+
""", rtio_clk=rtio_internal_clk)
7086

7187

7288
class ARTIQMiniSoC(BaseSoC):
7389
csr_map = {
74-
"rtio": None # mapped on Wishbone instead
90+
"rtio": None, # mapped on Wishbone instead
91+
"rtiocrg": 13
7592
}
7693
csr_map.update(BaseSoC.csr_map)
7794

0 commit comments

Comments
 (0)
Please sign in to comment.