@@ -171,6 +171,7 @@ def __init__(self, platform, core_config):
171171 if deprecated in core_config :
172172 raise RuntimeWarning ("Config option {!r} is now a sub-option of 'soc'" .format (deprecated ))
173173
174+ # SoC parameters ---------------------------------------------------------------------------
174175 soc_args = {}
175176 if "soc" in core_config :
176177 soc_config = core_config ["soc" ]
@@ -181,28 +182,35 @@ def __init__(self, platform, core_config):
181182 else :
182183 soc_args [arg ] = soc_config [arg ]
183184
185+ # SoCMini ----------------------------------------------------------------------------------
184186 SoCMini .__init__ (self , platform , clk_freq = core_config ["clk_freq" ], ** soc_args )
187+
188+ # CRG --------------------------------------------------------------------------------------
185189 self .submodules .crg = CRG (platform .request ("sys_clock" ),
186190 platform .request ("sys_reset" ))
191+ # PHY --------------------------------------------------------------------------------------
187192 phy = core_config ["phy" ]
188-
189- # ethernet
190193 if phy in [liteeth_phys .LiteEthPHYMII ]:
194+ assert self .clk_freq >= 12.5e6
191195 ethphy = phy (
192196 clock_pads = platform .request ("mii_eth_clocks" ),
193197 pads = platform .request ("mii_eth" ))
194198 elif phy in [liteeth_phys .LiteEthPHYRMII ]:
199+ assert self .clk_freq >= 12.5e6
195200 ethphy = phy (
196201 clock_pads = platform .request ("rmii_eth_clocks" ),
197202 pads = platform .request ("rmii_eth" ))
198203 elif phy in [liteeth_phys .LiteEthPHYGMII ]:
204+ assert self .clk_freq >= 125e6
199205 ethphy = phy (
200206 clock_pads = platform .request ("gmii_eth_clocks" ),
201207 pads = platform .request ("gmii_eth" ))
202208 elif phy in [liteeth_phys .LiteEthS7PHYRGMII , liteeth_phys .LiteEthECP5PHYRGMII ]:
209+ assert self .clk_freq >= 125e6
203210 ethphy = phy (
204- clock_pads = platform .request ("rgmii_eth_clocks" ),
205- pads = platform .request ("rgmii_eth" ))
211+ clock_pads = platform .request ("rgmii_eth_clocks" ),
212+ pads = platform .request ("rgmii_eth" ),
213+ with_hw_init_reset = False ) # FIXME: required since sys_clk = eth_rx_clk.
206214 else :
207215 raise ValueError ("Unsupported PHY" );
208216 self .submodules .ethphy = ethphy
@@ -212,13 +220,20 @@ def __init__(self, platform, core_config):
212220
213221class MACCore (PHYCore ):
214222 def __init__ (self , platform , core_config ):
223+ # PHY --------------------------------------------------------------------------------------
215224 PHYCore .__init__ (self , platform , core_config )
216225
217- self .submodules .ethmac = LiteEthMAC (phy = self .ethphy , dw = 32 , interface = "wishbone" , endianness = core_config ["endianness" ])
226+ # MAC --------------------------------------------------------------------------------------
227+ self .submodules .ethmac = LiteEthMAC (
228+ phy = self .ethphy ,
229+ dw = 32 ,
230+ interface = "wishbone" ,
231+ endianness = core_config ["endianness" ])
218232 self .add_wb_slave (self .mem_map ["ethmac" ], self .ethmac .bus )
219233 self .add_memory_region ("ethmac" , self .mem_map ["ethmac" ], 0x2000 , type = "io" )
220234 self .add_csr ("ethmac" )
221235
236+ # Wishbone Interface -----------------------------------------------------------------------
222237 class _WishboneBridge (Module ):
223238 def __init__ (self , interface ):
224239 self .wishbone = interface
@@ -228,15 +243,23 @@ def __init__(self, interface):
228243 self .submodules += bridge
229244 self .add_wb_master (bridge .wishbone )
230245
246+ # Interrupt Interface ----------------------------------------------------------------------
231247 self .comb += self .platform .request ("interrupt" ).eq (self .ethmac .ev .irq )
232248
233249# UDP Core -----------------------------------------------------------------------------------------
234250
235251class UDPCore (PHYCore ):
236252 def __init__ (self , platform , core_config ):
253+ # PHY --------------------------------------------------------------------------------------
237254 PHYCore .__init__ (self , platform , core_config )
238255
239- self .submodules .core = LiteEthUDPIPCore (self .ethphy , core_config ["mac_address" ], convert_ip (core_config ["ip_address" ]), core_config ["clk_freq" ])
256+ # Core -------------------------------------------------------------------------------------
257+ self .submodules .core = LiteEthUDPIPCore (self .ethphy ,
258+ mac_address = core_config ["mac_address" ],
259+ ip_address = core_config ["ip_address" ],
260+ clk_freq = core_config ["clk_freq" ])
261+
262+ # UDP --------------------------------------------------------------------------------------
240263 udp_port = self .core .udp .crossbar .get_port (core_config ["port" ], 8 )
241264 # XXX avoid manual connect
242265 udp_sink = self .platform .request ("udp_sink" )
0 commit comments