Skip to content

Commit

Permalink
liteeth_mini: safe detection of oversized frames
Browse files Browse the repository at this point in the history
enjoy-digital committed Nov 8, 2016
1 parent 642c198 commit 72556a6
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions misoc/cores/liteeth_mini/mac/sram.py
Original file line number Diff line number Diff line change
@@ -73,20 +73,31 @@ def __init__(self, dw, depth, nslots=2):
)
)
fsm.act("WRITE",
counter_ce.eq(sink.stb),
ongoing.eq(counter < eth_mtu),
If(sink.stb & sink.eop,
If((sink.error & sink.last_be) != 0,
NextState("DISCARD")
If(sink.stb,
If(counter == eth_mtu,
NextState("DISCARD_REMAINING")
).Else(
NextState("TERMINATE")
counter_ce.eq(1),
ongoing.eq(1)
),
If(sink.eop,
If((sink.error & sink.last_be) != 0,
NextState("DISCARD")
).Else(
NextState("TERMINATE")
)
)
)
)
fsm.act("DISCARD",
counter_reset.eq(1),
NextState("IDLE")
)
fsm.act("DISCARD_REMAINING",
If(sink.stb & sink.eop,
NextState("TERMINATE")
)
)
self.comb += [
fifo.sink.slot.eq(slot),
fifo.sink.length.eq(counter)

1 comment on commit 72556a6

@sbourdeauducq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.