Skip to content

Commit

Permalink
targets/CRG: Add rst signal when missing.
Browse files Browse the repository at this point in the history
Allow properly reseting the PLL from the SoC.
  • Loading branch information
enjoy-digital committed Jul 26, 2023
1 parent ace7896 commit c1088be
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 12 deletions.
3 changes: 3 additions & 0 deletions litex_boards/targets/antmicro_datacenter_ddr4_test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq, iodelay_clk_freq, with_video_pll=False):
self.rst = Signal()
self.cd_sys = ClockDomain()
self.cd_sys2x = ClockDomain()
self.cd_sys4x = ClockDomain()
Expand All @@ -54,6 +55,7 @@ def __init__(self, platform, sys_clk_freq, iodelay_clk_freq, with_video_pll=Fals
clk100 = platform.request("clk100")

self.pll = pll = S7PLL(speedgrade=-1)
self.comb += pll.reset.eq(self.rst)
pll.register_clkin(clk100, 100e6)
pll.create_clkout(self.cd_sys, sys_clk_freq)
pll.create_clkout(self.cd_sys2x, 2 * sys_clk_freq)
Expand All @@ -66,6 +68,7 @@ def __init__(self, platform, sys_clk_freq, iodelay_clk_freq, with_video_pll=Fals
# Video PLL.
if with_video_pll:
self.video_pll = video_pll = S7MMCM(speedgrade=-1)
self.comb += video_pll.reset.eq(self.rst)
video_pll.register_clkin(clk100, 100e6)
video_pll.create_clkout(self.cd_hdmi, 40e6)
video_pll.create_clkout(self.cd_hdmi5x, 5*40e6)
Expand Down
2 changes: 2 additions & 0 deletions litex_boards/targets/antmicro_lpddr4_test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq, iodelay_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()
self.cd_sys2x = ClockDomain()
self.cd_sys8x = ClockDomain()
Expand All @@ -35,6 +36,7 @@ def __init__(self, platform, sys_clk_freq, iodelay_clk_freq):
# # #

self.pll = pll = S7PLL(speedgrade=-1)
self.comb += pll.reset.eq(self.rst)
pll.register_clkin(platform.request("clk100"), 100e6)
pll.create_clkout(self.cd_sys, sys_clk_freq)
pll.create_clkout(self.cd_sys2x, 2 * sys_clk_freq)
Expand Down
2 changes: 2 additions & 0 deletions litex_boards/targets/antmicro_sdi_mipi_video_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_por = ClockDomain()
self.cd_sys = ClockDomain()

Expand All @@ -48,6 +49,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL
self.sys_pll = sys_pll = NXPLL(platform=platform, create_output_port_clocks=True)
self.comb += sys_pll.reset.eq(self.rst)
sys_pll.register_clkin(self.cd_por.clk, hf_clk_freq)
sys_pll.create_clkout(self.cd_sys, sys_clk_freq)
self.specials += AsyncResetSynchronizer(self.cd_sys, ~self.sys_pll.locked | ~por_done)
Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/decklink_intensity_pro_4k.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #

self.pll = pll = S7PLL(speedgrade=-1)
self.comb += pll.reset.eq(ResetSignal("pcie"))
self.comb += pll.reset.eq(ResetSignal("pcie") | self.rst)
pll.register_clkin(ClockSignal("pcie"), 125e6)
pll.create_clkout(self.cd_sys, sys_clk_freq)
platform.add_false_path_constraints(self.cd_sys.clk, pll.clkin) # Ignore sys_clk to pll.clkin path created by SoC's rst.
Expand Down
2 changes: 2 additions & 0 deletions litex_boards/targets/decklink_quad_hdmi_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()
self.cd_sys4x = ClockDomain()
self.cd_pll4x = ClockDomain()
Expand All @@ -44,6 +45,7 @@ def __init__(self, platform, sys_clk_freq):
# # #

self.pll = pll = USMMCM(speedgrade=-2)
self.comb += pll.reset.eq(self.rst)
pll.register_clkin(platform.request("clk200"), 200e6)
pll.create_clkout(self.cd_pll4x, sys_clk_freq*4, buf=None, with_reset=False)
pll.create_clkout(self.cd_idelay, 200e6)
Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/efinix_t8f81_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -38,7 +39,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL.
self.pll = pll = TRIONPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk33, 33.333e6)
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)

Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/efinix_titanium_ti60_f225_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -37,7 +38,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL
self.pll = pll = TITANIUMPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk25, 25e6)
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
# (integer) of the reference clock. If all your system clocks do not fall within
Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/efinix_trion_t120_bga576_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -37,7 +38,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL
self.pll = pll = TRIONPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk40, 40e6)
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True, name="axi_clk")

Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/efinix_trion_t20_bga256_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -35,7 +36,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL
self.pll = pll = TRIONPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk50, 50e6)
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)

Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/efinix_trion_t20_mipi_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -33,7 +34,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL
self.pll = pll = TRIONPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk50, 50e6)
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)

Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/efinix_xyloni_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -37,7 +38,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL.
self.pll = pll = TRIONPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk33, 33.333e6)
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)

