2014-09-30 17:38:02 +08:00
|
|
|
from artiq import *
|
2014-05-31 00:20:13 +08:00
|
|
|
|
2014-09-05 12:03:22 +08:00
|
|
|
|
2014-06-17 03:39:33 +08:00
|
|
|
my_range = range
|
|
|
|
|
2014-09-05 12:03:22 +08:00
|
|
|
|
2014-08-13 18:30:57 +08:00
|
|
|
class CompilerTest(AutoContext):
|
2014-09-05 12:03:22 +08:00
|
|
|
parameters = "a b A B"
|
|
|
|
|
|
|
|
def print_done(self):
|
|
|
|
print("Done!")
|
|
|
|
|
|
|
|
def set_some_slowdev(self, n):
|
|
|
|
print("Slow device setting: {}".format(n))
|
|
|
|
|
|
|
|
@kernel
|
|
|
|
def run(self, n, t2):
|
|
|
|
for i in my_range(n):
|
|
|
|
self.set_some_slowdev(i)
|
|
|
|
delay(100*ms)
|
|
|
|
with parallel:
|
|
|
|
with sequential:
|
|
|
|
for j in my_range(3):
|
|
|
|
self.a.pulse((j+1)*100*MHz, 20*us)
|
|
|
|
self.b.pulse(100*MHz, t2)
|
|
|
|
with sequential:
|
|
|
|
self.A.pulse(100*MHz, 10*us)
|
|
|
|
self.B.pulse(100*MHz, t2)
|
|
|
|
self.print_done()
|
|
|
|
|
2014-05-31 00:20:13 +08:00
|
|
|
|
2014-10-05 16:24:21 +08:00
|
|
|
def main():
|
2014-09-05 12:03:22 +08:00
|
|
|
from artiq.devices import corecom_dummy, core, dds_core
|
|
|
|
|
|
|
|
coredev = core.Core(corecom_dummy.CoreCom())
|
|
|
|
exp = CompilerTest(
|
|
|
|
core=coredev,
|
|
|
|
a=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
|
2014-10-16 23:36:28 +08:00
|
|
|
reg_channel=0, rtio_switch=0),
|
2014-09-05 12:03:22 +08:00
|
|
|
b=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
|
2014-10-16 23:36:28 +08:00
|
|
|
reg_channel=1, rtio_switch=1),
|
2014-09-05 12:03:22 +08:00
|
|
|
A=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
|
2014-10-16 23:36:28 +08:00
|
|
|
reg_channel=2, rtio_switch=2),
|
2014-09-05 12:03:22 +08:00
|
|
|
B=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
|
2014-10-16 23:36:28 +08:00
|
|
|
reg_channel=3, rtio_switch=3)
|
2014-09-05 12:03:22 +08:00
|
|
|
)
|
|
|
|
exp.run(3, 100*us)
|
2014-10-05 16:24:21 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|