88 lines
1.6 KiB
Python
88 lines
1.6 KiB
Python
from min_artiq import *
|
|
from numpy import int32
|
|
|
|
|
|
# @nac3
|
|
# class A:
|
|
# a: int32
|
|
# core: KernelInvariant[Core]
|
|
|
|
# def __init__(self, a: int32):
|
|
# self.core = Core()
|
|
# self.a = a
|
|
|
|
# @kernel
|
|
# def output_all_fields(self):
|
|
# #print(self.a)
|
|
# pass
|
|
|
|
# @kernel
|
|
# def set_a(self, a: int32):
|
|
# self.a = a
|
|
|
|
# @nac3
|
|
# class B(A):
|
|
# b: int32
|
|
|
|
# def __init__(self, b: int32):
|
|
# # A.__init__(self, b + 1)
|
|
# self.core = Core()
|
|
# self.a = b
|
|
# self.b = b
|
|
# self.set_b(b)
|
|
|
|
# @kernel
|
|
# def output_parent_fields(self):
|
|
# # A.output_all_fields(self)
|
|
# pass
|
|
|
|
# @kernel
|
|
# def output_all_fields(self):
|
|
# # A.output_all_fields(self)
|
|
# pass
|
|
# #print(self.b)
|
|
|
|
# @kernel
|
|
# def set_b(self, b: int32):
|
|
# self.b = b
|
|
|
|
@nac3
|
|
class C:
|
|
c: Kernel[int32]
|
|
a: Kernel[int32]
|
|
b: Kernel[int32]
|
|
core: KernelInvariant[Core]
|
|
|
|
def __init__(self, c: int32):
|
|
# B.__init__(self, c + 1)
|
|
self.core = Core()
|
|
self.a = c
|
|
self.b = c
|
|
self.c = c
|
|
|
|
@kernel
|
|
def output_parent_fields(self):
|
|
# B.output_all_fields(self)
|
|
pass
|
|
|
|
@kernel
|
|
def output_all_fields(self):
|
|
# B.output_all_fields(self)
|
|
#print(self.c)
|
|
pass
|
|
|
|
@kernel
|
|
def set_c(self, c: int32):
|
|
self.c = c
|
|
|
|
@kernel
|
|
def run(self):
|
|
self.output_all_fields()
|
|
# self.set_a(1)
|
|
# self.set_b(2)
|
|
self.set_c(3)
|
|
self.output_all_fields()
|
|
|
|
if __name__ == "__main__":
|
|
C(10).run()
|