mirror of
https://github.com/m-labs/artiq.git
synced 2025-01-23 17:08:12 +08:00
Default output channel to last one, polish prompts
If output channel is last, then there is one ports movement less Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
parent
3cc58370f7
commit
6365287df3
@ -140,7 +140,7 @@ class PeripheralManager:
|
|||||||
class_names[peripheral["bank_direction_high"]]
|
class_names[peripheral["bank_direction_high"]]
|
||||||
]
|
]
|
||||||
channel = count(0)
|
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)]
|
name = [self.get_name("ttl") for _ in range(num_channels)]
|
||||||
for i in range(num_channels):
|
for i in range(num_channels):
|
||||||
self.gen("""
|
self.gen("""
|
||||||
|
@ -50,7 +50,7 @@ class SinaraTester(EnvExperiment):
|
|||||||
self.leds = dict()
|
self.leds = dict()
|
||||||
self.ttl_outs = dict()
|
self.ttl_outs = dict()
|
||||||
self.ttl_ins = dict()
|
self.ttl_ins = dict()
|
||||||
self.ttl_lvds_outs = dict()
|
self.ttl_lvds = dict()
|
||||||
self.ttl_lvds_ins = dict()
|
self.ttl_lvds_ins = dict()
|
||||||
self.urukul_cplds = dict()
|
self.urukul_cplds = dict()
|
||||||
self.urukuls = dict()
|
self.urukuls = dict()
|
||||||
@ -75,12 +75,12 @@ class SinaraTester(EnvExperiment):
|
|||||||
dev = self.get_device(name)
|
dev = self.get_device(name)
|
||||||
if "led" in name: # guess
|
if "led" in name: # guess
|
||||||
self.leds[name] = dev
|
self.leds[name] = dev
|
||||||
elif "board" in desc and desc["board"] == "dio_lvds":
|
elif "board" in desc and desc["board"].lower() == "dio_lvds":
|
||||||
self.ttl_lvds_outs[name] = self.get_device(name)
|
self.ttl_lvds[name] = self.get_device(name)
|
||||||
else:
|
else:
|
||||||
self.ttl_outs[name] = dev
|
self.ttl_outs[name] = dev
|
||||||
elif (module, cls) == ("artiq.coredevice.ttl", "TTLInOut"):
|
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)
|
self.ttl_lvds_ins[name] = self.get_device(name)
|
||||||
else:
|
else:
|
||||||
self.ttl_ins[name] = self.get_device(name)
|
self.ttl_ins[name] = self.get_device(name)
|
||||||
@ -163,7 +163,7 @@ class SinaraTester(EnvExperiment):
|
|||||||
self.ttl_outs = sorted(self.ttl_outs.items(), key=lambda x: x[1].channel)
|
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_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_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.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.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)
|
self.zotinos = sorted(self.zotinos.items(), key=lambda x: x[1].bus.channel)
|
||||||
@ -268,21 +268,23 @@ class SinaraTester(EnvExperiment):
|
|||||||
else:
|
else:
|
||||||
print("FAILED")
|
print("FAILED")
|
||||||
|
|
||||||
def test_ttl_lvds_outs(self):
|
def test_ttl_lvds(self):
|
||||||
def lower_bound_of_device_chunk(dev_list, dev_name, N):
|
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)
|
dev_index = next(i for i, v in enumerate(dev_list) if v[0] == dev_name)
|
||||||
return dev_index - (dev_index % N)
|
return dev_index - (dev_index % N)
|
||||||
|
|
||||||
print(f"*** Testing LVDS TTL")
|
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...")
|
print(f"No available input channels for testing. Skipping...")
|
||||||
return
|
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_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_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}): ")
|
ttl_out_name = input(f"TTL device to use as an output (default: {default_ttl_out_name}): ")
|
||||||
|
|
||||||
@ -292,18 +294,18 @@ class SinaraTester(EnvExperiment):
|
|||||||
ttl_out_name = default_ttl_out_name
|
ttl_out_name = default_ttl_out_name
|
||||||
|
|
||||||
ttl_in_index = lower_bound_of_device_chunk(self.ttl_lvds_ins, ttl_in_name, 4)
|
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_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]
|
ttl_out_static_chunk = self.ttl_lvds[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 port, and cycle through all outputs.")
|
||||||
print("\nTesting output channels. Keep input group connected in the same slot, and cycle through all outputs.")
|
for ttl_out_moving_chunk in chunker(self.ttl_lvds, 4):
|
||||||
|
|
||||||
for ttl_out_moving_chunk in chunker(self.ttl_lvds_outs, 4):
|
|
||||||
self.test_lvds_group(ttl_out_moving_chunk, ttl_in_static_chunk)
|
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):
|
for ttl_in_moving_chunk in chunker(self.ttl_lvds_ins, 4):
|
||||||
if not ttl_in_moving_chunk == ttl_in_static_chunk:
|
if not ttl_in_moving_chunk == ttl_in_static_chunk:
|
||||||
self.test_lvds_group(ttl_out_static_chunk, ttl_in_moving_chunk)
|
self.test_lvds_group(ttl_out_static_chunk, ttl_in_moving_chunk)
|
||||||
|
Loading…
Reference in New Issue
Block a user