diff --git a/liteeth/mac/sram.py b/liteeth/mac/sram.py index 06f0bcf..295c6fe 100644 --- a/liteeth/mac/sram.py +++ b/liteeth/mac/sram.py @@ -91,7 +91,7 @@ class LiteEthMACSRAMWriter(Module, AutoCSR): ) ).Else( NextValue(errors, errors + 1), - NextState("DISCARD-REMAINING") + NextState("DISCARD-ALL") ) ) ) @@ -104,6 +104,16 @@ class LiteEthMACSRAMWriter(Module, AutoCSR): ) ) ) + fsm.act("DISCARD-ALL", + If(sink.valid & sink.last, + If((sink.last_be) != 0, + NextState("DISCARD") + ).Else( + NextValue(length, 0), + NextState("WRITE") + ) + ) + ) fsm.act("DISCARD", NextValue(length, 0), NextState("WRITE")