The GEM on the PS side of Zynq natively outputs GMII. To connect to an RGMII PHY such as the RTL8211F, conversion must be done in the PL. A developer tried both the official gmii_to_rgmii IP core and handwritten Verilog on a Zynq-7015 development board. What blocked progress was not the logic itself, but who should provide the 2 ns clock delay.
RGMII requires the transmit clock to be delayed by about 2 ns relative to the data. This delay can be placed on the FPGA side or on the PHY side. The RTL8211F uses the levels on the RXD0 and RXD1 pins to determine whether its internal TX/RX delay is enabled. On this development board, these two pins are pulled up, meaning the internal delay is already enabled. The official gmii_to_rgmii IP core by default uses the path in which an MMCM provides the delay and requires these two strap pins to be low. When the hardware has them pulled up, the IP core cannot work directly. This means the choice of approach is fixed at the board-design stage by the strap resistors, and the software side can only accommodate it.
After switching to a handwritten gmii_to_rgmii.v, the correct approach is to use the 0° clk_125m for all ODDR in the transmit direction, and to sample with the original rgmii_rxc in the receive direction without introducing a 90° phase-shifted clock, because the PHY has already added the delay. The author also gives a debugging method: add an IDELAYE2 on the receive path and pair it with VIO, dynamically adjust the delay value between 0 and 31, use ILA to observe whether the SFD is 0xD5, and fix the value once a suitable one is found. In addition, ILA sampling across clock domains creates a timing path with a 2 ns period, which needs to be excluded with a false path; this is unrelated to functionality.
Getting the hardware working is only the first step. The kernel needs the Zynq GEM driver and the RTL8211F PHY driver compiled in. After boot, use ifconfig -a, filter dmesg for gem/macb, and check the mdio_bus devices to confirm loading. In the device tree, phy-mode must be changed from gmii to rgmii-id to match the external interface; depending on PCB routing, rgmii-txid, rgmii-rxid, or rgmii can also be selected. The author notes that with the IP core approach, there is no need to describe the PHY address of the PL-side Ethernet port in the device tree, whereas the handwritten approach requires adding the MDIO bus and PHY node.
For engineers working on Zynq boards, the value of this article is that it moves the judgment of whether the official IP can be used forward to the schematic stage: how the RTL8211F strap resistors are connected directly determines whether the follow-up work will involve struggling with the IP core or writing Verilog yourself. Boards that already have the pull-ups do not need to be changed; the handwritten module plus IDELAY debugging is a feasible path, but timing constraints and false paths must be added by the user, and the toolchain still relies on Vivado's ILA/VIO. If a domestic replacement PHY configures delays differently, the same clock scheme must be rechecked and cannot be copied directly.
Daily Briefing · Weekly Digest · Monthly Deep Dive