forked from M-Labs/artiq-zynq
cxp downconn: cleanup debug csr
This commit is contained in:
parent
7e6d4e186f
commit
679b430d74
|
@ -12,6 +12,7 @@ from operator import add
|
||||||
|
|
||||||
class CXP_DownConn(Module, AutoCSR):
|
class CXP_DownConn(Module, AutoCSR):
|
||||||
def __init__(self, refclk, pads, sys_clk_freq, debug_sma, pmod_pads):
|
def __init__(self, refclk, pads, sys_clk_freq, debug_sma, pmod_pads):
|
||||||
|
nconn = len(pads)
|
||||||
self.rx_start_init = CSRStorage()
|
self.rx_start_init = CSRStorage()
|
||||||
self.rx_restart = CSR()
|
self.rx_restart = CSR()
|
||||||
|
|
||||||
|
@ -19,9 +20,7 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
self.tx_restart = CSR()
|
self.tx_restart = CSR()
|
||||||
self.txenable = CSRStorage()
|
self.txenable = CSRStorage()
|
||||||
|
|
||||||
self.txinit_phaligndone = CSRStatus()
|
self.rx_ready = CSRStatus(nconn)
|
||||||
self.rxinit_phaligndone = CSRStatus()
|
|
||||||
self.rx_ready = CSRStatus()
|
|
||||||
|
|
||||||
self.qpll_reset = CSR()
|
self.qpll_reset = CSR()
|
||||||
self.qpll_locked = CSRStatus()
|
self.qpll_locked = CSRStatus()
|
||||||
|
@ -36,7 +35,6 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
nconn = len(pads)
|
|
||||||
|
|
||||||
for i in range(nconn):
|
for i in range(nconn):
|
||||||
if i != 0:
|
if i != 0:
|
||||||
|
@ -65,9 +63,6 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
|
|
||||||
for gtx in self.gtxs:
|
for gtx in self.gtxs:
|
||||||
self.sync += [
|
self.sync += [
|
||||||
self.txinit_phaligndone.status.eq(gtx.tx_init.Xxphaligndone),
|
|
||||||
self.rxinit_phaligndone.status.eq(gtx.rx_init.Xxphaligndone),
|
|
||||||
self.rx_ready.status.eq(gtx.rx_ready),
|
|
||||||
|
|
||||||
gtx.txenable.eq(self.txenable.storage[0]),
|
gtx.txenable.eq(self.txenable.storage[0]),
|
||||||
gtx.tx_restart.eq(self.tx_restart.re),
|
gtx.tx_restart.eq(self.tx_restart.re),
|
||||||
|
@ -78,7 +73,6 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
|
|
||||||
self.comb += gtx.dclk.eq(ClockSignal("sys"))
|
self.comb += gtx.dclk.eq(ClockSignal("sys"))
|
||||||
self.sync += [
|
self.sync += [
|
||||||
|
|
||||||
gtx.den.eq(0),
|
gtx.den.eq(0),
|
||||||
gtx.dwen.eq(0),
|
gtx.dwen.eq(0),
|
||||||
If(self.gtx_dread.re,
|
If(self.gtx_dread.re,
|
||||||
|
@ -90,6 +84,12 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
gtx.daddr.eq(self.gtx_daddr.storage),
|
gtx.daddr.eq(self.gtx_daddr.storage),
|
||||||
gtx.din.eq(self.gtx_din.storage),
|
gtx.din.eq(self.gtx_din.storage),
|
||||||
),
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
# TODO: deal with 4 GTX instance of outpus
|
||||||
|
for n, gtx in enumerate(self.gtxs):
|
||||||
|
self.sync += [
|
||||||
|
self.rx_ready.status[n].eq(gtx.rx_ready),
|
||||||
If(gtx.dready,
|
If(gtx.dready,
|
||||||
self.gtx_dready.w.eq(1),
|
self.gtx_dready.w.eq(1),
|
||||||
self.gtx_dout.status.eq(gtx.dout),
|
self.gtx_dout.status.eq(gtx.dout),
|
||||||
|
@ -115,6 +115,9 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
self.pll_dout = CSRStatus(16)
|
self.pll_dout = CSRStatus(16)
|
||||||
self.pll_dready = CSRStatus()
|
self.pll_dready = CSRStatus()
|
||||||
|
|
||||||
|
self.txinit_phaligndone = CSRStatus()
|
||||||
|
self.rxinit_phaligndone = CSRStatus()
|
||||||
|
|
||||||
for n, gtx in enumerate(self.gtxs):
|
for n, gtx in enumerate(self.gtxs):
|
||||||
self.comb += [
|
self.comb += [
|
||||||
gtx.txpll_reset.eq(self.txpll_reset.storage),
|
gtx.txpll_reset.eq(self.txpll_reset.storage),
|
||||||
|
@ -124,7 +127,8 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
gtx.pll_din.eq(self.pll_din.storage),
|
gtx.pll_din.eq(self.pll_din.storage),
|
||||||
gtx.pll_dwen.eq(self.pll_dwen.storage),
|
gtx.pll_dwen.eq(self.pll_dwen.storage),
|
||||||
|
|
||||||
self.txpll_locked.status.eq(gtx.txpll_locked),
|
self.txinit_phaligndone.status.eq(gtx.tx_init.Xxphaligndone),
|
||||||
|
self.rxinit_phaligndone.status.eq(gtx.rx_init.Xxphaligndone), self.txpll_locked.status.eq(gtx.txpll_locked),
|
||||||
self.pll_dout.status.eq(gtx.pll_dout),
|
self.pll_dout.status.eq(gtx.pll_dout),
|
||||||
self.pll_dready.status.eq(gtx.pll_dready),
|
self.pll_dready.status.eq(gtx.pll_dready),
|
||||||
]
|
]
|
||||||
|
@ -169,37 +173,28 @@ class CXP_DownConn(Module, AutoCSR):
|
||||||
gtx.encoder.k[3].eq(0),
|
gtx.encoder.k[3].eq(0),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.rxdata_0 = CSRStatus(10)
|
for i in range(4):
|
||||||
self.rxdata_1 = CSRStatus(10)
|
gtx.decoders[i].input.attr.add("no_retiming")
|
||||||
self.rxdata_2 = CSRStatus(10)
|
gtx.decoders[i].d.attr.add("no_retiming")
|
||||||
self.rxdata_3 = CSRStatus(10)
|
gtx.decoders[i].k.attr.add("no_retiming")
|
||||||
self.decoded_data_0 = CSRStatus(8)
|
|
||||||
self.decoded_data_1 = CSRStatus(8)
|
|
||||||
self.decoded_data_2 = CSRStatus(8)
|
|
||||||
self.decoded_data_3 = CSRStatus(8)
|
|
||||||
self.decoded_k_0 = CSRStatus()
|
|
||||||
self.decoded_k_1 = CSRStatus()
|
|
||||||
self.decoded_k_2 = CSRStatus()
|
|
||||||
self.decoded_k_3 = CSRStatus()
|
|
||||||
|
|
||||||
self.sync.cxp_gtx_rx += [
|
rxdata_name = "rxdata_" + str(i)
|
||||||
self.rxdata_0.status.eq(gtx.decoders[0].input),
|
rxdata_csr = CSRStatus(10, name=rxdata_name)
|
||||||
self.decoded_data_0.status.eq(gtx.decoders[0].d),
|
setattr(self, rxdata_name, rxdata_csr)
|
||||||
self.decoded_k_0.status.eq(gtx.decoders[0].k),
|
|
||||||
|
|
||||||
self.rxdata_1.status.eq(gtx.decoders[1].input),
|
decoded_name = "decoded_data_" + str(i)
|
||||||
self.decoded_data_1.status.eq(gtx.decoders[1].d),
|
decoded_csr = CSRStatus(8, name=decoded_name)
|
||||||
self.decoded_k_1.status.eq(gtx.decoders[1].k),
|
setattr(self, decoded_name, decoded_csr)
|
||||||
|
|
||||||
self.rxdata_2.status.eq(gtx.decoders[2].input),
|
k_name = "rxdata_" + str(i)
|
||||||
self.decoded_data_2.status.eq(gtx.decoders[2].d),
|
k_csr = CSRStatus(1, name=k_name)
|
||||||
self.decoded_k_2.status.eq(gtx.decoders[2].k),
|
setattr(self, k_name, k_csr)
|
||||||
|
|
||||||
self.rxdata_3.status.eq(gtx.decoders[3].input),
|
|
||||||
self.decoded_data_3.status.eq(gtx.decoders[3].d),
|
|
||||||
self.decoded_k_3.status.eq(gtx.decoders[3].k),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
self.sync.cxp_gtx_rx += [
|
||||||
|
rxdata_csr.status.eq(gtx.decoders[i].input),
|
||||||
|
decoded_csr.status.eq(gtx.decoders[i].d),
|
||||||
|
k_csr.status.eq(gtx.decoders[i].k),
|
||||||
|
]
|
||||||
|
|
||||||
class QPLL(Module, AutoCSR):
|
class QPLL(Module, AutoCSR):
|
||||||
def __init__(self, refclk, sys_clk_freq):
|
def __init__(self, refclk, sys_clk_freq):
|
||||||
|
@ -392,8 +387,6 @@ class Comma_Checker(Module):
|
||||||
|
|
||||||
rxfsm.act("WAIT_COMMA",
|
rxfsm.act("WAIT_COMMA",
|
||||||
If(self.comma_det,
|
If(self.comma_det,
|
||||||
# # start aligner early, so word aligned will fall
|
|
||||||
# self.aligner_en_rxclk.eq(1),
|
|
||||||
NextState("ALIGNING"),
|
NextState("ALIGNING"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue