2014-07-16 01:20:13 +08:00
|
|
|
from operator import itemgetter
|
|
|
|
|
2015-01-12 18:51:23 +08:00
|
|
|
from artiq.language.db import AutoDB
|
2015-04-19 11:41:20 +08:00
|
|
|
from artiq.language.units import ms
|
2014-10-19 23:51:49 +08:00
|
|
|
from artiq.coredevice.runtime import LinkInterface
|
2014-07-16 01:20:13 +08:00
|
|
|
|
2014-09-05 12:03:22 +08:00
|
|
|
|
2014-07-16 01:20:13 +08:00
|
|
|
class _RuntimeEnvironment(LinkInterface):
|
2015-04-19 11:40:49 +08:00
|
|
|
def __init__(self):
|
2014-12-03 18:16:18 +08:00
|
|
|
self.warmup_time = 1*ms
|
2014-09-05 12:03:22 +08:00
|
|
|
|
|
|
|
def emit_object(self):
|
2014-09-07 14:46:32 +08:00
|
|
|
return str(self.llvm_module)
|
2014-07-16 01:20:13 +08:00
|
|
|
|
|
|
|
|
2015-01-12 18:51:23 +08:00
|
|
|
class Comm(AutoDB):
|
2014-09-05 12:03:22 +08:00
|
|
|
def get_runtime_env(self):
|
2015-04-19 11:40:49 +08:00
|
|
|
return _RuntimeEnvironment()
|
2014-12-03 18:16:18 +08:00
|
|
|
|
|
|
|
def switch_clock(self, external):
|
|
|
|
pass
|
2014-09-05 12:03:22 +08:00
|
|
|
|
2014-09-15 22:40:33 +08:00
|
|
|
def load(self, kcode):
|
2014-09-05 12:03:22 +08:00
|
|
|
print("================")
|
|
|
|
print(" LLVM IR")
|
|
|
|
print("================")
|
|
|
|
print(kcode)
|
|
|
|
|
2014-09-15 22:40:33 +08:00
|
|
|
def run(self, kname):
|
|
|
|
print("RUN: "+kname)
|
|
|
|
|
2014-09-21 23:36:10 +08:00
|
|
|
def serve(self, rpc_map, exception_map):
|
2014-09-05 12:03:22 +08:00
|
|
|
print("================")
|
|
|
|
print(" RPC map")
|
|
|
|
print("================")
|
|
|
|
for k, v in sorted(rpc_map.items(), key=itemgetter(0)):
|
|
|
|
print(str(k)+" -> "+str(v))
|
2014-09-21 23:36:10 +08:00
|
|
|
print("================")
|
|
|
|
print(" Exception map")
|
|
|
|
print("================")
|
|
|
|
for k, v in sorted(exception_map.items(), key=itemgetter(0)):
|
|
|
|
print(str(k)+" -> "+str(v))
|