From 86f462f40e32fc281b4254959511cd42f27f8b56 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 9 May 2019 17:20:13 +0800 Subject: [PATCH] artiq_ddb_template: add edge counter support --- artiq/frontend/artiq_ddb_template.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/artiq/frontend/artiq_ddb_template.py b/artiq/frontend/artiq_ddb_template.py index ecf2ea01d..d96f8c3cb 100755 --- a/artiq/frontend/artiq_ddb_template.py +++ b/artiq/frontend/artiq_ddb_template.py @@ -83,6 +83,7 @@ class PeripheralManager: class_names[peripheral["bank_direction_low"]], class_names[peripheral["bank_direction_high"]] ] + channel = count(0) for i in range(8): self.gen(""" device_db["{name}"] = {{ @@ -94,8 +95,22 @@ class PeripheralManager: """, name=self.get_name("ttl"), class_name=classes[i//4], - channel=rtio_offset+i) - return 8 + channel=rtio_offset+next(channel)) + if peripheral.get("edge_counter", False): + for i in range(8): + class_name = classes[i//4] + if class_name == "TTLInOut": + self.gen(""" + device_db["{name}"] = {{ + "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)) + return next(channel) # TODO: support 1-EEM mode def process_urukul(self, rtio_offset, peripheral):