2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-19 00:16:29 +08:00

sinara_tester: break apart legacyalmazy, add almazny tests

This commit is contained in:
mwojcik 2024-05-30 11:31:02 +08:00 committed by Sébastien Bourdeauducq
parent 793f8a3c8c
commit 20c67aca23

View File

@ -61,6 +61,7 @@ class SinaraTester(EnvExperiment):
self.mirnies = dict() self.mirnies = dict()
self.suservos = dict() self.suservos = dict()
self.suschannels = dict() self.suschannels = dict()
self.legacy_almaznys = dict()
self.almaznys = dict() self.almaznys = dict()
self.shuttler = dict() self.shuttler = dict()
@ -101,6 +102,8 @@ class SinaraTester(EnvExperiment):
elif (module, cls) == ("artiq.coredevice.suservo", "Channel"): elif (module, cls) == ("artiq.coredevice.suservo", "Channel"):
self.suschannels[name] = self.get_device(name) self.suschannels[name] = self.get_device(name)
elif (module, cls) == ("artiq.coredevice.almazny", "AlmaznyLegacy"): elif (module, cls) == ("artiq.coredevice.almazny", "AlmaznyLegacy"):
self.legacy_almaznys[name] = self.get_device(name)
elif (module, cls) == ("artiq.coredevice.almazny", "AlmaznyChannel"):
self.almaznys[name] = self.get_device(name) self.almaznys[name] = self.get_device(name)
elif (module, cls) == ("artiq.coredevice.shuttler", "Config"): elif (module, cls) == ("artiq.coredevice.shuttler", "Config"):
shuttler_name = name.replace("_config", "") shuttler_name = name.replace("_config", "")
@ -370,36 +373,35 @@ class SinaraTester(EnvExperiment):
channel.pulse(100*ms) channel.pulse(100*ms)
delay(100*ms) delay(100*ms)
@kernel @kernel
def init_almazny(self, almazny): def init_legacy_almazny(self, almazny):
self.core.break_realtime() self.core.break_realtime()
almazny.init() almazny.init()
almazny.output_toggle(True) almazny.output_toggle(True)
@kernel @kernel
def almazny_set_attenuators_mu(self, almazny, ch, atts): def legacy_almazny_set_attenuators_mu(self, almazny, ch, atts):
self.core.break_realtime() self.core.break_realtime()
almazny.set_att_mu(ch, atts) almazny.set_att_mu(ch, atts)
@kernel @kernel
def almazny_set_attenuators(self, almazny, ch, atts): def legacy_almazny_set_attenuators(self, almazny, ch, atts):
self.core.break_realtime() self.core.break_realtime()
almazny.set_att(ch, atts) almazny.set_att(ch, atts)
@kernel @kernel
def almazny_toggle_output(self, almazny, rf_on): def legacy_almazny_toggle_output(self, almazny, rf_on):
self.core.break_realtime() self.core.break_realtime()
almazny.output_toggle(rf_on) almazny.output_toggle(rf_on)
def test_almaznys(self): def test_legacy_almaznys(self):
print("*** Testing Almaznys.") print("*** Testing legacy Almaznys (v1.1 or older).")
for name, almazny in sorted(self.almaznys.items(), key=lambda x: x[0]): for name, almazny in sorted(self.legacy_almaznys.items(), key=lambda x: x[0]):
print(name + "...") print(name + "...")
print("Initializing Mirny CPLDs...") print("Initializing Mirny CPLDs...")
for name, cpld in sorted(self.mirny_cplds.items(), key=lambda x: x[0]): for name, cpld in sorted(self.mirny_cplds.items(), key=lambda x: x[0]):
print(name + "...") print(name + "...")
self.init_mirny(cpld) self.init_mirny(cpld)
print("...done") print("...done")
print("Testing attenuators. Frequencies:") print("Testing attenuators. Frequencies:")
for card_n, channels in enumerate(chunker(self.mirnies, 4)): for card_n, channels in enumerate(chunker(self.mirnies, 4)):
for channel_n, (channel_name, channel_dev) in enumerate(channels): for channel_n, (channel_name, channel_dev) in enumerate(channels):
@ -407,31 +409,68 @@ class SinaraTester(EnvExperiment):
print("{}\t{}MHz".format(channel_name, frequency*2)) print("{}\t{}MHz".format(channel_name, frequency*2))
self.setup_mirny(channel_dev, frequency) self.setup_mirny(channel_dev, frequency)
print("{} info: {}".format(channel_name, channel_dev.info())) print("{} info: {}".format(channel_name, channel_dev.info()))
self.init_almazny(almazny) self.init_legacy_almazny(almazny)
print("RF ON, all attenuators ON. Press ENTER when done.") print("RF ON, all attenuators ON. Press ENTER when done.")
for i in range(4): for i in range(4):
self.almazny_set_attenuators_mu(almazny, i, 63) self.legacy_almazny_set_attenuators_mu(almazny, i, 63)
input() input()
print("RF ON, half power attenuators ON. Press ENTER when done.") print("RF ON, half power attenuators ON. Press ENTER when done.")
for i in range(4): for i in range(4):
self.almazny_set_attenuators(almazny, i, 15.5) self.legacy_almazny_set_attenuators(almazny, i, 15.5)
input() input()
print("RF ON, all attenuators OFF. Press ENTER when done.") print("RF ON, all attenuators OFF. Press ENTER when done.")
for i in range(4): for i in range(4):
self.almazny_set_attenuators(almazny, i, 0) self.legacy_almazny_set_attenuators(almazny, i, 0)
input() input()
print("SR outputs are OFF. Press ENTER when done.") print("SR outputs are OFF. Press ENTER when done.")
self.almazny_toggle_output(almazny, False) self.legacy_almazny_toggle_output(almazny, False)
input() input()
print("RF ON, all attenuators are ON. Press ENTER when done.") print("RF ON, all attenuators are ON. Press ENTER when done.")
for i in range(4): for i in range(4):
self.almazny_set_attenuators(almazny, i, 31.5) self.legacy_almazny_set_attenuators(almazny, i, 31.5)
self.almazny_toggle_output(almazny, True) self.legacy_almazny_toggle_output(almazny, True)
input() input()
print("RF OFF. Press ENTER when done.") print("RF OFF. Press ENTER when done.")
self.almazny_toggle_output(almazny, False) self.legacy_almazny_toggle_output(almazny, False)
input() input()
def almazny_led_wave(self, almaznys):
while not is_enter_pressed():
self.core.break_realtime()
# do not fill the FIFOs too much to avoid long response times
t = now_mu() - self.core.seconds_to_mu(0.2)
while self.core.get_rtio_counter_mu() < t:
pass
for almazny in almaznys:
almazny.set(31.5, False, True)
delay(100*ms)
almazny.set(31.5, False, False)
def almazny_set_att_all(self, almaznys, att):
for almazny in almaznys:
almazny.set(att, False, True)
def test_almaznys(self):
print("*** Testing Almaznys (v1.2+).")
print("Initializing Mirny CPLDs...")
for name, cpld in sorted(self.mirny_cplds.items(), key=lambda x: x[0]):
print(name + "...")
self.init_mirny(cpld)
print("...done")
print("Frequencies:")
for card_n, channels in enumerate(chunker(self.mirnies, 4)):
for channel_n, (channel_name, channel_dev) in enumerate(channels):
frequency = 2000 + card_n * 250 + channel_n * 50
print("{}\t{}MHz".format(channel_name, frequency*2))
self.setup_mirny(channel_dev, frequency)
print("RF On, half power attenuators ON. Press ENTER when done.")
self.almazny_set_att_all(self.almaznys, 15.5)
input()
print("RF On, all attenuators ON. Press ENTER when done.")
self.almazny_set_att_all(self.almaznys, 31.5)
print("RF Off, testing LEDs. Press ENTER when done.")
self.almazny_led_wave(self.almaznys)
def test_mirnies(self): def test_mirnies(self):
print("*** Testing Mirny PLLs.") print("*** Testing Mirny PLLs.")