From 8c72362385c8464fff70511a0da4a3114e65bf4a Mon Sep 17 00:00:00 2001 From: David Sawatzke Date: Sun, 8 Aug 2021 17:43:52 +0200 Subject: [PATCH] mac/preamble: Add 32/64 bit support in checker Only tested for 32/8 bit --- liteeth/mac/preamble.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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))