forked from M-Labs/nac3
demo: add more syscalls and features
This commit is contained in:
parent
7ab2114882
commit
7ab762a174
@ -2,6 +2,21 @@ from language import *
|
|||||||
from numpy import int32, int64
|
from numpy import int32, int64
|
||||||
|
|
||||||
|
|
||||||
|
@syscall
|
||||||
|
def now_mu() -> int64:
|
||||||
|
raise NotImplementedError("syscall not simulated")
|
||||||
|
|
||||||
|
|
||||||
|
@syscall
|
||||||
|
def at_mu(t: int64):
|
||||||
|
raise NotImplementedError("syscall not simulated")
|
||||||
|
|
||||||
|
|
||||||
|
@syscall
|
||||||
|
def delay_mu(dt: int64):
|
||||||
|
raise NotImplementedError("syscall not simulated")
|
||||||
|
|
||||||
|
|
||||||
@syscall
|
@syscall
|
||||||
def rtio_init():
|
def rtio_init():
|
||||||
raise NotImplementedError("syscall not simulated")
|
raise NotImplementedError("syscall not simulated")
|
||||||
@ -26,11 +41,27 @@ def rtio_input_timestamp(timeout_mu: int64, channel: int32) -> int64:
|
|||||||
def rtio_input_data(channel: int32) -> int32:
|
def rtio_input_data(channel: int32) -> int32:
|
||||||
raise NotImplementedError("syscall not simulated")
|
raise NotImplementedError("syscall not simulated")
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
class Core:
|
||||||
|
@kernel
|
||||||
|
def reset(self):
|
||||||
|
rtio_init()
|
||||||
|
at_mu(rtio_get_counter() + int64(125000))
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def break_realtime(self):
|
||||||
|
min_now = rtio_get_counter() + int64(125000)
|
||||||
|
if now_mu() < min_now:
|
||||||
|
at_mu(min_now)
|
||||||
|
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
class Demo:
|
class Demo:
|
||||||
@kernel
|
@kernel
|
||||||
def run(self):
|
def run(self):
|
||||||
|
core = Core()
|
||||||
|
|
||||||
|
core.reset()
|
||||||
rtio_init()
|
rtio_init()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user