mirror of https://github.com/m-labs/artiq.git
artiq_run: style
This commit is contained in:
parent
3134106a11
commit
0cca2bbef6
|
@ -20,12 +20,15 @@ from artiq.compiler.embedding import ObjectMap
|
||||||
from artiq.compiler.targets import OR1KTarget
|
from artiq.compiler.targets import OR1KTarget
|
||||||
from artiq.tools import *
|
from artiq.tools import *
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class StubObject:
|
class StubObject:
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class StubObjectMap:
|
class StubObjectMap:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
stub_object = StubObject()
|
stub_object = StubObject()
|
||||||
|
@ -40,6 +43,7 @@ class StubObjectMap:
|
||||||
self.forward_map[self.next_id] = value
|
self.forward_map[self.next_id] = value
|
||||||
self.next_id -= 1
|
self.next_id -= 1
|
||||||
|
|
||||||
|
|
||||||
class FileRunner(EnvExperiment):
|
class FileRunner(EnvExperiment):
|
||||||
def build(self):
|
def build(self):
|
||||||
self.setattr_device("core")
|
self.setattr_device("core")
|
||||||
|
@ -54,18 +58,21 @@ class FileRunner(EnvExperiment):
|
||||||
self.core.comm.serve(StubObjectMap(),
|
self.core.comm.serve(StubObjectMap(),
|
||||||
lambda addresses: self.target.symbolize(kernel_library, addresses))
|
lambda addresses: self.target.symbolize(kernel_library, addresses))
|
||||||
|
|
||||||
|
|
||||||
class ELFRunner(FileRunner):
|
class ELFRunner(FileRunner):
|
||||||
def compile(self):
|
def compile(self):
|
||||||
with open(self.file, "rb") as f:
|
with open(self.file, "rb") as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
class LLVMIRRunner(FileRunner):
|
class LLVMIRRunner(FileRunner):
|
||||||
def compile(self):
|
def compile(self):
|
||||||
with open(self.file, "r") as f:
|
with open(self.file, "r") as f:
|
||||||
llmodule = llvm.parse_assembly(f.read())
|
llmodule = llvm.parse_assembly(f.read())
|
||||||
llmodule.verify()
|
llmodule.verify()
|
||||||
return self.target.link([self.target.assemble(llmodule)],
|
return self.target.link([self.target.assemble(llmodule)],
|
||||||
init_fn='__modinit__')
|
init_fn="__modinit__")
|
||||||
|
|
||||||
|
|
||||||
class LLVMBitcodeRunner(FileRunner):
|
class LLVMBitcodeRunner(FileRunner):
|
||||||
def compile(self):
|
def compile(self):
|
||||||
|
@ -73,7 +80,7 @@ class LLVMBitcodeRunner(FileRunner):
|
||||||
llmodule = llvm.parse_bitcode(f.read())
|
llmodule = llvm.parse_bitcode(f.read())
|
||||||
llmodule.verify()
|
llmodule.verify()
|
||||||
return self.target.link([self.target.assemble(llmodule)],
|
return self.target.link([self.target.assemble(llmodule)],
|
||||||
init_fn='__modinit__')
|
init_fn="__modinit__")
|
||||||
|
|
||||||
|
|
||||||
class DummyScheduler:
|
class DummyScheduler:
|
||||||
|
|
Loading…
Reference in New Issue