This commit is contained in:
abdul124 2024-07-12 09:58:33 +08:00
parent d658d9b00e
commit 31a8b17a84
3 changed files with 1167 additions and 295 deletions

View File

@ -160,8 +160,10 @@
cargo-insta
clippy
pre-commit
rustfmt
rust-analyzer
];
# https://nixos.wiki/wiki/Rust#Shell.nix_example
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
devShells.x86_64-linux.msys2 = pkgs.mkShell {
name = "nac3-dev-shell-msys2";

View File

@ -1,26 +1,46 @@
from numpy import int64
from min_artiq import *
@nac3
class A:
pass
@nac3
class B(A):
pass
@nac3
class C(B):
pass
@kernel
def test():
pass
@nac3
class Demo:
core: KernelInvariant[Core]
led0: KernelInvariant[TTLOut]
led1: KernelInvariant[TTLOut]
core: Kernel[Core]
led0: Kernel[TTLOut]
optt: Kernel[float]
t_mu: Kernel[int64]
def __init__(self):
self.core = Core()
self.led0 = TTLOut(self.core, 18)
self.led1 = TTLOut(self.core, 19)
self.optt = 0.0
self.t_mu = int64(0)
@kernel
def set_time_kernel(self, t: float):
self.optt = t
self.t_mu = self.core.seconds_to_mu(self.optt)
@kernel
def run(self):
self.core.reset()
while True:
with parallel:
self.led0.pulse(100.*ms)
self.led1.pulse(100.*ms)
self.core.delay(100.*ms)
for t in [20.*us, 15.*us, 10.*us, 5.*us, 2.*us, 1.*us]:
self.set_time_kernel(t)
self.core.reset()
for _ in range(10000):
self.led0.pulse(self.optt)
if __name__ == "__main__":
Demo().run()
Demo().run()

File diff suppressed because it is too large Load Diff