2014-06-17 03:33:59 +08:00
|
|
|
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
|
2014-07-06 04:47:54 +08:00
|
|
|
from artiq.compiler.ir import get_runtime_binary
|
2014-05-31 00:20:13 +08:00
|
|
|
|
|
|
|
class Core:
|
2014-07-06 04:47:54 +08:00
|
|
|
def __init__(self, runtime_env, core_com):
|
|
|
|
self.runtime_env = runtime_env
|
|
|
|
self.core_com = core_com
|
|
|
|
|
2014-06-17 03:33:59 +08:00
|
|
|
def run(self, k_function, k_args, k_kwargs):
|
2014-06-18 00:52:48 +08:00
|
|
|
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
|
|
|
|
2014-07-06 04:47:54 +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)
|