mirror of
https://github.com/enjoy-digital/usb3_pipe.git
synced 2025-01-04 10:18:41 +08:00
scrambling: add Descrambler (Scrambler + Auto-Synchronization)
This commit is contained in:
parent
32030ed5fc
commit
7fd9120181
@ -97,3 +97,30 @@ class Scrambler(Module):
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
# Descrambler (Scrambler + Auto-Synchronization) ---------------------------------------------------
|
||||
|
||||
class Descrambler(Module):
|
||||
def __init__(self):
|
||||
self.enable = Signal(reset=1)
|
||||
self.sink = sink = stream.Endpoint([("data", 32), ("ctrl", 4)])
|
||||
self.source = source = stream.Endpoint([("data", 32), ("ctrl", 4)])
|
||||
|
||||
# # #
|
||||
|
||||
scrambler = Scrambler()
|
||||
self.submodules += scrambler
|
||||
|
||||
sync = Signal()
|
||||
synced = Signal()
|
||||
self.comb += sync.eq(sink.valid & (sink.data == scrambler.source.data))
|
||||
self.sync += If(sync, synced.eq(1))
|
||||
self.comb += [
|
||||
If(~sync & ~synced,
|
||||
sink.ready.eq(1)
|
||||
).Else(
|
||||
sink.connect(scrambler.sink)
|
||||
),
|
||||
scrambler.source.connect(source)
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user