forked from M-Labs/artiq-zynq
change write_rustc_cfg_file to follow artiq repo
This commit is contained in:
parent
3d43bc8b15
commit
d019021ff5
|
@ -113,7 +113,6 @@ class SMAClkinForward(Module):
|
||||||
class GenericStandalone(SoCCore):
|
class GenericStandalone(SoCCore):
|
||||||
def __init__(self, description, acpki=False):
|
def __init__(self, description, acpki=False):
|
||||||
self.acpki = acpki
|
self.acpki = acpki
|
||||||
self.rustc_cfg = dict()
|
|
||||||
|
|
||||||
platform = kasli_soc.Platform()
|
platform = kasli_soc.Platform()
|
||||||
platform.toolchain.bitstream_commands.extend([
|
platform.toolchain.bitstream_commands.extend([
|
||||||
|
@ -129,8 +128,8 @@ class GenericStandalone(SoCCore):
|
||||||
|
|
||||||
self.submodules += SMAClkinForward(self.platform)
|
self.submodules += SMAClkinForward(self.platform)
|
||||||
|
|
||||||
self.rustc_cfg["has_si5324"] = None
|
self.config["HAS_SI5324"] = None
|
||||||
self.rustc_cfg["si5324_soft_reset"] = None
|
self.config["SI5324_SOFT_RESET"] = None
|
||||||
|
|
||||||
self.crg = self.ps7 # HACK for eem_7series to find the clock
|
self.crg = self.ps7 # HACK for eem_7series to find the clock
|
||||||
self.submodules.rtio_crg = RTIOCRG(self.platform)
|
self.submodules.rtio_crg = RTIOCRG(self.platform)
|
||||||
|
@ -160,14 +159,14 @@ class GenericStandalone(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")
|
||||||
|
|
||||||
|
@ -187,7 +186,7 @@ class GenericStandalone(SoCCore):
|
||||||
self.csr_devices.append("rtio_analyzer")
|
self.csr_devices.append("rtio_analyzer")
|
||||||
|
|
||||||
if has_grabber:
|
if has_grabber:
|
||||||
self.rustc_cfg["has_grabber"] = None
|
self.config["HAS_GRABBER"] = None
|
||||||
self.add_csr_group("grabber", self.grabber_csr_group)
|
self.add_csr_group("grabber", self.grabber_csr_group)
|
||||||
for grabber in self.grabber_csr_group:
|
for grabber in self.grabber_csr_group:
|
||||||
self.platform.add_false_path_constraints(
|
self.platform.add_false_path_constraints(
|
||||||
|
@ -200,7 +199,6 @@ class GenericMaster(SoCCore):
|
||||||
rtio_clk_freq = description["rtio_frequency"]
|
rtio_clk_freq = description["rtio_frequency"]
|
||||||
|
|
||||||
self.acpki = acpki
|
self.acpki = acpki
|
||||||
self.rustc_cfg = dict()
|
|
||||||
|
|
||||||
platform = kasli_soc.Platform()
|
platform = kasli_soc.Platform()
|
||||||
platform.toolchain.bitstream_commands.extend([
|
platform.toolchain.bitstream_commands.extend([
|
||||||
|
@ -229,8 +227,8 @@ class GenericMaster(SoCCore):
|
||||||
self.csr_devices.append("rtio_crg")
|
self.csr_devices.append("rtio_crg")
|
||||||
fix_serdes_timing_path(platform)
|
fix_serdes_timing_path(platform)
|
||||||
|
|
||||||
self.rustc_cfg["has_si5324"] = None
|
self.config["HAS_SI5324"] = None
|
||||||
self.rustc_cfg["si5324_soft_reset"] = None
|
self.config["SI5324_SOFT_RESET"] = None
|
||||||
|
|
||||||
self.rtio_channels = []
|
self.rtio_channels = []
|
||||||
has_grabber = any(peripheral["type"] == "grabber" for peripheral in description["peripherals"])
|
has_grabber = any(peripheral["type"] == "grabber" for peripheral in description["peripherals"])
|
||||||
|
@ -275,8 +273,8 @@ class GenericMaster(SoCCore):
|
||||||
memory_address = self.axi2csr.register_port(coreaux.get_tx_port(), size)
|
memory_address = self.axi2csr.register_port(coreaux.get_tx_port(), size)
|
||||||
self.axi2csr.register_port(coreaux.get_rx_port(), size)
|
self.axi2csr.register_port(coreaux.get_rx_port(), size)
|
||||||
self.add_memory_region(memory_name, self.mem_map["csr"] + memory_address, size * 2)
|
self.add_memory_region(memory_name, self.mem_map["csr"] + memory_address, 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)
|
||||||
|
@ -285,14 +283,14 @@ class GenericMaster(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")
|
||||||
|
|
||||||
|
@ -316,7 +314,7 @@ class GenericMaster(SoCCore):
|
||||||
self.csr_devices.append("rtio_analyzer")
|
self.csr_devices.append("rtio_analyzer")
|
||||||
|
|
||||||
if has_grabber:
|
if has_grabber:
|
||||||
self.rustc_cfg["has_grabber"] = None
|
self.config["HAS_GRABBER"] = None
|
||||||
self.add_csr_group("grabber", self.grabber_csr_group)
|
self.add_csr_group("grabber", self.grabber_csr_group)
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,7 +324,6 @@ class GenericSatellite(SoCCore):
|
||||||
rtio_clk_freq = description["rtio_frequency"]
|
rtio_clk_freq = description["rtio_frequency"]
|
||||||
|
|
||||||
self.acpki = acpki
|
self.acpki = acpki
|
||||||
self.rustc_cfg = dict()
|
|
||||||
|
|
||||||
platform = kasli_soc.Platform()
|
platform = kasli_soc.Platform()
|
||||||
platform.toolchain.bitstream_commands.extend([
|
platform.toolchain.bitstream_commands.extend([
|
||||||
|
@ -343,7 +340,6 @@ class GenericSatellite(SoCCore):
|
||||||
self.crg = self.ps7 # HACK for eem_7series to find the clock
|
self.crg = self.ps7 # HACK for eem_7series to find the clock
|
||||||
self.submodules.rtio_crg = RTIOClockMultiplier(rtio_clk_freq)
|
self.submodules.rtio_crg = RTIOClockMultiplier(rtio_clk_freq)
|
||||||
self.csr_devices.append("rtio_crg")
|
self.csr_devices.append("rtio_crg")
|
||||||
self.rustc_cfg["has_rtio_crg"] = None
|
|
||||||
fix_serdes_timing_path(platform)
|
fix_serdes_timing_path(platform)
|
||||||
|
|
||||||
data_pads = [platform.request("sfp", i) for i in range(4)]
|
data_pads = [platform.request("sfp", i) for i in range(4)]
|
||||||
|
@ -412,21 +408,21 @@ class GenericSatellite(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_memory_group("drtioaux_mem", drtioaux_memory_group)
|
self.add_memory_group("drtioaux_mem", drtioaux_memory_group)
|
||||||
self.add_csr_group("drtiorep", drtiorep_csr_group)
|
self.add_csr_group("drtiorep", drtiorep_csr_group)
|
||||||
|
|
||||||
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")
|
||||||
|
|
||||||
|
@ -449,7 +445,7 @@ class GenericSatellite(SoCCore):
|
||||||
self.csr_devices.append("rtio_moninj")
|
self.csr_devices.append("rtio_moninj")
|
||||||
|
|
||||||
rtio_clk_period = 1e9/rtio_clk_freq
|
rtio_clk_period = 1e9/rtio_clk_freq
|
||||||
self.rustc_cfg["rtio_frequency"] = str(rtio_clk_freq/1e6)
|
self.config["RTIO_FREQUENCY"] = str(rtio_clk_freq/1e6)
|
||||||
|
|
||||||
self.submodules.siphaser = SiPhaser7Series(
|
self.submodules.siphaser = SiPhaser7Series(
|
||||||
si5324_clkin=platform.request("cdr_clk"),
|
si5324_clkin=platform.request("cdr_clk"),
|
||||||
|
@ -459,9 +455,8 @@ class GenericSatellite(SoCCore):
|
||||||
platform.add_false_path_constraints(
|
platform.add_false_path_constraints(
|
||||||
self.crg.cd_sys.clk, self.siphaser.mmcm_freerun_output)
|
self.crg.cd_sys.clk, self.siphaser.mmcm_freerun_output)
|
||||||
self.csr_devices.append("siphaser")
|
self.csr_devices.append("siphaser")
|
||||||
self.rustc_cfg["has_si5324"] = None
|
self.config["HAS_SI5324"] = None
|
||||||
self.rustc_cfg["has_siphaser"] = None
|
self.config["SI5324_SOFT_RESET"] = None
|
||||||
self.rustc_cfg["si5324_soft_reset"] = None
|
|
||||||
|
|
||||||
gtx0 = self.drtio_transceiver.gtxs[0]
|
gtx0 = self.drtio_transceiver.gtxs[0]
|
||||||
platform.add_period_constraint(gtx0.txoutclk, rtio_clk_period)
|
platform.add_period_constraint(gtx0.txoutclk, rtio_clk_period)
|
||||||
|
@ -475,7 +470,7 @@ class GenericSatellite(SoCCore):
|
||||||
self.crg.cd_sys.clk, gtx.rxoutclk)
|
self.crg.cd_sys.clk, gtx.rxoutclk)
|
||||||
|
|
||||||
if has_grabber:
|
if has_grabber:
|
||||||
self.rustc_cfg["has_grabber"] = None
|
self.config["HAS_GRABBER"] = None
|
||||||
self.add_csr_group("grabber", self.grabber_csr_group)
|
self.add_csr_group("grabber", self.grabber_csr_group)
|
||||||
# no RTIO CRG here
|
# no RTIO CRG here
|
||||||
|
|
||||||
|
@ -494,11 +489,14 @@ def write_csr_file(soc, filename):
|
||||||
|
|
||||||
def write_rustc_cfg_file(soc, filename):
|
def write_rustc_cfg_file(soc, filename):
|
||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
for k, v in sorted(soc.rustc_cfg.items(), key=itemgetter(0)):
|
for name, origin, busword, obj in soc.get_csr_regions():
|
||||||
if v is None:
|
f.write("has_{}\n".format(name.lower()))
|
||||||
f.write("{}\n".format(k))
|
for name, value in soc.get_constants():
|
||||||
|
if name.upper().startswith("CONFIG_"):
|
||||||
|
if value is None:
|
||||||
|
f.write("{}\n".format(name.lower()[7:]))
|
||||||
else:
|
else:
|
||||||
f.write("{}=\"{}\"\n".format(k, v))
|
f.write("{}=\"{}\"\n".format(name.lower()[7:], str(value)))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in New Issue