Skip to content

Commit

Permalink
ethernet: inject Ethernet module definition during elaboration
Browse files Browse the repository at this point in the history
  • Loading branch information
fischermoseley committed Nov 25, 2024
1 parent 31aea6f commit 825232a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 0 additions & 9 deletions examples/amaranth/ethernet_io_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ def elaborate(self, platform):
# 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)

Expand All @@ -97,8 +90,6 @@ def elaborate(self, platform):
("io", "rmii_mdio", eth_pins.mdio.io),
]

platform.add_file("liteeth.v", self.manta.interface.generate_liteeth_core())

return m

def test(self):
Expand Down
6 changes: 6 additions & 0 deletions src/manta/ethernet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ def elaborate(self, platform):
("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()

Expand Down

0 comments on commit 825232a

Please sign in to comment.