From 2cf144a60ccca1f1306f6c422c0450967c98fb67 Mon Sep 17 00:00:00 2001 From: Leon Riesebos Date: Fri, 3 Sep 2021 18:03:52 -0400 Subject: [PATCH] ddb_template: edge counter keys correspond with according ttl keys previously ttl_counter_0 and ttl_0 could be on completely different physical ttl output channels with this change, ttl_0_counter (note the changed key format) is always on the same channel as ttl_0 Signed-off-by: Leon Riesebos --- RELEASE_NOTES.rst | 2 ++ artiq/frontend/artiq_ddb_template.py | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index e011739d8..390665643 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -22,6 +22,8 @@ Highlights: * ``get()``, ``get_mu()``, ``get_att()``, and ``get_att_mu()`` functions added for AD9910 and AD9912 * New hardware support: - HVAMP_8CH 8 channel HV amplifier for Fastino / Zotino +* ``artiq_ddb_template`` generates edge-counter keys that start with the key of the corresponding + TTL device (e.g. ``"ttl_0_counter"`` for the edge counter on TTL device``"ttl_0"``) Breaking changes: diff --git a/artiq/frontend/artiq_ddb_template.py b/artiq/frontend/artiq_ddb_template.py index 98b4bd5b9..c73680c8e 100755 --- a/artiq/frontend/artiq_ddb_template.py +++ b/artiq/frontend/artiq_ddb_template.py @@ -82,7 +82,7 @@ class PeripheralManager: def gen(self, string, **kwargs): print(textwrap.dedent(string).format(**kwargs), file=self.output) - def process_dio(self, rtio_offset, peripheral): + def process_dio(self, rtio_offset, peripheral, num_channels=8): class_names = { "input": "TTLInOut", "output": "TTLOut" @@ -92,7 +92,8 @@ class PeripheralManager: class_names[peripheral["bank_direction_high"]] ] channel = count(0) - for i in range(8): + name = [self.get_name("ttl") for _ in range(num_channels)] + for i in range(num_channels): self.gen(""" device_db["{name}"] = {{ "type": "local", @@ -101,23 +102,23 @@ class PeripheralManager: "arguments": {{"channel": 0x{channel:06x}}}, }} """, - name=self.get_name("ttl"), - class_name=classes[i//4], - channel=rtio_offset+next(channel)) + name=name[i], + class_name=classes[i // 4], + channel=rtio_offset + next(channel)) if peripheral.get("edge_counter", False): - for i in range(8): - class_name = classes[i//4] + for i in range(num_channels): + class_name = classes[i // 4] if class_name == "TTLInOut": self.gen(""" - device_db["{name}"] = {{ + device_db["{name}_counter"] = {{ "type": "local", "module": "artiq.coredevice.edge_counter", "class": "EdgeCounter", "arguments": {{"channel": 0x{channel:06x}}}, }} """, - name=self.get_name("ttl_counter"), - channel=rtio_offset+next(channel)) + name=name[i], + channel=rtio_offset + next(channel)) return next(channel) def process_urukul(self, rtio_offset, peripheral):