liteeth/phy/rmii: Replace MuliReg with stream.Delay.

This commit is contained in:
Florent Kermarrec 2024-09-23 11:05:23 +02:00
parent af746ec973
commit 1c89387d09
1 changed files with 6 additions and 11 deletions

View File

@ -49,13 +49,8 @@ class LiteEthPHYRMIIRX(LiteXModule):
converter = ResetInserter()(converter)
self.converter = converter
converter_sink_valid = Signal()
converter_sink_data = Signal(2)
self.specials += [
MultiReg(converter_sink_valid, converter.sink.valid, n=2),
MultiReg(converter_sink_data, converter.sink.data, n=2)
]
self.delay = delay = stream.Delay(layout=[("data", 8)], n=2)
self.comb += delay.source.connect(converter.sink)
crs_dv = Signal()
crs_dv_d = Signal()
@ -69,16 +64,16 @@ class LiteEthPHYRMIIRX(LiteXModule):
self.fsm = fsm = FSM(reset_state="IDLE")
fsm.act("IDLE",
If(crs_dv & (rx_data != 0b00),
converter_sink_valid.eq(1),
converter_sink_data.eq(rx_data),
delay.sink.valid.eq(1),
delay.sink.data.eq(rx_data),
NextState("RECEIVE")
).Else(
converter.reset.eq(1)
)
)
fsm.act("RECEIVE",
converter_sink_valid.eq(1),
converter_sink_data.eq(rx_data),
delay.sink.valid.eq(1),
delay.sink.data.eq(rx_data),
# End of frame when 2 consecutives 0 on crs_dv.
If(~(crs_dv | crs_dv_d),
converter.sink.last.eq(1),