mirror of https://github.com/m-labs/artiq.git
compiler/ir: load into device
This commit is contained in:
parent
0c2c355088
commit
99c99484ae
|
@ -138,27 +138,24 @@ if __name__ == "__main__":
|
||||||
from llvm import passes as lp
|
from llvm import passes as lp
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from artiq.devices import runtime
|
from artiq.devices import runtime, corecom_serial
|
||||||
|
|
||||||
testcode = """
|
testcode = """
|
||||||
def run():
|
def run(x):
|
||||||
x = 37
|
|
||||||
d = 2
|
d = 2
|
||||||
prime = 1
|
prime = 1
|
||||||
while d*d <= x:
|
while d*d <= x:
|
||||||
if x % d == 0:
|
if x % d == 0:
|
||||||
prime = 0
|
prime = 0
|
||||||
d = d + 1
|
d = d + 1
|
||||||
syscall("rpc")
|
syscall("printint", prime)
|
||||||
if prime == 1:
|
|
||||||
syscall("rpc")
|
|
||||||
return prime
|
return prime
|
||||||
"""
|
"""
|
||||||
|
|
||||||
node = ast.parse(testcode)
|
node = ast.parse(testcode)
|
||||||
fdef = node.body[0]
|
fdef = node.body[0]
|
||||||
module = lc.Module.new("main")
|
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 = lp.PassManager.new()
|
||||||
pass_manager.add(lp.PASS_MEM2REG)
|
pass_manager.add(lp.PASS_MEM2REG)
|
||||||
|
@ -184,3 +181,5 @@ def run():
|
||||||
print(" OR1K ASM")
|
print(" OR1K ASM")
|
||||||
print("=========================")
|
print("=========================")
|
||||||
subprocess.call("or1k-elf-objdump -d test.out".split())
|
subprocess.call("or1k-elf-objdump -d test.out".split())
|
||||||
|
|
||||||
|
corecom_serial.CoreCom().run(objfile)
|
||||||
|
|
Loading…
Reference in New Issue