mac/sram: Move LastBEDecoder/LastBEEncoder.
This commit is contained in:
parent
717885eb0a
commit
692df29981
|
@ -14,7 +14,7 @@ from liteeth.common import *
|
||||||
from litex.soc.interconnect.csr import *
|
from litex.soc.interconnect.csr import *
|
||||||
from litex.soc.interconnect.csr_eventmanager import *
|
from litex.soc.interconnect.csr_eventmanager import *
|
||||||
|
|
||||||
# MAC SRAM Writer ----------------------------------------------------------------------------------
|
# Helpers ------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class LastBEDecoder(Module):
|
class LastBEDecoder(Module):
|
||||||
def __init__(self, dw, last_be):
|
def __init__(self, dw, last_be):
|
||||||
|
@ -35,6 +35,19 @@ class LastBEDecoder(Module):
|
||||||
|
|
||||||
self.comb += Case(last_be, cases)
|
self.comb += Case(last_be, cases)
|
||||||
|
|
||||||
|
class LastBEEncoder(Module):
|
||||||
|
def __init__(self, dw, length_lsb):
|
||||||
|
assert dw % 8 == 0, "dw must be evenly divisible by 8!"
|
||||||
|
bytes = dw // 8
|
||||||
|
|
||||||
|
self.encoded = Signal(bytes)
|
||||||
|
|
||||||
|
self.comb += Case(length_lsb, {
|
||||||
|
b: self.encoded.eq(1 << ((b - 1) % bytes)) for b in range(0, bytes)
|
||||||
|
})
|
||||||
|
|
||||||
|
# MAC SRAM Writer ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
class LiteEthMACSRAMWriter(Module, AutoCSR):
|
class LiteEthMACSRAMWriter(Module, AutoCSR):
|
||||||
def __init__(self, dw, depth, nslots=2, endianness="big", timestamp=None):
|
def __init__(self, dw, depth, nslots=2, endianness="big", timestamp=None):
|
||||||
assert endianness in [
|
assert endianness in [
|
||||||
|
@ -174,17 +187,6 @@ class LiteEthMACSRAMWriter(Module, AutoCSR):
|
||||||
|
|
||||||
# MAC SRAM Reader ----------------------------------------------------------------------------------
|
# MAC SRAM Reader ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
class LastBEEncoder(Module):
|
|
||||||
def __init__(self, dw, length_lsb):
|
|
||||||
assert dw % 8 == 0, "dw must be evenly divisible by 8!"
|
|
||||||
bytes = dw // 8
|
|
||||||
|
|
||||||
self.encoded = Signal(bytes)
|
|
||||||
|
|
||||||
self.comb += Case(length_lsb, {
|
|
||||||
b: self.encoded.eq(1 << ((b - 1) % bytes)) for b in range(0, bytes)
|
|
||||||
})
|
|
||||||
|
|
||||||
class LiteEthMACSRAMReader(Module, AutoCSR):
|
class LiteEthMACSRAMReader(Module, AutoCSR):
|
||||||
def __init__(self, dw, depth, nslots=2, endianness="big", timestamp=None):
|
def __init__(self, dw, depth, nslots=2, endianness="big", timestamp=None):
|
||||||
self.source = source = stream.Endpoint(eth_phy_description(dw))
|
self.source = source = stream.Endpoint(eth_phy_description(dw))
|
||||||
|
|
Loading…
Reference in New Issue