diff --git a/artiq/compiler/lower_time.py b/artiq/compiler/lower_time.py index 00039dfad..61e9f83ba 100644 --- a/artiq/compiler/lower_time.py +++ b/artiq/compiler/lower_time.py @@ -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 diff --git a/artiq/devices/core.py b/artiq/devices/core.py index bc6eb4dff..22fcd0ffc 100644 --- a/artiq/devices/core.py +++ b/artiq/devices/core.py @@ -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) diff --git a/artiq/devices/runtime.py b/artiq/devices/runtime.py index 3b9330201..ca197fd6c 100644 --- a/artiq/devices/runtime.py +++ b/artiq/devices/runtime.py @@ -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") diff --git a/examples/ttl_test.py b/examples/ttl_test.py index d07392920..74ac7bd1a 100644 --- a/examples/ttl_test.py +++ b/examples/ttl_test.py @@ -7,7 +7,6 @@ class TTLTest(MPO): @kernel def run(self): - delay(10*us) i = 0 while i < 100000: with parallel: