From 7f04cafe0841b929fb8eb30df2fb5aad579b1026 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Thu, 10 Oct 2024 17:28:29 +0200 Subject: [PATCH] soc/cores/cpu/zynqmp/core.py: add_ethernet: added gt_location required by SGMII --- litex/soc/cores/cpu/zynqmp/core.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/litex/soc/cores/cpu/zynqmp/core.py b/litex/soc/cores/cpu/zynqmp/core.py index 475431a6a7..88d57eac5e 100644 --- a/litex/soc/cores/cpu/zynqmp/core.py +++ b/litex/soc/cores/cpu/zynqmp/core.py @@ -171,6 +171,8 @@ def add_axi_gp_master(self, n=0, data_width=32): Physical ethernet interface (gmii, rgmii, sgmii). reset: Signal Reset signal between PS and converter (required for SGMII). + gt_location: str + for SGMII Pads location (XaYb) (Required for SGMII). with_ptp: bool Enable PTP support. """ @@ -178,6 +180,7 @@ def add_ethernet(self, n=0, pads = None, clock_pads = None, if_type = "gmii", + gt_location= None, reset = None, with_ptp = False): assert n < 3 and not n in self.gem_mac @@ -299,8 +302,10 @@ def add_ethernet(self, n=0, o_speed_mode = Open(2), ) self.specials += Instance(f"gem{n}", **mac_params) - self.gem_mac[n] = "rgmii" + self.gem_mac[n] = ("rgmii", None) else: + assert gt_location is not None + pwrgood = Signal() status = Signal(16) reset_done = Signal(1) @@ -428,7 +433,7 @@ def add_ethernet(self, n=0, ] self.specials += Instance(f"gem{n}", **mac_params) - self.gem_mac[n] = "sgmii" + self.gem_mac[n] = ("sgmii", gt_location) def add_i2c(self, n, pads): assert n < 2 and not n in self.i2c_use @@ -568,7 +573,7 @@ def do_finalize(self): if len(self.gem_mac): mac_tcl = [] - for i, if_type in self.gem_mac.items(): + for i, (if_type, gt_location) in self.gem_mac.items(): ip_name = {"rgmii": "gmii_to_rgmii", "sgmii": "gig_ethernet_pcs_pma"}[if_type] mac_tcl.append(f"set gem{i} [create_ip -vendor xilinx.com -name {ip_name} -module_name gem{i}]") mac_tcl.append("set_property -dict [ list \\") @@ -583,7 +588,7 @@ def do_finalize(self): mac_tcl.append("CONFIG.{} {} \\".format("DIFFCLK_BOARD_INTERFACE", '{{Custom}}')) mac_tcl.append("CONFIG.{} {} \\".format("DrpClkRate", '{{50.0000}}')) mac_tcl.append("CONFIG.{} {} \\".format("EMAC_IF_TEMAC", '{{GEM}}')) - mac_tcl.append("CONFIG.{} {} \\".format("GT_Location", '{{X1Y13}}')) + mac_tcl.append("CONFIG.{} {} \\".format(f"GT_Location", '{{' + gt_location + '}}')) mac_tcl.append("CONFIG.{} {} \\".format("RefClkRate", '{{156.25}}')) mac_tcl.append("CONFIG.{} {} \\".format("Standard", '{{SGMII}}')) mac_tcl.append("CONFIG.{} {} \\".format("SupportLevel", '{{Include_Shared_Logic_in_Core}}'))