diff --git a/liteeth/mac/preamble.py b/liteeth/mac/preamble.py index 54f5a95..bbc7fb2 100644 --- a/liteeth/mac/preamble.py +++ b/liteeth/mac/preamble.py @@ -81,7 +81,7 @@ class LiteEthMACPreambleChecker(Module): Pulses every time a preamble error is detected. """ def __init__(self, dw): - assert dw == 8 + assert dw in [8, 16, 32, 64] self.sink = sink = stream.Endpoint(eth_phy_description(dw)) self.source = source = stream.Endpoint(eth_phy_description(dw)) @@ -89,10 +89,12 @@ class LiteEthMACPreambleChecker(Module): # # # + preamble = Signal(64, reset=eth_preamble) self.submodules.fsm = fsm = FSM(reset_state="PREAMBLE") fsm.act("PREAMBLE", sink.ready.eq(1), - If(sink.valid & ~sink.last & (sink.data == (eth_preamble >> 56)), + # Match to end of preamble + If(sink.valid & ~sink.last & (sink.data == preamble[-dw:]), NextState("COPY") ), If(sink.valid & sink.last, self.error.eq(1))