forked from M-Labs/artiq
1
0
Fork 0

core: add ConstGeneric

This commit is contained in:
Sebastien Bourdeauducq 2023-12-08 19:38:29 +08:00
parent 985da815ae
commit c618d5daa8
1 changed files with 7 additions and 1 deletions

View File

@ -12,7 +12,7 @@ from artiq.language import import_cache
__all__ = [ __all__ = [
"Kernel", "KernelInvariant", "virtual", "Kernel", "KernelInvariant", "virtual", "ConstGeneric",
"round64", "floor64", "ceil64", "round64", "floor64", "ceil64",
"extern", "kernel", "portable", "nac3", "rpc", "extern", "kernel", "portable", "nac3", "rpc",
"print_rpc", "print_rpc",
@ -35,6 +35,12 @@ class KernelInvariant(Generic[T]):
class virtual(Generic[T]): class virtual(Generic[T]):
pass pass
class _ConstGenericMarker:
pass
def ConstGeneric(name, constraint):
return TypeVar(name, _ConstGenericMarker, constraint)
def round64(x): def round64(x):
return round(x) return round(x)