Skip to content

Commit

Permalink
soc/cores/cpu/zynqmp/core.py: add_ethernet: added gt_location require…
Browse files Browse the repository at this point in the history
…d by SGMII
  • Loading branch information
trabucayre committed Oct 10, 2024
1 parent 2935b7a commit 7f04caf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions litex/soc/cores/cpu/zynqmp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,16 @@ 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.
"""
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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \\")
Expand All @@ -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}}'))
Expand Down

0 comments on commit 7f04caf

Please sign in to comment.