mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-18 07:56:30 +08:00
compiler/devices: set initial time
This commit is contained in:
parent
cdda1beea8
commit
8769066e89
@ -33,10 +33,10 @@ class _TimeLowerer(ast.NodeTransformer):
|
||||
else:
|
||||
return node
|
||||
|
||||
def lower_time(stmts, ref_period):
|
||||
def lower_time(stmts, ref_period, initial_time):
|
||||
transformer = _TimeLowerer(ref_period)
|
||||
new_stmts = [transformer.visit(stmt) for stmt in stmts]
|
||||
new_stmts.insert(0, ast.copy_location(
|
||||
ast.Assign(targets=[ast.Name("now", ast.Store())], value=ast.Num(0)),
|
||||
ast.Assign(targets=[ast.Name("now", ast.Store())], value=ast.Num(initial_time)),
|
||||
stmts[0]))
|
||||
stmts[:] = new_stmts
|
||||
|
@ -17,7 +17,8 @@ class Core:
|
||||
fold_constants(stmts)
|
||||
unroll_loops(stmts, 50)
|
||||
interleave(stmts)
|
||||
lower_time(stmts, self.runtime_env.ref_period)
|
||||
lower_time(stmts, self.runtime_env.ref_period,
|
||||
getattr(self.runtime_env, "initial_time", 0))
|
||||
fold_constants(stmts)
|
||||
|
||||
binary = get_runtime_binary(self.runtime_env, stmts)
|
||||
|
@ -49,6 +49,7 @@ class LinkInterface:
|
||||
class Environment(LinkInterface):
|
||||
def __init__(self, ref_period):
|
||||
self.ref_period = ref_period
|
||||
self.initial_time = 8000
|
||||
|
||||
def emit_object(self):
|
||||
tm = lt.TargetMachine.new(triple="or1k", cpu="generic")
|
||||
|
@ -7,7 +7,6 @@ class TTLTest(MPO):
|
||||
|
||||
@kernel
|
||||
def run(self):
|
||||
delay(10*us)
|
||||
i = 0
|
||||
while i < 100000:
|
||||
with parallel:
|
||||
|
Loading…
Reference in New Issue
Block a user