From 0cca2bbef6907f124fe3b56d97dda15c9a0d625b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 12 Apr 2016 15:16:48 +0800 Subject: [PATCH] artiq_run: style --- artiq/frontend/artiq_run.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/artiq/frontend/artiq_run.py b/artiq/frontend/artiq_run.py index 2d99c78b3..f5afc2f26 100755 --- a/artiq/frontend/artiq_run.py +++ b/artiq/frontend/artiq_run.py @@ -20,12 +20,15 @@ from artiq.compiler.embedding import ObjectMap from artiq.compiler.targets import OR1KTarget from artiq.tools import * + logger = logging.getLogger(__name__) + class StubObject: def __setattr__(self, name, value): pass + class StubObjectMap: def __init__(self): stub_object = StubObject() @@ -40,6 +43,7 @@ class StubObjectMap: self.forward_map[self.next_id] = value self.next_id -= 1 + class FileRunner(EnvExperiment): def build(self): self.setattr_device("core") @@ -54,18 +58,21 @@ class FileRunner(EnvExperiment): self.core.comm.serve(StubObjectMap(), lambda addresses: self.target.symbolize(kernel_library, addresses)) + class ELFRunner(FileRunner): def compile(self): with open(self.file, "rb") as f: return f.read() + class LLVMIRRunner(FileRunner): def compile(self): with open(self.file, "r") as f: llmodule = llvm.parse_assembly(f.read()) llmodule.verify() return self.target.link([self.target.assemble(llmodule)], - init_fn='__modinit__') + init_fn="__modinit__") + class LLVMBitcodeRunner(FileRunner): def compile(self): @@ -73,7 +80,7 @@ class LLVMBitcodeRunner(FileRunner): llmodule = llvm.parse_bitcode(f.read()) llmodule.verify() return self.target.link([self.target.assemble(llmodule)], - init_fn='__modinit__') + init_fn="__modinit__") class DummyScheduler: