drtio/transceiver/gth: fix multilane

This commit is contained in:
Florent Kermarrec 2018-02-28 14:15:40 +01:00
parent 5046d6a529
commit 2896dc619b
2 changed files with 5 additions and 4 deletions

View File

@ -44,7 +44,7 @@ class GTHSingle(Module):
# # # # # #
# TX generates RTIO clock, init must be in system domain # TX generates RTIO clock, init must be in system domain
self.submodules.tx_init = tx_init = GTHInit(sys_clk_freq, False) self.submodules.tx_init = tx_init = GTHInit(sys_clk_freq, False, mode)
# RX receives restart commands from RTIO domain # RX receives restart commands from RTIO domain
rx_init = ClockDomainsRenamer("rtio_tx")(GTHInit(rtio_clk_freq, True)) rx_init = ClockDomainsRenamer("rtio_tx")(GTHInit(rtio_clk_freq, True))
self.submodules += rx_init self.submodules += rx_init
@ -298,10 +298,10 @@ class GTH(Module, TransceiverInterface):
else: else:
mode = "master" if i == master else "slave" mode = "master" if i == master else "slave"
gth = GTHSingle(refclk, data_pads[i], sys_clk_freq, rtio_clk_freq, dw, mode) gth = GTHSingle(refclk, data_pads[i], sys_clk_freq, rtio_clk_freq, dw, mode)
if mode == "slave": if mode == "master":
self.comb += gth.cd_rtio_tx.clk.eq(rtio_tx_clk)
else:
self.comb += rtio_tx_clk.eq(gth.cd_rtio_tx.clk) self.comb += rtio_tx_clk.eq(gth.cd_rtio_tx.clk)
elif mode == "slave":
self.comb += gth.cd_rtio_tx.clk.eq(rtio_tx_clk)
self.gths.append(gth) self.gths.append(gth)
setattr(self.submodules, "gth"+str(i), gth) setattr(self.submodules, "gth"+str(i), gth)
channel_interface = ChannelInterface(gth.encoder, gth.decoders) channel_interface = ChannelInterface(gth.encoder, gth.decoders)

View File

@ -130,6 +130,7 @@ class GTHInit(Module):
# Wait for delay alignment # Wait for delay alignment
startup_fsm.act("WAIT_ALIGN", startup_fsm.act("WAIT_ALIGN",
Xxuserrdy.eq(1), Xxuserrdy.eq(1),
self.ready_for_align.eq(1),
If(Xxdlysresetdone, If(Xxdlysresetdone,
If(mode == "slave", If(mode == "slave",
NextState("WAIT_LAST_ALIGN_DONE") NextState("WAIT_LAST_ALIGN_DONE")