Skip to content

Commit

Permalink
clean up JSYNC initiated restart
Browse files Browse the repository at this point in the history
  • Loading branch information
sbourdeauducq committed Jan 20, 2020
1 parent ed7dc91 commit 2d135e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
28 changes: 1 addition & 27 deletions jesd204b/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def __init__(self, phys, jesd_settings, converter_data_width):
self.jref = Signal()
self.phy_done = Signal()
self.ready = Signal()
self.restart = Signal()

self.prbs_config = Signal(4)
self.stpl_enable = Signal()
Expand All @@ -33,7 +32,6 @@ def __init__(self, phys, jesd_settings, converter_data_width):
# restart when disabled or on re-synchronization request
self.jsync_sys = Signal()
self.specials += MultiReg(self.jsync, self.jsync_sys)
self.comb += self.restart.eq(~self.enable | (self.ready & ~self.jsync_sys))
self.jsync_jesd = Signal()
self.specials += MultiReg(self.jsync, self.jsync_jesd, "jesd")

Expand Down Expand Up @@ -88,9 +86,7 @@ def __init__(self, phys, jesd_settings, converter_data_width):
]

# connect control
self.comb += phy.transmitter.init.restart.eq(
self.restart & (self.prbs_config == 0))

self.comb += phy.transmitter.init.restart.eq(~self.enable)
self.specials += MultiReg(self.prbs_config,
phy.transmitter.prbs_config,
phy_cd)
Expand Down Expand Up @@ -133,9 +129,6 @@ def __init__(self, core):

self.jsync = CSRStatus()

self.restart_count_clear = CSR()
self.restart_count = CSRStatus(8)

# # #

# core control/status
Expand All @@ -149,22 +142,3 @@ def __init__(self, core):
self.phy_done.status.eq(core.phy_done),
self.ready.status.eq(core.ready)
]

# restart monitoring

# restart is a slow signal so we simply pass it to sys_clk and
# count rising edges
restart = Signal()
restart_d = Signal()
restart_count = Signal(8)
self.specials += MultiReg(core.restart, restart)
self.sync += \
If(self.restart_count_clear.re,
restart_count.eq(0)
).Elif(restart & ~restart_d,
# don't overflow when max is reached
If(restart_count != (2**8-1),
restart_count.eq(restart_count + 1)
)
)
self.comb += self.restart_count.status.eq(restart_count)
1 change: 1 addition & 0 deletions jesd204b/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,5 @@ def __init__(self, data_width, jesd_settings, n=0):
ilas.reset.eq(1),
self.ready.eq(1),
source.eq(inserter.source),
If(~jsync, NextState("CGS"))
)

0 comments on commit 2d135e3

Please sign in to comment.