diff --git a/artiq/frontend/artiq_ddb_template.py b/artiq/frontend/artiq_ddb_template.py index 239c0ac241..89c062eaa5 100755 --- a/artiq/frontend/artiq_ddb_template.py +++ b/artiq/frontend/artiq_ddb_template.py @@ -140,7 +140,7 @@ def process_dio(self, rtio_offset, peripheral, num_channels=8): class_names[peripheral["bank_direction_high"]] ] channel = count(0) - board = peripheral["board"].lower() if "board" in peripheral else "" + board = peripheral["board"] if "board" in peripheral else "" name = [self.get_name("ttl") for _ in range(num_channels)] for i in range(num_channels): self.gen(""" diff --git a/artiq/frontend/artiq_sinara_tester.py b/artiq/frontend/artiq_sinara_tester.py index 53ba2b3d12..135af90778 100755 --- a/artiq/frontend/artiq_sinara_tester.py +++ b/artiq/frontend/artiq_sinara_tester.py @@ -50,7 +50,7 @@ def build(self): self.leds = dict() self.ttl_outs = dict() self.ttl_ins = dict() - self.ttl_lvds_outs = dict() + self.ttl_lvds = dict() self.ttl_lvds_ins = dict() self.urukul_cplds = dict() self.urukuls = dict() @@ -75,12 +75,12 @@ def build(self): dev = self.get_device(name) if "led" in name: # guess self.leds[name] = dev - elif "board" in desc and desc["board"] == "dio_lvds": - self.ttl_lvds_outs[name] = self.get_device(name) + elif "board" in desc and desc["board"].lower() == "dio_lvds": + self.ttl_lvds[name] = self.get_device(name) else: self.ttl_outs[name] = dev elif (module, cls) == ("artiq.coredevice.ttl", "TTLInOut"): - if "board" in desc and desc["board"] == "dio_lvds": + if "board" in desc and desc["board"].lower() == "dio_lvds": self.ttl_lvds_ins[name] = self.get_device(name) else: self.ttl_ins[name] = self.get_device(name) @@ -163,7 +163,7 @@ def build(self): self.ttl_outs = sorted(self.ttl_outs.items(), key=lambda x: x[1].channel) self.ttl_ins = sorted(self.ttl_ins.items(), key=lambda x: x[1].channel) self.ttl_lvds_ins = sorted(self.ttl_lvds_ins.items(), key=lambda x: x[1].channel) - self.ttl_lvds_outs = sorted(self.ttl_lvds_outs.items(), key=lambda x: x[1].channel) + self.ttl_lvds = sorted(self.ttl_lvds.items(), key=lambda x: x[1].channel) self.urukuls = sorted(self.urukuls.items(), key=lambda x: (x[1].cpld.bus.channel, x[1].chip_select)) self.samplers = sorted(self.samplers.items(), key=lambda x: x[1].cnv.channel) self.zotinos = sorted(self.zotinos.items(), key=lambda x: x[1].bus.channel) @@ -268,21 +268,23 @@ def devices_to_string(chunk): else: print("FAILED") - def test_ttl_lvds_outs(self): + def test_ttl_lvds(self): def lower_bound_of_device_chunk(dev_list, dev_name, N): dev_index = next(i for i, v in enumerate(dev_list) if v[0] == dev_name) return dev_index - (dev_index % N) print(f"*** Testing LVDS TTL") - if len(self.ttl_lvds_ins) == 0: + if not self.ttl_lvds_ins: print(f"No available input channels for testing. Skipping...") return - ttl_in_index, ttl_out_index = 0, 0 + ttl_in_index, ttl_out_index = 0, -1 default_ttl_in_name, _ = self.ttl_lvds_ins[ttl_in_index] - default_ttl_out_name, _ = self.ttl_lvds_outs[ttl_out_index] + default_ttl_out_name, _ = self.ttl_lvds[ttl_out_index] + print("LVDS TTL channels are tested in groups of 4.") + print("You can choose any channel within the group.") ttl_in_name = input(f"TTL device to use as an input (default: {default_ttl_in_name}): ") ttl_out_name = input(f"TTL device to use as an output (default: {default_ttl_out_name}): ") @@ -292,18 +294,18 @@ def lower_bound_of_device_chunk(dev_list, dev_name, N): ttl_out_name = default_ttl_out_name ttl_in_index = lower_bound_of_device_chunk(self.ttl_lvds_ins, ttl_in_name, 4) - ttl_out_index = lower_bound_of_device_chunk(self.ttl_lvds_outs, ttl_out_name, 4) + ttl_out_index = lower_bound_of_device_chunk(self.ttl_lvds, ttl_out_name, 4) ttl_in_static_chunk = self.ttl_lvds_ins[ttl_in_index: ttl_in_index + 4] - ttl_out_static_chunk = self.ttl_lvds_outs[ttl_out_index: ttl_out_index + 4] - - print("LVDS TTL channels are tested in groups of 4.") - print("\nTesting output channels. Keep input group connected in the same slot, and cycle through all outputs.") + ttl_out_static_chunk = self.ttl_lvds[ttl_out_index: ttl_out_index + 4] - for ttl_out_moving_chunk in chunker(self.ttl_lvds_outs, 4): + print("\nTesting output channels. Keep input group connected in the same port, and cycle through all outputs.") + for ttl_out_moving_chunk in chunker(self.ttl_lvds, 4): self.test_lvds_group(ttl_out_moving_chunk, ttl_in_static_chunk) - print("\nTesting input channels. Keep output group connected in the same slot, and cycle through all inputs.") + if len(self.ttl_lvds_ins) == 4: + return + print("\nTesting input channels. Keep output group connected in the same port, and cycle through all inputs.") for ttl_in_moving_chunk in chunker(self.ttl_lvds_ins, 4): if not ttl_in_moving_chunk == ttl_in_static_chunk: self.test_lvds_group(ttl_out_static_chunk, ttl_in_moving_chunk)