litex/liteeth/mac/core/last_be.py

39 lines
946 B
Python
Raw Normal View History

2015-01-28 03:14:01 -05:00
from liteeth.common import *
from liteeth.generic import *
2015-01-27 17:59:06 -05:00
2015-01-28 03:14:01 -05:00
class LiteEthMACTXLastBE(Module):
def __init__(self, dw):
self.sink = sink = Sink(eth_phy_description(dw))
self.source = source = Source(eth_phy_description(dw))
2015-01-27 17:59:06 -05:00
###
ongoing = Signal()
self.sync += \
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 += [
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):
def __init__(self, dw):
self.sink = sink = Sink(eth_phy_description(dw))
self.source = source = Source(eth_phy_description(dw))
2015-01-27 17:59:06 -05:00
###
self.comb += [
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
]