Skip to content

Commit

Permalink
liteeth/mac/core: Allow PHY to enforce with_preamble_crc/with_padding…
Browse files Browse the repository at this point in the history
… parameters.

Avoid exposing these parameters up to add_ethernet since appropriate behaviour is generally
directly related to the type of PHY (ex LiteEthPHYModel or custom/specialized PHY).
  • Loading branch information
enjoy-digital committed Sep 23, 2024
1 parent 1d19de0 commit 2b0156e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions liteeth/mac/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from liteeth.common import *
from liteeth.mac import gap, preamble, crc, padding, last_be
from liteeth.phy.model import LiteEthPHYModel

from migen.genlib.cdc import PulseSynchronizer

Expand Down Expand Up @@ -46,8 +45,12 @@ def __init__(self, phy, dw,
cd_tx = "eth_tx"
cd_rx = "eth_rx"
datapath_dw = phy_dw
if isinstance(phy, LiteEthPHYModel):
with_preamble_crc = False # Disable Preamble/CRC with PHY Model for direct connection to the Ethernet tap.

# If the PHY specifies preamble, CRC, or padding behavior, use it.
if hasattr(phy, "with_preamble_crc"):
with_preamble_crc = phy.with_preamble_crc
if hasattr(phy, "with_padding"):
with_padding = phy.with_padding

# CSRs.
if with_preamble_crc:
Expand Down
3 changes: 2 additions & 1 deletion liteeth/phy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def __init__(self):
# LiteEth PHY Model --------------------------------------------------------------------------------

class LiteEthPHYModel(LiteXModule):
dw = 8
dw = 8
with_preamble_crc = False # Disable Preamble/CRC with for direct connection to the Ethernet tap.
def __init__(self, pads):
self.crg = LiteEthPHYModelCRG()
self.sink = sink = stream.Endpoint(eth_phy_description(8))
Expand Down

0 comments on commit 2b0156e

Please sign in to comment.