2015-01-28 03:14:01 -05:00
|
|
|
from liteeth.common import *
|
2015-02-11 19:19:36 -05:00
|
|
|
from liteeth.generic import *
|
2015-01-27 17:59:06 -05:00
|
|
|
|
2015-01-28 03:14:01 -05:00
|
|
|
class LiteEthMACTXLastBE(Module):
|
2015-01-28 05:45:19 -05:00
|
|
|
def __init__(self, dw):
|
2015-01-28 16:49:49 -05:00
|
|
|
self.sink = sink = Sink(eth_phy_description(dw))
|
2015-01-28 05:45:19 -05:00
|
|
|
self.source = source = Source(eth_phy_description(dw))
|
2015-01-27 17:59:06 -05:00
|
|
|
###
|
|
|
|
ongoing = Signal()
|
|
|
|
self.sync += \
|
2015-01-28 05:45:19 -05:00
|
|
|
If(sink.stb & sink.ack,
|
2015-01-27 17:59:06 -05:00
|
|
|
If(sink.sop,
|
|
|
|
ongoing.eq(1)
|
|
|
|
).Elif(sink.last_be,
|
|
|
|
ongoing.eq(0)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.comb += [
|
2015-01-28 05:45:19 -05:00
|
|
|
source.stb.eq(sink.stb & (sink.sop | ongoing)),
|
|
|
|
source.sop.eq(sink.sop),
|
|
|
|
source.eop.eq(sink.last_be),
|
|
|
|
source.data.eq(sink.data),
|
|
|
|
sink.ack.eq(source.ack)
|
2015-01-27 17:59:06 -05:00
|
|
|
]
|
|
|
|
|
2015-01-28 03:14:01 -05:00
|
|
|
class LiteEthMACRXLastBE(Module):
|
2015-01-28 05:45:19 -05:00
|
|
|
def __init__(self, dw):
|
|
|
|
self.sink = sink = Sink(eth_phy_description(dw))
|
2015-01-28 16:49:49 -05:00
|
|
|
self.source = source = Source(eth_phy_description(dw))
|
2015-01-27 17:59:06 -05:00
|
|
|
###
|
|
|
|
self.comb += [
|
2015-01-28 05:45:19 -05:00
|
|
|
source.stb.eq(sink.stb),
|
|
|
|
source.sop.eq(sink.sop),
|
|
|
|
source.eop.eq(sink.eop),
|
|
|
|
source.data.eq(sink.data),
|
|
|
|
source.last_be.eq(sink.eop),
|
|
|
|
sink.ack.eq(source.ack)
|
2015-01-27 17:59:06 -05:00
|
|
|
]
|