2021-10-08 23:41:41 +08:00
|
|
|
from min_artiq import *
|
2025-01-09 17:40:13 +08:00
|
|
|
from numpy import int32
|
|
|
|
import string_attribute_issue337
|
|
|
|
import support_class_attr_issue102
|
|
|
|
import support_class_attr_issue102 as issue102
|
|
|
|
import string_attribute_issue337 as issue337
|
2022-02-21 17:52:34 +08:00
|
|
|
|
2025-01-09 17:40:13 +08:00
|
|
|
# gvar22: int32 = 22
|
|
|
|
@nac3
|
|
|
|
class Test:
|
|
|
|
attr1: KernelInvariant[int32] = 2
|
|
|
|
attr2: int32 = 4
|
|
|
|
attr3: Kernel[int32]
|
|
|
|
|
|
|
|
@kernel
|
|
|
|
def __init__(self):
|
|
|
|
self.attr3 = 8
|
|
|
|
|
|
|
|
@kernel
|
|
|
|
def run(self) -> int32:
|
|
|
|
# global gvar22
|
|
|
|
gvar22 = 10
|
|
|
|
self.attr3 = 1
|
|
|
|
return self.attr3
|
2022-02-21 17:52:34 +08:00
|
|
|
|
2021-11-05 18:07:43 +08:00
|
|
|
@nac3
|
2021-10-08 23:41:41 +08:00
|
|
|
class Demo:
|
2021-11-06 22:50:28 +08:00
|
|
|
core: KernelInvariant[Core]
|
|
|
|
led0: KernelInvariant[TTLOut]
|
|
|
|
led1: KernelInvariant[TTLOut]
|
2021-09-25 14:17:11 +08:00
|
|
|
|
2021-10-08 23:41:41 +08:00
|
|
|
def __init__(self):
|
|
|
|
self.core = Core()
|
2021-11-05 18:07:18 +08:00
|
|
|
self.led0 = TTLOut(self.core, 18)
|
|
|
|
self.led1 = TTLOut(self.core, 19)
|
2020-12-18 23:44:45 +08:00
|
|
|
|
|
|
|
@kernel
|
2021-11-06 18:41:59 +08:00
|
|
|
def run(self):
|
2025-01-09 17:40:13 +08:00
|
|
|
# global gvar22
|
|
|
|
# issue337.Demo().run()
|
|
|
|
a = Test()
|
|
|
|
|
|
|
|
a.run()
|
|
|
|
Test.attr1
|
|
|
|
# g = gvar22
|
|
|
|
e = issue337.myTest()
|
|
|
|
f = e.run()
|
|
|
|
f = f + 1
|
|
|
|
# g = gvar22
|
|
|
|
b = issue102.fun2smn()
|
|
|
|
c = string_attribute_issue337.fn1_dosmn()
|
|
|
|
d = issue337.fn1_dosmn()
|
|
|
|
|
|
|
|
# self.core.reset()
|
|
|
|
# while True:
|
|
|
|
# with parallel:
|
|
|
|
# self.led0.pulse(100.*ms)
|
|
|
|
# self.led1.pulse(100.*ms)
|
|
|
|
# self.core.delay(100.*ms)
|
2020-12-18 23:44:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-10-10 17:45:38 +08:00
|
|
|
Demo().run()
|