forked from M-Labs/artiq
1
0
Fork 0

language: add floor64 and ceil64

This commit is contained in:
Sebastien Bourdeauducq 2021-12-04 20:13:00 +08:00
parent 12c39aaaae
commit e34f4cc99b
1 changed files with 9 additions and 1 deletions

View File

@ -6,12 +6,14 @@ from typing import Generic, TypeVar
from functools import wraps from functools import wraps
from inspect import getfullargspec, getmodule from inspect import getfullargspec, getmodule
from types import SimpleNamespace from types import SimpleNamespace
from math import floor, ceil
from artiq.language import import_cache from artiq.language import import_cache
__all__ = [ __all__ = [
"KernelInvariant", "virtual", "round64", "KernelInvariant", "virtual",
"round64", "floor64", "ceil64",
"extern", "kernel", "portable", "nac3", "rpc", "extern", "kernel", "portable", "nac3", "rpc",
"parallel", "sequential", "parallel", "sequential",
"set_watchdog_factory", "watchdog", "TerminationRequested" "set_watchdog_factory", "watchdog", "TerminationRequested"
@ -30,6 +32,12 @@ class virtual(Generic[T]):
def round64(x): def round64(x):
return round(x) return round(x)
def floor64(x):
return floor(x)
def ceil64(x):
return ceil(x)
_allow_registration = True _allow_registration = True
# Delay NAC3 analysis until all referenced variables are supposed to exist on the CPython side. # Delay NAC3 analysis until all referenced variables are supposed to exist on the CPython side.