mac/preamble: Fix inserter to work for 32/64 bit

The signal won't get wider in the 8 bit case, since max moves from 6 to
7
Untested for 64 bit
This commit is contained in:
David Sawatzke 2021-08-08 18:00:32 +02:00
parent 8c72362385
commit 688011f936

View file

@ -25,13 +25,16 @@ class LiteEthMACPreambleInserter(Module):
Preamble, SFD, and packet octets.
"""
def __init__(self, dw):
assert dw in [8, 16, 32, 64]
self.sink = stream.Endpoint(eth_phy_description(dw))
self.source = stream.Endpoint(eth_phy_description(dw))
# # #
preamble = Signal(64, reset=eth_preamble)
count = Signal(max=(64//dw)-1, reset_less=True)
# For 64 bits, `count` doesn't need to change. But migen won't create a
# signal with a width of 0 bits, so add an unused bit for 64 bit path
count = Signal(max=(64//dw) if dw != 64 else 2, reset_less=True)
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
fsm.act("IDLE",
self.sink.ready.eq(1),