forked from enjoy-digital/liteeth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* to prevent stalling the PHY when using etherbone with DW=64
- Loading branch information
1 parent
e849638
commit 09d59c0
Showing
5 changed files
with
79 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
# This file is part of LiteEth. | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
import math | ||
|
||
from liteeth.common import * | ||
|
||
# MAC Gap ------------------------------------------------------------------------------------------ | ||
|
||
class LiteEthAntiUnderflow(Module): | ||
def __init__(self, dw, depth=32): | ||
''' | ||
buffers a whole packet and releases it at once | ||
workaround for driving PHYs with wide datapaths which expect a | ||
continuous stream | ||
''' | ||
self.sink = sink = stream.Endpoint(eth_phy_description(dw)) | ||
self.source = source = stream.Endpoint(eth_phy_description(dw)) | ||
|
||
# # # | ||
|
||
self.submodules.fifo = fifo = stream.SyncFIFO( | ||
eth_phy_description(dw), | ||
depth, | ||
buffered=True | ||
) | ||
|
||
self.comb += [ | ||
sink.connect(fifo.sink), | ||
fifo.source.connect(source, omit=['valid', 'ready']) | ||
] | ||
|
||
self.submodules.fsm = fsm = FSM(reset_state="STORE") | ||
fsm.act("STORE", | ||
If(sink.valid & sink.last | (fifo.level >= fifo.depth - 1), | ||
NextState("FLUSH") | ||
) | ||
) | ||
fsm.act("FLUSH", | ||
fifo.source.connect(source, keep=['valid', 'ready']), | ||
If(fifo.source.valid & fifo.source.last, | ||
NextState("STORE") | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters