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 <leon.riesebos@duke.edu>
This commit is contained in:
Leon Riesebos 2021-09-03 18:03:52 -04:00 committed by Sébastien Bourdeauducq
parent e7a46ec767
commit 2cf144a60c
2 changed files with 13 additions and 10 deletions

View File

@ -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:

View File

@ -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):