From 99c99484aef5832741eb3bef31a99dce27a02171 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 5 Jul 2014 19:38:45 +0200 Subject: [PATCH] compiler/ir: load into device --- artiq/compiler/ir.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/artiq/compiler/ir.py b/artiq/compiler/ir.py index d22447196..955747e52 100644 --- a/artiq/compiler/ir.py +++ b/artiq/compiler/ir.py @@ -138,27 +138,24 @@ if __name__ == "__main__": from llvm import passes as lp import subprocess - from artiq.devices import runtime + from artiq.devices import runtime, corecom_serial testcode = """ -def run(): - x = 37 +def run(x): d = 2 prime = 1 while d*d <= x: if x % d == 0: prime = 0 d = d + 1 - syscall("rpc") - if prime == 1: - syscall("rpc") + syscall("printint", prime) return prime """ node = ast.parse(testcode) fdef = node.body[0] module = lc.Module.new("main") - _emit_function_def(runtime.Environment(), module, fdef) + _emit_function_def(runtime.Environment(module), module, fdef) pass_manager = lp.PassManager.new() pass_manager.add(lp.PASS_MEM2REG) @@ -184,3 +181,5 @@ def run(): print(" OR1K ASM") print("=========================") subprocess.call("or1k-elf-objdump -d test.out".split()) + + corecom_serial.CoreCom().run(objfile)