liteeth/phy/rmii: Move crs first/last detection outside of FSM.

This commit is contained in:
Florent Kermarrec 2024-09-23 11:30:57 +02:00
parent 1c89387d09
commit 5538c87115
1 changed files with 7 additions and 5 deletions

View File

@ -61,9 +61,12 @@ class LiteEthPHYRMIIRX(LiteXModule):
rx_data.eq(pads.rx_data)
]
crs_first = (crs_dv & (rx_data != 0b00))
crs_last = (~crs_dv & ~crs_dv_d) # End of frame when 2 consecutives 0 on crs_dv.
self.fsm = fsm = FSM(reset_state="IDLE")
fsm.act("IDLE",
If(crs_dv & (rx_data != 0b00),
If(crs_first,
delay.sink.valid.eq(1),
delay.sink.data.eq(rx_data),
NextState("RECEIVE")
@ -74,8 +77,7 @@ class LiteEthPHYRMIIRX(LiteXModule):
fsm.act("RECEIVE",
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),
If(crs_last,
converter.sink.last.eq(1),
NextState("IDLE")
)