2015-06-24 16:46:15 +08:00
|
|
|
"""
|
|
|
|
The :mod:`prelude` module contains the initial global environment
|
|
|
|
in which ARTIQ kernels are evaluated.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from . import builtins
|
|
|
|
|
|
|
|
def globals():
|
|
|
|
return {
|
2015-08-31 23:59:33 +08:00
|
|
|
# Value constructors
|
2015-07-23 06:26:50 +08:00
|
|
|
"bool": builtins.fn_bool(),
|
|
|
|
"int": builtins.fn_int(),
|
|
|
|
"float": builtins.fn_float(),
|
2017-06-09 13:49:55 +08:00
|
|
|
"str": builtins.fn_str(),
|
|
|
|
"bytes": builtins.fn_bytes(),
|
2017-06-09 14:59:30 +08:00
|
|
|
"bytearray": builtins.fn_bytearray(),
|
2015-07-23 06:26:50 +08:00
|
|
|
"list": builtins.fn_list(),
|
2016-07-06 17:51:57 +08:00
|
|
|
"array": builtins.fn_array(),
|
2015-07-23 06:26:50 +08:00
|
|
|
"range": builtins.fn_range(),
|
2016-11-21 22:01:11 +08:00
|
|
|
"int32": builtins.fn_int32(),
|
|
|
|
"int64": builtins.fn_int64(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
|
|
|
# Exception constructors
|
2015-07-23 06:26:50 +08:00
|
|
|
"Exception": builtins.fn_Exception(),
|
|
|
|
"IndexError": builtins.fn_IndexError(),
|
|
|
|
"ValueError": builtins.fn_ValueError(),
|
|
|
|
"ZeroDivisionError": builtins.fn_ZeroDivisionError(),
|
2020-12-03 04:51:45 +08:00
|
|
|
"RuntimeError": builtins.fn_RuntimeError(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
|
|
|
# Built-in Python functions
|
2015-07-23 06:26:50 +08:00
|
|
|
"len": builtins.fn_len(),
|
|
|
|
"round": builtins.fn_round(),
|
2019-04-13 07:43:45 +08:00
|
|
|
"abs": builtins.fn_abs(),
|
2016-06-22 09:09:41 +08:00
|
|
|
"min": builtins.fn_min(),
|
|
|
|
"max": builtins.fn_max(),
|
2015-07-23 06:26:50 +08:00
|
|
|
"print": builtins.fn_print(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
|
|
|
# ARTIQ decorators
|
2015-08-07 12:54:35 +08:00
|
|
|
"kernel": builtins.fn_kernel(),
|
2015-12-18 23:00:29 +08:00
|
|
|
"portable": builtins.fn_kernel(),
|
2016-10-30 08:40:26 +08:00
|
|
|
"rpc": builtins.fn_kernel(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
2015-09-03 07:46:09 +08:00
|
|
|
# ARTIQ context managers
|
2016-02-22 21:51:08 +08:00
|
|
|
"parallel": builtins.obj_parallel(),
|
2016-02-22 21:24:43 +08:00
|
|
|
"interleave": builtins.obj_interleave(),
|
2015-12-10 23:03:28 +08:00
|
|
|
"sequential": builtins.obj_sequential(),
|
2015-09-03 07:46:09 +08:00
|
|
|
|
2015-08-31 23:59:33 +08:00
|
|
|
# ARTIQ time management functions
|
|
|
|
"delay": builtins.fn_delay(),
|
|
|
|
"now_mu": builtins.fn_now_mu(),
|
|
|
|
"delay_mu": builtins.fn_delay_mu(),
|
|
|
|
"at_mu": builtins.fn_at_mu(),
|
2016-02-15 11:40:43 +08:00
|
|
|
|
|
|
|
# ARTIQ utility functions
|
|
|
|
"rtio_log": builtins.fn_rtio_log(),
|
2016-03-18 12:42:06 +08:00
|
|
|
"core_log": builtins.fn_print(),
|
2015-06-24 16:46:15 +08:00
|
|
|
}
|