@@ -40,16 +40,24 @@ def __init__(self, pads):
40
40
self .comb += source .eop .eq (eop )
41
41
42
42
class LiteEthPHYGMIICRG (Module , AutoCSR ):
43
- def __init__ (self , clock_pads , pads , with_hw_init_reset ):
43
+ def __init__ (self , clock_pads , pads , with_hw_init_reset , mii_mode = 0 ):
44
44
self ._reset = CSRStorage ()
45
45
###
46
46
self .clock_domains .cd_eth_rx = ClockDomain ()
47
47
self .clock_domains .cd_eth_tx = ClockDomain ()
48
- self .specials += DDROutput (1 , 0 , clock_pads .gtx , ClockSignal ("eth_tx" ))
49
- self .comb += [
50
- self .cd_eth_rx .clk .eq (clock_pads .rx ), # Let the synthesis tool insert
51
- self .cd_eth_tx .clk .eq (self .cd_eth_rx .clk ) # the appropriate clock buffer
52
- ]
48
+
49
+ # RX : Let the synthesis tool insert the appropriate clock buffer
50
+ self .comb += self .cd_eth_rx .clk .eq (clock_pads .rx )
51
+
52
+ # TX : GMII: Drive clock_pads.gtx, clock_pads.tx unused
53
+ # MII: Use PHY clock_pads.tx as eth_tx_clk, do not drive clock_pads.gtx
54
+ self .specials += DDROutput (1 , mii_mode , clock_pads .gtx , ClockSignal ("eth_tx" ))
55
+ # XXX Xilinx specific, replace BUFGMUX with a generic clock buffer?
56
+ self .specials += Instance ("BUFGMUX" ,
57
+ i_I0 = self .cd_eth_rx .clk ,
58
+ i_I1 = clock_pads .tx ,
59
+ i_S = mii_mode ,
60
+ o_O = self .cd_eth_tx .clk )
53
61
54
62
if with_hw_init_reset :
55
63
reset = Signal ()
0 commit comments