mirror of
https://github.com/enjoy-digital/usb3_pipe.git
synced 2025-01-04 10:18:41 +08:00
core/USB3PIPE: integrate scrambler/descrambler
This commit is contained in:
parent
d27639c927
commit
c39ed5f38c
4
sim.py
4
sim.py
@ -50,12 +50,16 @@ class USB3PIPESim(SoCMini):
|
||||
host_usb3_serdes = USB3SerDesModel()
|
||||
host_usb3_pipe = USB3PIPE(serdes=host_usb3_serdes, sys_clk_freq=sys_clk_freq)
|
||||
self.submodules += host_usb3_serdes, host_usb3_pipe
|
||||
self.comb += host_usb3_pipe.sink.valid.eq(1)
|
||||
self.comb += host_usb3_pipe.source.ready.eq(1)
|
||||
host_usb3_pipe.finalize()
|
||||
|
||||
# USB3 Device
|
||||
dev_usb3_serdes = USB3SerDesModel()
|
||||
dev_usb3_pipe = USB3PIPE(serdes=dev_usb3_serdes, sys_clk_freq=sys_clk_freq)
|
||||
self.submodules += dev_usb3_serdes, dev_usb3_pipe
|
||||
self.comb += dev_usb3_pipe.sink.valid.eq(1)
|
||||
self.comb += dev_usb3_pipe.source.ready.eq(1)
|
||||
dev_usb3_pipe.finalize()
|
||||
|
||||
# Connect Host <--> Device
|
||||
|
@ -8,6 +8,7 @@ from litex.soc.interconnect import stream
|
||||
from usb3_pipe.lfps import LFPSUnit
|
||||
from usb3_pipe.training import TSUnit
|
||||
from usb3_pipe.ltssm import LTSSM
|
||||
from usb3_pipe.scrambling import Scrambler, Descrambler
|
||||
|
||||
# USB3 PIPE ----------------------------------------------------------------------------------------
|
||||
|
||||
@ -40,3 +41,22 @@ class USB3PIPE(Module):
|
||||
self.comb += ltssm.reset.eq(~self.enable)
|
||||
self.submodules.ltssm = ltssm
|
||||
self.comb += self.ready.eq(ltssm.polling_fsm.idle)
|
||||
|
||||
# Scrambling -------------------------------------------------------------------------------
|
||||
scrambler = Scrambler()
|
||||
scrambler = ResetInserter()(scrambler)
|
||||
self.comb += scrambler.reset.eq(~self.enable)
|
||||
self.submodules.scrambler = scrambler
|
||||
self.comb += [
|
||||
self.sink.connect(scrambler.sink),
|
||||
If(self.ready, scrambler.source.connect(serdes.sink))
|
||||
]
|
||||
|
||||
descrambler = Descrambler()
|
||||
descrambler = ResetInserter()(descrambler)
|
||||
self.comb += descrambler.reset.eq(~self.enable)
|
||||
self.submodules.descrambler = descrambler
|
||||
self.comb += [
|
||||
If(self.ready, serdes.source.connect(descrambler.sink)),
|
||||
descrambler.source.connect(self.source),
|
||||
]
|
||||
|
@ -80,7 +80,6 @@ class ScramblerUnit(Module):
|
||||
|
||||
# Scrambler ----------------------------------------------------------------------------------------
|
||||
|
||||
@ResetInserter()
|
||||
class Scrambler(Module):
|
||||
def __init__(self):
|
||||
self.sink = sink = stream.Endpoint([("data", 32), ("ctrl", 4)])
|
||||
@ -98,7 +97,6 @@ class Scrambler(Module):
|
||||
|
||||
# Descrambler --------------------------------------------------------------------------------------
|
||||
|
||||
@ResetInserter()
|
||||
class Descrambler(Module):
|
||||
def __init__(self):
|
||||
self.sink = sink = stream.Endpoint([("data", 32), ("ctrl", 4)])
|
||||
|
Loading…
x
Reference in New Issue
Block a user