forked from M-Labs/artiq-zynq
cxp: add upconn interface, downconn PHY & crc
testing: add CSR control for tx trigger & trigger ack upconn: connect trigger, trigger ack & command_packet to UpConnPHY downconn: add GTX PHY
This commit is contained in:
parent
04932d630f
commit
f0dda0fcf7
|
@ -0,0 +1,69 @@
|
||||||
|
from migen import *
|
||||||
|
from misoc.interconnect.csr import *
|
||||||
|
from misoc.interconnect import stream
|
||||||
|
|
||||||
|
from cxp_downconn import CXP_DownConn
|
||||||
|
from cxp_upconn import CXP_UpConn_PHY
|
||||||
|
from cxp_pipeline import *
|
||||||
|
|
||||||
|
class CXP(Module, AutoCSR):
|
||||||
|
def __init__(self, refclk, downconn_pads, upconn_pads, sys_clk_freq, debug_sma, pmod_pads):
|
||||||
|
self.submodules.upconn = UpConn_Interface(upconn_pads, sys_clk_freq, debug_sma, pmod_pads)
|
||||||
|
|
||||||
|
self.submodules.downconn = CXP_DownConn(refclk, downconn_pads, sys_clk_freq, debug_sma, pmod_pads)
|
||||||
|
# TODO: support the option high speed upconn
|
||||||
|
|
||||||
|
# TODO: add link layer
|
||||||
|
|
||||||
|
|
||||||
|
class UpConn_Interface(Module, AutoCSR):
|
||||||
|
def __init__(self, upconn_pads, sys_clk_freq, debug_sma, pmod_pads):
|
||||||
|
self.clk_reset = CSRStorage(reset=1)
|
||||||
|
self.bitrate2x_enable = CSRStorage()
|
||||||
|
self.tx_enable = CSRStorage()
|
||||||
|
self.tx_busy = CSRStatus()
|
||||||
|
|
||||||
|
# # #
|
||||||
|
|
||||||
|
layout = [("data", 8), ("k", 1)]
|
||||||
|
|
||||||
|
self.submodules.upconn_phy = upconn_phy = CXP_UpConn_PHY(upconn_pads, sys_clk_freq, debug_sma, pmod_pads, layout)
|
||||||
|
|
||||||
|
self.sync += [
|
||||||
|
upconn_phy.bitrate2x_enable.eq(self.bitrate2x_enable.storage),
|
||||||
|
upconn_phy.tx_enable.eq(self.tx_enable.storage),
|
||||||
|
upconn_phy.clk_reset.eq(self.clk_reset.re),
|
||||||
|
self.tx_busy.status.eq(upconn_phy.tx_busy),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Packet FIFOs with transmission priority
|
||||||
|
# 0: Trigger packet
|
||||||
|
self.submodules.trig = trig = TX_Trigger(layout)
|
||||||
|
self.comb += trig.source.connect(upconn_phy.sinks[0])
|
||||||
|
|
||||||
|
# DEBUG: INPUT
|
||||||
|
self.trig_stb = CSR()
|
||||||
|
self.trig_delay = CSRStorage(8)
|
||||||
|
self.linktrigger = CSRStorage(2)
|
||||||
|
|
||||||
|
self.sync += [
|
||||||
|
trig.trig_stb.eq(self.trig_stb.re),
|
||||||
|
trig.delay.eq(self.trig_delay.storage),
|
||||||
|
trig.linktrig_mode.eq(self.linktrigger.storage),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# 1: IO acknowledgment for trigger packet
|
||||||
|
self.submodules.trig_ack = trig_ack = Trigger_ACK(layout)
|
||||||
|
self.comb += trig_ack.source.connect(upconn_phy.sinks[1])
|
||||||
|
|
||||||
|
# DEBUG: INPUT
|
||||||
|
self.ack = CSR()
|
||||||
|
self.sync += trig_ack.ack.eq(self.ack.re),
|
||||||
|
|
||||||
|
|
||||||
|
# 2: All other packets
|
||||||
|
# Control is not timing dependent, all the link layer is done in firmware
|
||||||
|
self.submodules.command = command = TX_Command_Packet(layout)
|
||||||
|
self.comb += command.source.connect(upconn_phy.sinks[2])
|
Loading…
Reference in New Issue