artiq_ddb_template: kasli-soc support

This commit is contained in:
Sebastien Bourdeauducq 2021-05-30 19:40:03 +08:00
parent 07bd1e27c1
commit ea1dd2da43

View File

@ -11,9 +11,14 @@ from artiq.coredevice import jsondesc
def process_header(output, description): def process_header(output, description):
if description["target"] != "kasli": if description["target"] not in ("kasli", "kasli_soc"):
raise NotImplementedError raise NotImplementedError
cpu_target = {
"kasli": "or1k",
"kasli_soc": "cortexa9"
}[description["target"]]
print(textwrap.dedent(""" print(textwrap.dedent("""
# Autogenerated for the {variant} variant # Autogenerated for the {variant} variant
core_addr = "{core_addr}" core_addr = "{core_addr}"
@ -23,7 +28,7 @@ def process_header(output, description):
"type": "local", "type": "local",
"module": "artiq.coredevice.core", "module": "artiq.coredevice.core",
"class": "Core", "class": "Core",
"arguments": {{"host": core_addr, "ref_period": {ref_period}}} "arguments": {{"host": core_addr, "ref_period": {ref_period}, "target": "{cpu_target}"}},
}}, }},
"core_log": {{ "core_log": {{
"type": "controller", "type": "controller",
@ -58,7 +63,8 @@ def process_header(output, description):
""").format( """).format(
variant=description["variant"], variant=description["variant"],
core_addr=description["core_addr"], core_addr=description["core_addr"],
ref_period=1/(8*description["rtio_frequency"])), ref_period=1/(8*description["rtio_frequency"]),
cpu_target=cpu_target),
file=output) file=output)
@ -513,7 +519,7 @@ class PeripheralManager:
processor = getattr(self, "process_"+str(peripheral["type"])) processor = getattr(self, "process_"+str(peripheral["type"]))
return processor(rtio_offset, peripheral) return processor(rtio_offset, peripheral)
def add_sfp_leds(self, rtio_offset): def add_board_leds(self, rtio_offset):
for i in range(2): for i in range(2):
self.gen(""" self.gen("""
device_db["{name}"] = {{ device_db["{name}"] = {{
@ -544,8 +550,10 @@ def process(output, master_description, satellites):
for peripheral in master_description["peripherals"]: for peripheral in master_description["peripherals"]:
n_channels = pm.process(rtio_offset, peripheral) n_channels = pm.process(rtio_offset, peripheral)
rtio_offset += n_channels rtio_offset += n_channels
if base == "standalone" and master_description["hw_rev"] in ("v1.0", "v1.1"): kasli_with_leds = (master_description["target"] == "kasli" and master_description["hw_rev"] in ("v1.0", "v1.1"))
n_channels = pm.add_sfp_leds(rtio_offset) kasli_soc = master_description["target"] == "kasli_soc"
if base == "standalone" and kasli_with_leds or kasli_soc:
n_channels = pm.add_board_leds(rtio_offset)
rtio_offset += n_channels rtio_offset += n_channels
for destination, description in satellites: for destination, description in satellites: