From 8769066e890fe04c27fd1ac86d92e877c4fc2043 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 21 Jul 2014 13:22:07 -0600 Subject: [PATCH] compiler/devices: set initial time --- artiq/compiler/lower_time.py | 4 ++-- artiq/devices/core.py | 3 ++- artiq/devices/runtime.py | 1 + examples/ttl_test.py | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) 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: