forked from M-Labs/nac3
1
0
Fork 0

syscall -> extern (#21)

This commit is contained in:
Sebastien Bourdeauducq 2021-09-27 10:13:03 +08:00
parent d4ed76d76e
commit 64404bba20
3 changed files with 11 additions and 11 deletions

View File

@ -1381,7 +1381,7 @@ impl TopLevelComposer {
{ {
if !decorator_list.is_empty() if !decorator_list.is_empty()
&& matches!(&decorator_list[0].node, && matches!(&decorator_list[0].node,
ast::ExprKind::Name{ id, .. } if id == &"syscall".into()) ast::ExprKind::Name{ id, .. } if id == &"extern".into())
{ {
instance_to_symbol.insert("".into(), simple_name.to_string()); instance_to_symbol.insert("".into(), simple_name.to_string());
continue; continue;

View File

@ -2,42 +2,42 @@ from language import *
from numpy import int32, int64 from numpy import int32, int64
@syscall @extern
def now_mu() -> int64: def now_mu() -> int64:
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def at_mu(t: int64): def at_mu(t: int64):
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def delay_mu(dt: int64): def delay_mu(dt: int64):
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def rtio_init(): def rtio_init():
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def rtio_get_counter() -> int64: def rtio_get_counter() -> int64:
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def rtio_output(target: int32, data: int32): def rtio_output(target: int32, data: int32):
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def rtio_input_timestamp(timeout_mu: int64, channel: int32) -> int64: def rtio_input_timestamp(timeout_mu: int64, channel: int32) -> int64:
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")
@syscall @extern
def rtio_input_data(channel: int32) -> int32: def rtio_input_data(channel: int32) -> int32:
raise NotImplementedError("syscall not simulated") raise NotImplementedError("syscall not simulated")

View File

@ -4,14 +4,14 @@ from functools import wraps
import nac3embedded import nac3embedded
__all__ = ["syscall", "kernel"] __all__ = ["extern", "kernel"]
nac3 = nac3embedded.NAC3() nac3 = nac3embedded.NAC3()
allow_object_registration = True allow_object_registration = True
def syscall(function): def extern(function):
assert allow_object_registration assert allow_object_registration
nac3.register_object(function) nac3.register_object(function)
return function return function