mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 19:28:26 +08:00
devices/runtime: pretty-print
This commit is contained in:
parent
88ad4fbf23
commit
cbf915c2cc
@ -5,6 +5,7 @@ from llvm import core as lc
|
||||
from llvm import target as lt
|
||||
|
||||
from artiq.py2llvm import base_types
|
||||
from artiq.language import units
|
||||
|
||||
|
||||
lt.initialize_all()
|
||||
@ -138,12 +139,17 @@ def _debug_dump_obj(obj):
|
||||
|
||||
class Environment(LinkInterface):
|
||||
def __init__(self, ref_period):
|
||||
self.cpu_type = "or1k"
|
||||
self.ref_period = ref_period
|
||||
# allow 1ms for all initial DDS programming
|
||||
self.initial_time = int(Fraction(1, 1000)/self.ref_period)
|
||||
|
||||
def emit_object(self):
|
||||
tm = lt.TargetMachine.new(triple="or1k", cpu="generic")
|
||||
tm = lt.TargetMachine.new(triple=self.cpu_type, cpu="generic")
|
||||
obj = tm.emit_object(self.llvm_module)
|
||||
_debug_dump_obj(obj)
|
||||
return obj
|
||||
|
||||
def __repr__(self):
|
||||
return "<Environment {} {}>".format(self.cpu_type,
|
||||
str(units.Hz/self.ref_period))
|
||||
|
Loading…
Reference in New Issue
Block a user