ethernet: inject Ethernet module definition during elaboration

This commit is contained in:
Fischer Moseley 2024-11-24 16:10:28 -08:00
parent 31aea6fc4a
commit 825232a6fb
2 changed files with 6 additions and 9 deletions

View File

@ -76,13 +76,6 @@ class EthernetIOCoreExample(Elaboratable):
# rmii_mdio = eth_pins.mdio,
# )
# m.submodules.rxd = rxd = io.Buffer("i", eth_pins.rxd)
# m.submodules.crs_dv = crs_dv = io.Buffer("i", eth_pins.crs_dv)
# m.submodules.txen = txen = io.Buffer("o", eth_pins.txen)
# m.submodules.txd = txd = io.Buffer("o", eth_pins.txd)
# m.submodules.mdc = mdc = io.Buffer("o", eth_pins.mdc)
# m.submodules.mdio = mdio = io.SingleEndedPort(io.Buffer("io", eth_pins.mdio))
m.submodules.eth_clk_io_buf = eth_clk_io_buf = io.Buffer("o", eth_pins.clk)
m.d.comb += eth_clk_io_buf.o.eq(ethclk.clk)
@ -97,8 +90,6 @@ class EthernetIOCoreExample(Elaboratable):
("io", "rmii_mdio", eth_pins.mdio.io),
]
platform.add_file("liteeth.v", self.manta.interface.generate_liteeth_core())
return m
def test(self):

View File

@ -293,6 +293,12 @@ class EthernetInterface(Elaboratable):
("i", "udp0_sink_valid", self._sink_valid),
)
# Add LiteEth module definition if we're in an Amaranth-native workflow
# If we're in a Verilog-based workflow, then platform will be None, and
# the module will be added in manta.generate_verilog()
if platform:
platform.add_file("liteeth.v", self.generate_liteeth_core())
m.submodules.source_bridge = source_bridge = UDPSourceBridge()
m.submodules.sink_bridge = sink_bridge = UDPSinkBridge()