Skip to content

Commit

Permalink
phy/s7pciephy: Allow using external QPLL for QPLL sharing between PCI…
Browse files Browse the repository at this point in the history
…e and other protocols.
  • Loading branch information
enjoy-digital committed Jun 18, 2024
1 parent ab7be71 commit 88d43f0
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions litepcie/phy/s7pciephy.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,32 @@ def add_resync(self, sig, clk="sys"):
def add_ltssm_tracer(self):
self.ltssm_tracer = LTSSMTracer(self._link_status.fields.ltssm)

# External QPLL (Sharing) ----------------------------------------------------------------------
def use_external_qpll(self, qpll_channel):
self.pcie_phy_params.update(
# QPLL DRP Interface (not used).
i_qpll_drp_crscode = 0,
i_qpll_drp_fsm = 0,
i_qpll_drp_done = 1,
i_qpll_drp_reset = 0,
o_qpll_drp_clk = Open(),
o_qpll_drp_rst_n = Open(),
o_qpll_drp_ovrd = Open(),
o_qpll_drp_gen3 = Open(),
o_qpll_drp_start = Open(),

# QPLL Clk Interface.
i_qpll_qplllock = qpll_channel.lock,
i_qpll_qplloutclk = qpll_channel.clk,
i_qpll_qplloutrefclk = qpll_channel.refclk,
o_qpll_qplld = Open(),
o_qpll_qpllreset = qpll_channel.reset,
)
self.config.update({
"mode_selection" : "Advanced",
"en_ext_gt_common" : True,
})

# Hard IP sources ------------------------------------------------------------------------------
def update_config(self, config):
self.config.update(config)
Expand Down Expand Up @@ -518,10 +544,11 @@ def add_sources(self, platform, phy_path, phy_filename=None, user_config=None):
platform.toolchain.pre_synthesis_commands += ip_tcl

# Reset LOC constraints on GTPE2_COMMON and BRAM36 from .xci (we only want to keep Timing constraints).
if platform.device.startswith("xc7a"):
platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtp_common.gtpe2_common_i}}]")
else:
platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtx_common.gtxe2_common_i}}]")
if "en_ext_gt_common" not in self.config.keys():
if platform.device.startswith("xc7a"):
platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtp_common.gtpe2_common_i}}]")
else:
platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtx_common.gtxe2_common_i}}]")
if self.nlanes != 8:
platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*genblk*.bram36_tdp_bl.bram36_tdp_bl}}]")

Expand Down

0 comments on commit 88d43f0

Please sign in to comment.