forked from M-Labs/artiq-zynq
pipeline GW: add back crc for handling stream pak
This commit is contained in:
parent
cbd1a20e07
commit
6511bfc637
|
@ -1,6 +1,7 @@
|
|||
from migen import *
|
||||
from misoc.interconnect.csr import *
|
||||
from misoc.interconnect import stream
|
||||
from misoc.cores.liteeth_mini.mac.crc import LiteEthMACCRCEngine, LiteEthMACCRCChecker
|
||||
|
||||
char_width = 8
|
||||
char_layout = [("data", char_width), ("k", char_width//8)]
|
||||
|
@ -448,3 +449,34 @@ class CXP_Trig_Ack_Checker(Module, AutoCSR):
|
|||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ResetInserter()
|
||||
@CEInserter()
|
||||
class CXPCRC32(Module):
|
||||
# Section 9.2.2.2 (CXP-001-2021)
|
||||
width = 32
|
||||
polynom = 0x04C11DB7
|
||||
seed = 2**width-1
|
||||
check = 0x00000000
|
||||
def __init__(self, data_width):
|
||||
self.data = Signal(data_width)
|
||||
self.value = Signal(self.width)
|
||||
self.error = Signal()
|
||||
|
||||
# # #
|
||||
|
||||
self.submodules.engine = LiteEthMACCRCEngine(data_width, self.width, self.polynom)
|
||||
reg = Signal(self.width, reset=self.seed)
|
||||
self.sync += reg.eq(self.engine.next)
|
||||
self.comb += [
|
||||
self.engine.data.eq(self.data),
|
||||
self.engine.last.eq(reg),
|
||||
|
||||
self.value.eq(reg[::-1]),
|
||||
self.error.eq(self.engine.next != self.check)
|
||||
]
|
||||
|
||||
# For verifying crc in stream data packet
|
||||
class CXPCRC32Checker(LiteEthMACCRCChecker):
|
||||
def __init__(self, layout):
|
||||
LiteEthMACCRCChecker.__init__(self, CXPCRC32, layout)
|
||||
|
|
Loading…
Reference in New Issue