mac/preamble: Add 32/64 bit support in checker

Only tested for 32/8 bit
This commit is contained in:
David Sawatzke 2021-08-08 17:43:52 +02:00
parent 811722cbaa
commit 8c72362385
1 changed files with 4 additions and 2 deletions

View File

@ -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))