From fcf6c90ba2414502abdda264a4e4ecdba2ad9aee Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 27 Sep 2023 17:15:13 +0800 Subject: [PATCH] ddb_template: support different satellite targets --- artiq/frontend/artiq_ddb_template.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/artiq/frontend/artiq_ddb_template.py b/artiq/frontend/artiq_ddb_template.py index 60166ddce..50f9eb76a 100755 --- a/artiq/frontend/artiq_ddb_template.py +++ b/artiq/frontend/artiq_ddb_template.py @@ -11,17 +11,20 @@ from artiq.coredevice import jsondesc from artiq.coredevice.phaser import PHASER_GW_MIQRO, PHASER_GW_BASE -def process_header(output, description): +def get_cpu_target(description): + if description.get("type", None) == "shuttler": + return "rv32g" if description["target"] == "kasli": if description["hw_rev"] in ("v1.0", "v1.1"): - cpu_target = "rv32ima" + return "rv32ima" else: - cpu_target = "rv32g" + return "rv32g" elif description["target"] == "kasli_soc": - cpu_target = "cortexa9" + return "cortexa9" else: raise NotImplementedError +def process_header(output, description): print(textwrap.dedent(""" # Autogenerated for the {variant} variant core_addr = "{core_addr}" @@ -57,6 +60,8 @@ def process_header(output, description): "class": "CoreDMA" }}, + "satellite_cpu_targets": {{}}, + "i2c_switch0": {{ "type": "local", "module": "artiq.coredevice.i2c", @@ -74,7 +79,7 @@ def process_header(output, description): variant=description["variant"], core_addr=description["core_addr"], ref_period=1/(8*description["rtio_frequency"]), - cpu_target=cpu_target), + cpu_target=get_cpu_target(description)), file=output) @@ -753,6 +758,7 @@ def process(output, primary_description, satellites): drtio_peripherals.extend(satellite_drtio_peripherals) print("# DEST#{} peripherals".format(destination), file=output) + print("device_db[\"satellite_cpu_targets\"][{}] = \"{}\"".format(destination, get_cpu_target(description)), file=output) rtio_offset = destination << 16 for peripheral in peripherals: n_channels = pm.process(rtio_offset, peripheral) @@ -760,6 +766,7 @@ def process(output, primary_description, satellites): for peripheral in drtio_peripherals: print("# DEST#{} peripherals".format(peripheral["drtio_destination"]), file=output) + print("device_db[\"satellite_cpu_targets\"][{}] = \"{}\"".format(peripheral["drtio_destination"], get_cpu_target(peripheral)), file=output) processor = getattr(pm, "process_"+str(peripheral["type"])) processor(peripheral)