mirror of
https://github.com/enjoy-digital/usb3_pipe.git
synced 2025-01-04 10:18:41 +08:00
kc705: add Scrambler and enable it when in polling.idle (experiment)
This commit is contained in:
parent
e9ef2876f5
commit
6c6717daef
11
kc705.py
11
kc705.py
@ -23,6 +23,7 @@ from litescope import LiteScopeAnalyzer
|
||||
|
||||
from usb3_pipe.serdes import K7USB3SerDes
|
||||
from usb3_pipe.phy import USB3PHY
|
||||
from usb3_pipe.scrambling import Scrambler
|
||||
|
||||
# USB3 IOs -----------------------------------------------------------------------------------------
|
||||
|
||||
@ -133,6 +134,16 @@ class USB3SoC(SoCMini):
|
||||
)
|
||||
]
|
||||
|
||||
# Scrambler --------------------------------------------------------------------------------
|
||||
self.submodules.scrambler = scrambler = Scrambler()
|
||||
self.comb += [
|
||||
If(usb3_phy.ready,
|
||||
scrambler.sink.valid.eq(1),
|
||||
scrambler.sink.data.eq(0),
|
||||
scrambler.source.connect(usb3_serdes.sink)
|
||||
)
|
||||
]
|
||||
|
||||
# Leds -------------------------------------------------------------------------------------
|
||||
self.comb += platform.request("user_led", 0).eq(usb3_serdes.ready)
|
||||
self.comb += platform.request("user_led", 1).eq(usb3_phy.ready)
|
||||
|
@ -176,11 +176,14 @@ class PollingFSM(FSM):
|
||||
|
||||
# # #
|
||||
|
||||
rx_ts2 = Signal()
|
||||
|
||||
# FSM --------------------------------------------------------------------------------------
|
||||
FSM.__init__(self, reset_state="LFPS")
|
||||
|
||||
# LFPS State -------------------------------------------------------------------------------
|
||||
self.act("LFPS",
|
||||
NextValue(rx_ts2, 0),
|
||||
serdes.rx_align.eq(1),
|
||||
lfps_unit.tx_polling.eq(1),
|
||||
If(lfps_unit.rx_polling,
|
||||
@ -208,7 +211,7 @@ class PollingFSM(FSM):
|
||||
self.act("ACTIVE",
|
||||
ts_unit.rx_enable.eq(1),
|
||||
If(ts_unit.rx_ts1 | ts_unit.rx_ts2,
|
||||
NextState("CONFIGURATION"), # 8 consecutiive TS1 or TS2 received.
|
||||
NextState("CONFIGURATION_0"), # 8 consecutiive TS1 or TS2 received.
|
||||
),
|
||||
#self.exit_to_ss_disabled.eq(1), # Timeout (Dev) or directed (DS).
|
||||
#self.exit_to_rx_detect.eq(1), # Timeout (DS).
|
||||
@ -216,11 +219,15 @@ class PollingFSM(FSM):
|
||||
)
|
||||
|
||||
# Configuration State ----------------------------------------------------------------------
|
||||
self.act("CONFIGURATION",
|
||||
|
||||
self.act("CONFIGURATION_0",
|
||||
ts_unit.rx_enable.eq(1),
|
||||
ts_unit.tx_enable.eq(1),
|
||||
ts_unit.tx_ts2.eq(1),
|
||||
If(ts_unit.rx_ts2,
|
||||
NextValue(rx_ts2, rx_ts2 | ts_unit.rx_ts2),
|
||||
If(rx_ts2 & ts_unit.ts2_generator.done,
|
||||
ts_unit.tx_enable.eq(0),
|
||||
ts_unit.tx_ts2.eq(0),
|
||||
NextState("IDLE"), # TS2 handshake.
|
||||
),
|
||||
#self.exit_to_ss_disabled.eq(1), # Timeout (Dev) or directed (DS).
|
||||
|
@ -205,8 +205,7 @@ class TSUnit(Module):
|
||||
]
|
||||
|
||||
# Ordered Set Generators -------------------------------------------------------------------
|
||||
ts2_generator = TSGenerator(ordered_set=TS2, n_ordered_sets=8)
|
||||
self.submodules += ts2_generator
|
||||
self.submodules.ts2_generator = ts2_generator = TSGenerator(ordered_set=TS2, n_ordered_sets=8)
|
||||
self.comb += [
|
||||
If(self.tx_enable,
|
||||
ts2_generator.send.eq(self.tx_ts2),
|
||||
|
Loading…
x
Reference in New Issue
Block a user