examples: Fix DRTIO destination indices (#1231)

Using the default routing table, links numbers and destinations
are offset by 1, as destination 0 is local RTIO.
This commit is contained in:
David Nadlinger 2019-01-09 03:40:15 +00:00 committed by Sébastien Bourdeauducq
parent 40370c4d45
commit 101ed5d534
3 changed files with 21 additions and 7 deletions

View File

@ -6,12 +6,18 @@ class Sines2Sayma(EnvExperiment):
self.setattr_device("core") self.setattr_device("core")
self.sawgs = [self.get_device("sawg"+str(i)) for i in range(16)] self.sawgs = [self.get_device("sawg"+str(i)) for i in range(16)]
@kernel
def drtio_is_up(self):
for i in range(3):
if not self.core.get_rtio_destination_status(i):
return False
return True
@kernel @kernel
def run(self): def run(self):
while True: while True:
print("waiting for DRTIO ready...") print("waiting for DRTIO ready...")
while not (self.core.get_rtio_destination_status(0) and while not self.drtio_is_up():
self.core.get_rtio_destination_status(1)):
pass pass
print("OK") print("OK")
@ -27,5 +33,5 @@ class Sines2Sayma(EnvExperiment):
# Do not use a sub-multiple of oscilloscope sample rates. # Do not use a sub-multiple of oscilloscope sample rates.
sawg.frequency0.set(9*MHz) sawg.frequency0.set(9*MHz)
while self.core.get_rtio_destination_status(0) and self.core.get_rtio_destination_status(1): while self.drtio_is_up():
pass pass

View File

@ -8,6 +8,13 @@ class SinesUrukulSayma(EnvExperiment):
self.urukul_chs = [self.get_device("urukul0_ch" + str(i)) for i in range(4)] self.urukul_chs = [self.get_device("urukul0_ch" + str(i)) for i in range(4)]
self.sawgs = [self.get_device("sawg"+str(i)) for i in range(8)] self.sawgs = [self.get_device("sawg"+str(i)) for i in range(8)]
@kernel
def drtio_is_up(self):
for i in range(2):
if not self.core.get_rtio_destination_status(i):
return False
return True
@kernel @kernel
def run(self): def run(self):
# Note: when testing sync, do not reboot Urukul, as it is not # Note: when testing sync, do not reboot Urukul, as it is not
@ -23,7 +30,7 @@ class SinesUrukulSayma(EnvExperiment):
while True: while True:
print("waiting for DRTIO ready...") print("waiting for DRTIO ready...")
while not self.core.get_rtio_destination_status(0): while not self.drtio_is_up():
pass pass
print("OK") print("OK")
@ -38,5 +45,5 @@ class SinesUrukulSayma(EnvExperiment):
sawg.amplitude1.set(.4) sawg.amplitude1.set(.4)
sawg.frequency0.set(9*MHz) sawg.frequency0.set(9*MHz)
while self.core.get_rtio_destination_status(0): while self.drtio_is_up():
pass pass

View File

@ -10,8 +10,9 @@ class SAWGTestDRTIO(EnvExperiment):
@kernel @kernel
def run(self): def run(self):
core_log("waiting for DRTIO ready...") core_log("waiting for DRTIO ready...")
while not self.core.get_rtio_destination_status(0): for i in range(3):
pass while not self.core.get_rtio_destination_status(i):
pass
core_log("OK") core_log("OK")
self.core.reset() self.core.reset()