Skip to content

Commit

Permalink
serwb/phy: Avoid too restrictive test in CHECK_SAMPLE_WINDOW to allow…
Browse files Browse the repository at this point in the history
… phy behave correctly with/without delays enabled.
  • Loading branch information
enjoy-digital committed Nov 14, 2023
1 parent 2636c97 commit ab21c44
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions liteiclink/serwb/phy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

@ResetInserter()
class _SerdesMasterInit(LiteXModule):
def __init__(self, serdes, taps, timeout, with_delay=True):
def __init__(self, serdes, taps, timeout):
self.ready = Signal()
self.error = Signal()

Expand Down Expand Up @@ -94,15 +94,12 @@ def __init__(self, serdes, taps, timeout, with_delay=True):
timer.wait.eq(0),
NextValue(delay_min, delay),
NextValue(delay_min_found, 1),
If(not with_delay,
NextState("READY")
)
)
).Else(
NextState("INC-DELAY-SHIFT")
),
).Else(
If(~serdes.rx.comma,
If(~serdes.rx.comma | (delay == (taps - 1)),
NextValue(delay_max, delay),
NextValue(delay_max_found, 1),
NextState("CHECK-SAMPLING-WINDOW")
Expand Down Expand Up @@ -134,9 +131,7 @@ def __init__(self, serdes, taps, timeout, with_delay=True):
serdes.tx.comma.eq(1)
)
fsm.act("CHECK-SAMPLING-WINDOW",
If((delay_min == 0) |
(delay_max == (taps - 1)) |
((delay_max - delay_min) < taps//16),
If((delay_max - delay_min) < taps//16,
NextValue(delay_min_found, 0),
NextValue(delay_max_found, 0),
NextState("WAIT-STABLE")
Expand Down Expand Up @@ -167,7 +162,7 @@ def __init__(self, serdes, taps, timeout, with_delay=True):

@ResetInserter()
class _SerdesSlaveInit(LiteXModule):
def __init__(self, serdes, taps, timeout, with_delay=True):
def __init__(self, serdes, taps, timeout):
self.ready = Signal()
self.error = Signal()

Expand Down Expand Up @@ -218,15 +213,12 @@ def __init__(self, serdes, taps, timeout, with_delay=True):
timer.wait.eq(0),
NextValue(delay_min, delay),
NextValue(delay_min_found, 1),
If(not with_delay,
NextState("SEND-PATTERN")
)
)
).Else(
NextState("INC-DELAY-SHIFT")
),
).Else(
If(~serdes.rx.comma,
If(~serdes.rx.comma | (delay == (taps - 1)),
NextValue(delay_max, delay),
NextValue(delay_max_found, 1),
NextState("CHECK-SAMPLING-WINDOW")
Expand Down Expand Up @@ -258,9 +250,7 @@ def __init__(self, serdes, taps, timeout, with_delay=True):
serdes.tx.idle.eq(1)
)
fsm.act("CHECK-SAMPLING-WINDOW",
If((delay_min == 0) |
(delay_max == (taps - 1)) |
((delay_max - delay_min) < taps//16),
If((delay_max - delay_min) < taps//16,
NextValue(delay_min_found, 0),
NextValue(delay_max_found, 0),
NextState("WAIT-STABLE")
Expand Down

0 comments on commit ab21c44

Please sign in to comment.