mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
gateware/soc: factor code to connect CSR device to kernel CPU
This commit is contained in:
parent
b662a6fcbd
commit
a901971e58
@ -32,11 +32,17 @@ class AMPSoC:
|
||||
self.mem_map["mailbox"] | 0x80000000, 4)
|
||||
|
||||
self.submodules.timer_kernel = timer.Timer()
|
||||
timer_csrs = self.timer_kernel.get_csrs()
|
||||
timerwb = wishbone.CSRBank(timer_csrs)
|
||||
self.submodules += timerwb
|
||||
self.kernel_cpu.add_wb_slave(mem_decoder(self.mem_map["timer_kernel"]),
|
||||
timerwb.bus)
|
||||
self.add_csr_region("timer_kernel",
|
||||
self.mem_map["timer_kernel"] | 0x80000000, 32,
|
||||
timer_csrs)
|
||||
self.register_kernel_cpu_csrdevice("timer_kernel")
|
||||
|
||||
def register_kernel_cpu_csrdevice(self, name):
|
||||
# make sure the device is not getting connected to the comms-CPU already
|
||||
assert self.csr_map[name] is None
|
||||
|
||||
csrs = getattr(self, name).get_csrs()
|
||||
bank = wishbone.CSRBank(csrs)
|
||||
self.submodules += bank
|
||||
self.kernel_cpu.add_wb_slave(mem_decoder(self.mem_map[name]),
|
||||
bank.bus)
|
||||
self.add_csr_region(name,
|
||||
self.mem_map[name] | 0x80000000, 32,
|
||||
csrs)
|
||||
|
@ -134,6 +134,7 @@ class _NIST_Ions(MiniSoC, AMPSoC):
|
||||
def add_rtio(self, rtio_channels):
|
||||
self.submodules.rtio_crg = _RTIOCRG(self.platform, self.crg.cd_sys.clk)
|
||||
self.submodules.rtio = rtio.RTIO(rtio_channels)
|
||||
self.register_kernel_cpu_csrdevice("rtio")
|
||||
self.config["RTIO_FINE_TS_WIDTH"] = self.rtio.fine_ts_width
|
||||
self.submodules.rtio_moninj = rtio.MonInj(rtio_channels)
|
||||
|
||||
@ -154,13 +155,6 @@ class _NIST_Ions(MiniSoC, AMPSoC):
|
||||
self.ethphy.crg.cd_eth_rx.clk,
|
||||
self.ethphy.crg.cd_eth_tx.clk)
|
||||
|
||||
rtio_csrs = self.rtio.get_csrs()
|
||||
self.submodules.rtiowb = wishbone.CSRBank(rtio_csrs)
|
||||
self.kernel_cpu.add_wb_slave(mem_decoder(self.mem_map["rtio"]),
|
||||
self.rtiowb.bus)
|
||||
self.add_csr_region("rtio", self.mem_map["rtio"] | 0x80000000, 32,
|
||||
rtio_csrs)
|
||||
|
||||
self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio,
|
||||
self.get_native_sdram_if())
|
||||
|
||||
|
@ -209,20 +209,12 @@ trce -v 12 -fastpaths -tsi {build_name}.tsi -o {build_name}.twr {build_name}.ncd
|
||||
self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
|
||||
rtio_channels.append(rtio.LogChannel())
|
||||
|
||||
# RTIO core
|
||||
# RTIO logic
|
||||
self.submodules.rtio = rtio.RTIO(rtio_channels)
|
||||
self.register_kernel_cpu_csrdevice("rtio")
|
||||
self.config["RTIO_FINE_TS_WIDTH"] = self.rtio.fine_ts_width
|
||||
self.config["DDS_RTIO_CLK_RATIO"] = 8 >> self.rtio.fine_ts_width
|
||||
self.submodules.rtio_moninj = rtio.MonInj(rtio_channels)
|
||||
|
||||
# CPU connections
|
||||
rtio_csrs = self.rtio.get_csrs()
|
||||
self.submodules.rtiowb = wishbone.CSRBank(rtio_csrs)
|
||||
self.kernel_cpu.add_wb_slave(mem_decoder(self.mem_map["rtio"]),
|
||||
self.rtiowb.bus)
|
||||
self.add_csr_region("rtio", self.mem_map["rtio"] | 0x80000000, 32,
|
||||
rtio_csrs)
|
||||
|
||||
self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio,
|
||||
self.get_native_sdram_if())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user