2014-07-16 01:20:13 +08:00
|
|
|
from operator import itemgetter
|
|
|
|
|
|
|
|
from artiq.devices.runtime import LinkInterface
|
|
|
|
from artiq.language.units import ns
|
|
|
|
|
2014-09-05 12:03:22 +08:00
|
|
|
|
2014-07-16 01:20:13 +08:00
|
|
|
class _RuntimeEnvironment(LinkInterface):
|
2014-09-05 12:03:22 +08:00
|
|
|
def __init__(self, ref_period):
|
|
|
|
self.ref_period = ref_period
|
|
|
|
|
|
|
|
def emit_object(self):
|
|
|
|
return str(self.module)
|
2014-07-16 01:20:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
class CoreCom:
|
2014-09-05 12:03:22 +08:00
|
|
|
def get_runtime_env(self):
|
|
|
|
return _RuntimeEnvironment(10*ns)
|
|
|
|
|
|
|
|
def run(self, kcode):
|
|
|
|
print("================")
|
|
|
|
print(" LLVM IR")
|
|
|
|
print("================")
|
|
|
|
print(kcode)
|
|
|
|
|
|
|
|
def serve(self, rpc_map):
|
|
|
|
print("================")
|
|
|
|
print(" RPC map")
|
|
|
|
print("================")
|
|
|
|
for k, v in sorted(rpc_map.items(), key=itemgetter(0)):
|
|
|
|
print(str(k)+" -> "+str(v))
|