artiq_ddb_template: better satellite formatting

This commit is contained in:
mwojcik 2023-10-06 13:01:57 +08:00
parent 47fc640f75
commit e63e2a2897

View File

@ -757,16 +757,26 @@ def process(output, primary_description, satellites):
peripherals, satellite_drtio_peripherals = split_drtio_eem(description["peripherals"]) peripherals, satellite_drtio_peripherals = split_drtio_eem(description["peripherals"])
drtio_peripherals.extend(satellite_drtio_peripherals) drtio_peripherals.extend(satellite_drtio_peripherals)
print("# DEST#{} peripherals".format(destination), file=output) print(textwrap.dedent("""
print("device_db[\"satellite_cpu_targets\"][{}] = \"{}\"".format(destination, get_cpu_target(description)), file=output) # DEST#{dest} peripherals
device_db["satellite_cpu_targets"][{dest}] = \"{target}\"""").format(
dest=destination,
target=get_cpu_target(description)),
file=output)
rtio_offset = destination << 16 rtio_offset = destination << 16
for peripheral in peripherals: for peripheral in peripherals:
n_channels = pm.process(rtio_offset, peripheral) n_channels = pm.process(rtio_offset, peripheral)
rtio_offset += n_channels rtio_offset += n_channels
for peripheral in drtio_peripherals: for peripheral in drtio_peripherals:
print("# DEST#{} peripherals".format(peripheral["drtio_destination"]), file=output) print(textwrap.dedent("""
print("device_db[\"satellite_cpu_targets\"][{}] = \"{}\"".format(peripheral["drtio_destination"], get_cpu_target(peripheral)), file=output) # DEST#{dest} peripherals
device_db["satellite_cpu_targets"][{dest}] = \"{target}\"""").format(
dest=peripheral["drtio_destination"],
target=get_cpu_target(peripheral)),
file=output)
processor = getattr(pm, "process_"+str(peripheral["type"])) processor = getattr(pm, "process_"+str(peripheral["type"]))
processor(peripheral) processor(peripheral)