Compare commits
3 Commits
7d9b007a16
...
e3d01fb7ac
Author | SHA1 | Date |
---|---|---|
morgan | e3d01fb7ac | |
morgan | 21edfba299 | |
morgan | 131c7103df |
|
@ -0,0 +1,16 @@
|
||||||
|
from misoc.integration import cpu_interface
|
||||||
|
|
||||||
|
def write_csr_file(soc, filename):
|
||||||
|
with open(filename, "w") as f:
|
||||||
|
f.write(cpu_interface.get_csr_rust(
|
||||||
|
soc.get_csr_regions(), soc.get_csr_groups(), soc.get_constants()))
|
||||||
|
|
||||||
|
def write_mem_file(soc, filename):
|
||||||
|
with open(filename, "w") as f:
|
||||||
|
f.write(cpu_interface.get_mem_rust(
|
||||||
|
soc.get_memory_regions(), soc.get_memory_groups(), None))
|
||||||
|
|
||||||
|
def write_rustc_cfg_file(soc, filename):
|
||||||
|
with open(filename, "w") as f:
|
||||||
|
f.write(cpu_interface.get_rust_cfg(
|
||||||
|
soc.get_csr_regions(), soc.get_constants()))
|
|
@ -11,7 +11,6 @@ from migen_axi.integration.soc_core import SoCCore
|
||||||
from migen_axi.platforms import kasli_soc
|
from migen_axi.platforms import kasli_soc
|
||||||
from misoc.interconnect.csr import *
|
from misoc.interconnect.csr import *
|
||||||
from misoc.cores import virtual_leds
|
from misoc.cores import virtual_leds
|
||||||
from misoc.integration import cpu_interface
|
|
||||||
|
|
||||||
from artiq.coredevice import jsondesc
|
from artiq.coredevice import jsondesc
|
||||||
from artiq.gateware import rtio, eem_7series
|
from artiq.gateware import rtio, eem_7series
|
||||||
|
@ -27,6 +26,7 @@ import dma
|
||||||
import analyzer
|
import analyzer
|
||||||
import acpki
|
import acpki
|
||||||
import drtio_aux_controller
|
import drtio_aux_controller
|
||||||
|
from config import write_csr_file, write_mem_file, write_rustc_cfg_file
|
||||||
|
|
||||||
class RTIOCRG(Module, AutoCSR):
|
class RTIOCRG(Module, AutoCSR):
|
||||||
def __init__(self, platform):
|
def __init__(self, platform):
|
||||||
|
@ -496,28 +496,6 @@ class GenericSatellite(SoCCore):
|
||||||
self.comb += [self.virtual_leds.get(i).eq(channel.rx_ready)
|
self.comb += [self.virtual_leds.get(i).eq(channel.rx_ready)
|
||||||
for i, channel in enumerate(self.drtio_transceiver.channels)]
|
for i, channel in enumerate(self.drtio_transceiver.channels)]
|
||||||
|
|
||||||
def write_mem_file(soc, filename):
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
f.write(cpu_interface.get_mem_rust(
|
|
||||||
soc.get_memory_regions(), soc.get_memory_groups(), None))
|
|
||||||
|
|
||||||
|
|
||||||
def write_csr_file(soc, filename):
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
f.write(cpu_interface.get_csr_rust(
|
|
||||||
soc.get_csr_regions(), soc.get_csr_groups(), soc.get_constants()))
|
|
||||||
|
|
||||||
|
|
||||||
def write_rustc_cfg_file(soc, filename):
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
for name, origin, busword, obj in soc.get_csr_regions():
|
|
||||||
f.write("has_{}\n".format(name.lower()))
|
|
||||||
for name, value in soc.get_constants():
|
|
||||||
if name.upper().startswith("CONFIG_"):
|
|
||||||
if value is None:
|
|
||||||
f.write("{}\n".format(name.lower()[7:]))
|
|
||||||
else:
|
|
||||||
f.write("{}=\"{}\"\n".format(name.lower()[7:], str(value)))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -10,7 +10,6 @@ from migen.genlib.cdc import MultiReg
|
||||||
from migen_axi.integration.soc_core import SoCCore
|
from migen_axi.integration.soc_core import SoCCore
|
||||||
from migen_axi.platforms import zc706
|
from migen_axi.platforms import zc706
|
||||||
from misoc.interconnect.csr import *
|
from misoc.interconnect.csr import *
|
||||||
from misoc.integration import cpu_interface
|
|
||||||
from misoc.cores import gpio
|
from misoc.cores import gpio
|
||||||
|
|
||||||
from artiq.gateware import rtio, nist_clock, nist_qc2
|
from artiq.gateware import rtio, nist_clock, nist_qc2
|
||||||
|
@ -25,6 +24,7 @@ import dma
|
||||||
import analyzer
|
import analyzer
|
||||||
import acpki
|
import acpki
|
||||||
import drtio_aux_controller
|
import drtio_aux_controller
|
||||||
|
from config import write_csr_file, write_mem_file, write_rustc_cfg_file
|
||||||
|
|
||||||
|
|
||||||
class RTIOCRG(Module, AutoCSR):
|
class RTIOCRG(Module, AutoCSR):
|
||||||
|
@ -142,7 +142,6 @@ def prepare_zc706_platform(platform):
|
||||||
class ZC706(SoCCore):
|
class ZC706(SoCCore):
|
||||||
def __init__(self, acpki=False):
|
def __init__(self, acpki=False):
|
||||||
self.acpki = acpki
|
self.acpki = acpki
|
||||||
self.rustc_cfg = dict()
|
|
||||||
|
|
||||||
platform = zc706.Platform()
|
platform = zc706.Platform()
|
||||||
prepare_zc706_platform(platform)
|
prepare_zc706_platform(platform)
|
||||||
|
@ -154,7 +153,7 @@ class ZC706(SoCCore):
|
||||||
|
|
||||||
self.submodules.rtio_crg = RTIOCRG(self.platform, self.ps7.cd_sys.clk)
|
self.submodules.rtio_crg = RTIOCRG(self.platform, self.ps7.cd_sys.clk)
|
||||||
self.csr_devices.append("rtio_crg")
|
self.csr_devices.append("rtio_crg")
|
||||||
self.rustc_cfg["has_rtio_crg_clock_sel"] = None
|
self.config["has_rtio_crg_clock_sel"] = None
|
||||||
self.platform.add_period_constraint(self.rtio_crg.cd_rtio.clk, 8.)
|
self.platform.add_period_constraint(self.rtio_crg.cd_rtio.clk, 8.)
|
||||||
self.platform.add_false_path_constraints(
|
self.platform.add_false_path_constraints(
|
||||||
self.ps7.cd_sys.clk,
|
self.ps7.cd_sys.clk,
|
||||||
|
@ -166,14 +165,14 @@ class ZC706(SoCCore):
|
||||||
self.csr_devices.append("rtio_core")
|
self.csr_devices.append("rtio_core")
|
||||||
|
|
||||||
if self.acpki:
|
if self.acpki:
|
||||||
self.rustc_cfg["ki_impl"] = "acp"
|
self.config["ki_impl"] = "acp"
|
||||||
self.submodules.rtio = acpki.KernelInitiator(self.rtio_tsc,
|
self.submodules.rtio = acpki.KernelInitiator(self.rtio_tsc,
|
||||||
bus=self.ps7.s_axi_acp,
|
bus=self.ps7.s_axi_acp,
|
||||||
user=self.ps7.s_axi_acp_user,
|
user=self.ps7.s_axi_acp_user,
|
||||||
evento=self.ps7.event.o)
|
evento=self.ps7.event.o)
|
||||||
self.csr_devices.append("rtio")
|
self.csr_devices.append("rtio")
|
||||||
else:
|
else:
|
||||||
self.rustc_cfg["ki_impl"] = "csr"
|
self.config["ki_impl"] = "csr"
|
||||||
self.submodules.rtio = rtio.KernelInitiator(self.rtio_tsc, now64=True)
|
self.submodules.rtio = rtio.KernelInitiator(self.rtio_tsc, now64=True)
|
||||||
self.csr_devices.append("rtio")
|
self.csr_devices.append("rtio")
|
||||||
|
|
||||||
|
@ -196,7 +195,6 @@ class ZC706(SoCCore):
|
||||||
class _MasterBase(SoCCore):
|
class _MasterBase(SoCCore):
|
||||||
def __init__(self, acpki=False, drtio100mhz=False):
|
def __init__(self, acpki=False, drtio100mhz=False):
|
||||||
self.acpki = acpki
|
self.acpki = acpki
|
||||||
self.rustc_cfg = dict()
|
|
||||||
|
|
||||||
platform = zc706.Platform()
|
platform = zc706.Platform()
|
||||||
prepare_zc706_platform(platform)
|
prepare_zc706_platform(platform)
|
||||||
|
@ -258,18 +256,18 @@ class _MasterBase(SoCCore):
|
||||||
memory_address = self.axi2csr.register_port(coreaux.get_tx_port(), mem_size)
|
memory_address = self.axi2csr.register_port(coreaux.get_tx_port(), mem_size)
|
||||||
self.axi2csr.register_port(coreaux.get_rx_port(), mem_size)
|
self.axi2csr.register_port(coreaux.get_rx_port(), mem_size)
|
||||||
self.add_memory_region(memory_name, self.mem_map["csr"] + memory_address, mem_size * 2)
|
self.add_memory_region(memory_name, self.mem_map["csr"] + memory_address, mem_size * 2)
|
||||||
self.rustc_cfg["has_drtio"] = None
|
self.config["has_drtio"] = None
|
||||||
self.rustc_cfg["has_drtio_routing"] = None
|
self.config["has_drtio_routing"] = None
|
||||||
self.add_csr_group("drtio", drtio_csr_group)
|
self.add_csr_group("drtio", drtio_csr_group)
|
||||||
self.add_csr_group("drtioaux", drtioaux_csr_group)
|
self.add_csr_group("drtioaux", drtioaux_csr_group)
|
||||||
self.add_memory_group("drtioaux_mem", drtioaux_memory_group)
|
self.add_memory_group("drtioaux_mem", drtioaux_memory_group)
|
||||||
|
|
||||||
self.rustc_cfg["rtio_frequency"] = str(self.drtio_transceiver.rtio_clk_freq/1e6)
|
self.config["rtio_frequency"] = str(self.drtio_transceiver.rtio_clk_freq/1e6)
|
||||||
|
|
||||||
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324_33").rst_n)
|
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324_33").rst_n)
|
||||||
self.csr_devices.append("si5324_rst_n")
|
self.csr_devices.append("si5324_rst_n")
|
||||||
self.rustc_cfg["has_si5324"] = None
|
self.config["has_si5324"] = None
|
||||||
self.rustc_cfg["si5324_as_synthesizer"] = None
|
self.config["si5324_as_synthesizer"] = None
|
||||||
|
|
||||||
rtio_clk_period = 1e9/self.drtio_transceiver.rtio_clk_freq
|
rtio_clk_period = 1e9/self.drtio_transceiver.rtio_clk_freq
|
||||||
# Constrain TX & RX timing for the first transceiver channel
|
# Constrain TX & RX timing for the first transceiver channel
|
||||||
|
@ -297,14 +295,14 @@ class _MasterBase(SoCCore):
|
||||||
self.csr_devices.append("rtio_core")
|
self.csr_devices.append("rtio_core")
|
||||||
|
|
||||||
if self.acpki:
|
if self.acpki:
|
||||||
self.rustc_cfg["ki_impl"] = "acp"
|
self.config["ki_impl"] = "acp"
|
||||||
self.submodules.rtio = acpki.KernelInitiator(self.rtio_tsc,
|
self.submodules.rtio = acpki.KernelInitiator(self.rtio_tsc,
|
||||||
bus=self.ps7.s_axi_acp,
|
bus=self.ps7.s_axi_acp,
|
||||||
user=self.ps7.s_axi_acp_user,
|
user=self.ps7.s_axi_acp_user,
|
||||||
evento=self.ps7.event.o)
|
evento=self.ps7.event.o)
|
||||||
self.csr_devices.append("rtio")
|
self.csr_devices.append("rtio")
|
||||||
else:
|
else:
|
||||||
self.rustc_cfg["ki_impl"] = "csr"
|
self.config["ki_impl"] = "csr"
|
||||||
self.submodules.rtio = rtio.KernelInitiator(self.rtio_tsc, now64=True)
|
self.submodules.rtio = rtio.KernelInitiator(self.rtio_tsc, now64=True)
|
||||||
self.csr_devices.append("rtio")
|
self.csr_devices.append("rtio")
|
||||||
|
|
||||||
|
@ -331,7 +329,6 @@ class _MasterBase(SoCCore):
|
||||||
class _SatelliteBase(SoCCore):
|
class _SatelliteBase(SoCCore):
|
||||||
def __init__(self, acpki=False, drtio100mhz=False):
|
def __init__(self, acpki=False, drtio100mhz=False):
|
||||||
self.acpki = acpki
|
self.acpki = acpki
|
||||||
self.rustc_cfg = dict()
|
|
||||||
|
|
||||||
platform = zc706.Platform()
|
platform = zc706.Platform()
|
||||||
prepare_zc706_platform(platform)
|
prepare_zc706_platform(platform)
|
||||||
|
@ -405,13 +402,13 @@ class _SatelliteBase(SoCCore):
|
||||||
# and registered in PS interface
|
# and registered in PS interface
|
||||||
# manually, because software refers to rx/tx by halves of entire memory block, not names
|
# manually, because software refers to rx/tx by halves of entire memory block, not names
|
||||||
self.add_memory_region(memory_name, self.mem_map["csr"] + memory_address, mem_size * 2)
|
self.add_memory_region(memory_name, self.mem_map["csr"] + memory_address, mem_size * 2)
|
||||||
self.rustc_cfg["has_drtio"] = None
|
self.config["has_drtio"] = None
|
||||||
self.rustc_cfg["has_drtio_routing"] = None
|
self.config["has_drtio_routing"] = None
|
||||||
self.add_csr_group("drtioaux", drtioaux_csr_group)
|
self.add_csr_group("drtioaux", drtioaux_csr_group)
|
||||||
self.add_csr_group("drtiorep", drtiorep_csr_group)
|
self.add_csr_group("drtiorep", drtiorep_csr_group)
|
||||||
self.add_memory_group("drtioaux_mem", drtioaux_memory_group)
|
self.add_memory_group("drtioaux_mem", drtioaux_memory_group)
|
||||||
|
|
||||||
self.rustc_cfg["rtio_frequency"] = str(self.drtio_transceiver.rtio_clk_freq/1e6)
|
self.config["rtio_frequency"] = str(self.drtio_transceiver.rtio_clk_freq/1e6)
|
||||||
|
|
||||||
# Si5324 Phaser
|
# Si5324 Phaser
|
||||||
self.submodules.siphaser = SiPhaser7Series(
|
self.submodules.siphaser = SiPhaser7Series(
|
||||||
|
@ -424,8 +421,8 @@ class _SatelliteBase(SoCCore):
|
||||||
self.csr_devices.append("siphaser")
|
self.csr_devices.append("siphaser")
|
||||||
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324_33").rst_n)
|
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324_33").rst_n)
|
||||||
self.csr_devices.append("si5324_rst_n")
|
self.csr_devices.append("si5324_rst_n")
|
||||||
self.rustc_cfg["has_si5324"] = None
|
self.config["has_si5324"] = None
|
||||||
self.rustc_cfg["has_siphaser"] = None
|
self.config["has_siphaser"] = None
|
||||||
|
|
||||||
rtio_clk_period = 1e9/self.drtio_transceiver.rtio_clk_freq
|
rtio_clk_period = 1e9/self.drtio_transceiver.rtio_clk_freq
|
||||||
# Constrain TX & RX timing for the first transceiver channel
|
# Constrain TX & RX timing for the first transceiver channel
|
||||||
|
@ -445,7 +442,7 @@ class _SatelliteBase(SoCCore):
|
||||||
|
|
||||||
self.submodules.rtio_crg = RTIOClockMultiplier(self.sys_clk_freq)
|
self.submodules.rtio_crg = RTIOClockMultiplier(self.sys_clk_freq)
|
||||||
self.csr_devices.append("rtio_crg")
|
self.csr_devices.append("rtio_crg")
|
||||||
self.rustc_cfg["has_rtio_crg"] = None
|
self.config["has_rtio_crg"] = None
|
||||||
fix_serdes_timing_path(self.platform)
|
fix_serdes_timing_path(self.platform)
|
||||||
|
|
||||||
def add_rtio(self, rtio_channels):
|
def add_rtio(self, rtio_channels):
|
||||||
|
@ -453,14 +450,14 @@ class _SatelliteBase(SoCCore):
|
||||||
self.csr_devices.append("rtio_moninj")
|
self.csr_devices.append("rtio_moninj")
|
||||||
|
|
||||||
if self.acpki:
|
if self.acpki:
|
||||||
self.rustc_cfg["ki_impl"] = "acp"
|
self.config["ki_impl"] = "acp"
|
||||||
self.submodules.rtio = acpki.KernelInitiator(self.rtio_tsc,
|
self.submodules.rtio = acpki.KernelInitiator(self.rtio_tsc,
|
||||||
bus=self.ps7.s_axi_acp,
|
bus=self.ps7.s_axi_acp,
|
||||||
user=self.ps7.s_axi_acp_user,
|
user=self.ps7.s_axi_acp_user,
|
||||||
evento=self.ps7.event.o)
|
evento=self.ps7.event.o)
|
||||||
self.csr_devices.append("rtio")
|
self.csr_devices.append("rtio")
|
||||||
else:
|
else:
|
||||||
self.rustc_cfg["ki_impl"] = "csr"
|
self.config["ki_impl"] = "csr"
|
||||||
self.submodules.rtio = rtio.KernelInitiator(self.rtio_tsc, now64=True)
|
self.submodules.rtio = rtio.KernelInitiator(self.rtio_tsc, now64=True)
|
||||||
self.csr_devices.append("rtio")
|
self.csr_devices.append("rtio")
|
||||||
|
|
||||||
|
@ -656,24 +653,7 @@ VARIANTS = {cls.__name__.lower(): cls for cls in [NIST_CLOCK, NIST_CLOCK_Master,
|
||||||
NIST_QC2, NIST_QC2_Master, NIST_QC2_Satellite]}
|
NIST_QC2, NIST_QC2_Master, NIST_QC2_Satellite]}
|
||||||
|
|
||||||
|
|
||||||
def write_csr_file(soc, filename):
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
f.write(cpu_interface.get_csr_rust(
|
|
||||||
soc.get_csr_regions(), soc.get_csr_groups(), soc.get_constants()))
|
|
||||||
|
|
||||||
def write_mem_file(soc, filename):
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
f.write(cpu_interface.get_mem_rust(
|
|
||||||
soc.get_memory_regions(), soc.get_memory_groups(), None))
|
|
||||||
|
|
||||||
|
|
||||||
def write_rustc_cfg_file(soc, filename):
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
for k, v in sorted(soc.rustc_cfg.items(), key=itemgetter(0)):
|
|
||||||
if v is None:
|
|
||||||
f.write("{}\n".format(k))
|
|
||||||
else:
|
|
||||||
f.write("{}=\"{}\"\n".format(k, v))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in New Issue