1
0
forked from M-Labs/artiq
artiq/artiq/devices/core.py

21 lines
660 B
Python
Raw Normal View History

from artiq.compiler.inline import inline
2014-06-21 06:19:56 +08:00
from artiq.compiler.fold_constants import fold_constants
2014-06-21 21:06:15 +08:00
from artiq.compiler.unroll_loops import unroll_loops
2014-06-23 00:52:37 +08:00
from artiq.compiler.interleave import interleave
from artiq.compiler.ir import get_runtime_binary
2014-05-31 00:20:13 +08:00
class Core:
def __init__(self, runtime_env, core_com):
self.runtime_env = runtime_env
self.core_com = core_com
def run(self, k_function, k_args, k_kwargs):
stmts, rpc_map = inline(self, k_function, k_args, k_kwargs)
2014-06-21 06:19:56 +08:00
fold_constants(stmts)
2014-06-21 21:06:15 +08:00
unroll_loops(stmts, 50)
2014-06-23 00:52:37 +08:00
interleave(stmts)
2014-06-17 04:56:08 +08:00
binary = get_runtime_binary(self.runtime_env, stmts)
self.core_com.run(binary)
2014-07-08 01:14:23 +08:00
self.core_com.serve(rpc_map)