Expand Down
2 changes: 2 additions & 0 deletions litex_boards/targets/fairwaves_xtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

class CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq, with_pcie=False):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -57,6 +58,7 @@ def __init__(self, platform, sys_clk_freq, with_pcie=False):
]
else:
self.pll = pll = S7PLL(speedgrade=-2)
self.comb += pll.reset.eq(self.rst)
pll.register_clkin(platform.request("clk60"), 60e6)
pll.create_clkout(self.cd_sys, sys_clk_freq)

Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/jungle_electronics_fireant.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #
Expand All @@ -41,7 +42,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL.
self.pll = pll = TRIONPLL(platform)
self.comb += pll.reset.eq(~rst_n)
self.comb += pll.reset.eq(~rst_n | self.rst)
pll.register_clkin(clk33, 33.333e6)
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)

Expand Down
2 changes: 2 additions & 0 deletions litex_boards/targets/lattice_crosslink_nx_evn.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_por = ClockDomain()
self.cd_sys = ClockDomain()

Expand All @@ -51,6 +52,7 @@ def __init__(self, platform, sys_clk_freq):

# PLL
self.sys_pll = sys_pll = NXPLL(platform=platform, create_output_port_clocks=True)
self.comb += sys_pll.reset.eq(self.rst)
sys_pll.register_clkin(self.cd_por.clk, hf_clk_freq)
sys_pll.create_clkout(self.cd_sys, sys_clk_freq)
self.specials += AsyncResetSynchronizer(self.cd_sys, ~self.sys_pll.locked | ~por_done )
Expand Down
5 changes: 3 additions & 2 deletions litex_boards/targets/sipeed_tang_primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.cd_sys = ClockDomain()
self.rst = Signal()
self.cd_sys = ClockDomain()

# # #

Expand All @@ -34,7 +35,7 @@ def __init__(self, platform, sys_clk_freq):
rst_n = platform.request("user_btn", 0)

self.comb += self.cd_sys.clk.eq(clk24)
self.specials += AsyncResetSynchronizer(self.cd_sys, ~rst_n)
self.specials += AsyncResetSynchronizer(self.cd_sys, ~rst_n | self.rst)

# BaseSoC ------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/sipeed_tang_primer_20k.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, platform, sys_clk_freq, with_video_pll=False):

# PLL
self.pll = pll = GW2APLL(devicename=platform.devicename, device=platform.device)
self.comb += pll.reset.eq(~por_done)
self.comb += pll.reset.eq(~por_done | self.rst)
pll.register_clkin(clk27, 27e6)
pll.create_clkout(self.cd_sys2x_i, 2*sys_clk_freq)
self.specials += [
Expand Down
2 changes: 2 additions & 0 deletions litex_boards/targets/xilinx_alveo_u280.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq, ddram_channel, with_hbm):
if with_hbm:
self.rst = Signal()
self.cd_sys = ClockDomain()
self.cd_hbm_ref = ClockDomain()
self.cd_apb = ClockDomain()
Expand All @@ -60,6 +61,7 @@ def __init__(self, platform, sys_clk_freq, ddram_channel, with_hbm):

if with_hbm:
self.pll = pll = USMMCM(speedgrade=-2)
self.comb += pll.reset.eq(self.rst)
pll.register_clkin(platform.request("sysclk", ddram_channel), 100e6)
pll.create_clkout(self.cd_sys, sys_clk_freq)
pll.create_clkout(self.cd_hbm_ref, 100e6)
Expand Down
3 changes: 2 additions & 1 deletion litex_boards/targets/ztex213.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

class _CRG(LiteXModule):
def __init__(self, platform, sys_clk_freq):
self.rst = Signal()
self.cd_sys = ClockDomain()
self.cd_sys4x = ClockDomain()
self.cd_sys4x_dqs = ClockDomain()
Expand All @@ -53,7 +54,7 @@ def __init__(self, platform, sys_clk_freq):
self.comb += self.cd_por.clk.eq(clk48)
self.comb += por_done.eq(por_count == 0)
self.sync.por += If(~por_done, por_count.eq(por_count - 1))
self.comb += pll.reset.eq(~por_done)
self.comb += pll.reset.eq(~por_done | self.rst)

self.idelayctrl = S7IDELAYCTRL(self.cd_idelay)

Expand Down

0 comments on commit c1088be

Please sign in to comment.