Skip to content

Commit d22eefc

Browse files
whitequarksbourdeauducq
whitequark
authored andcommittedJun 29, 2016
compiler: remove now()/at().
Fixes #490.
1 parent 1bb09f9 commit d22eefc

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed
 

‎artiq/compiler/builtins.py

-6
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,9 @@ def obj_sequential():
156156
def fn_watchdog():
157157
return types.TBuiltinFunction("watchdog")
158158

159-
def fn_now():
160-
return types.TBuiltinFunction("now")
161-
162159
def fn_delay():
163160
return types.TBuiltinFunction("delay")
164161

165-
def fn_at():
166-
return types.TBuiltinFunction("at")
167-
168162
def fn_now_mu():
169163
return types.TBuiltinFunction("now_mu")
170164

‎artiq/compiler/prelude.py

-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ def globals():
3636
"watchdog": builtins.fn_watchdog(),
3737

3838
# ARTIQ time management functions
39-
"now": builtins.fn_now(),
4039
"delay": builtins.fn_delay(),
41-
"at": builtins.fn_at(),
4240
"now_mu": builtins.fn_now_mu(),
4341
"delay_mu": builtins.fn_delay_mu(),
4442
"at_mu": builtins.fn_at_mu(),

‎artiq/compiler/transforms/artiq_ir_generator.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -1671,19 +1671,12 @@ def body_gen(index):
16711671
self.polymorphic_print([self.visit(arg) for arg in args],
16721672
separator=" ", suffix="\n\x1D", as_rtio=True)
16731673
return ir.Constant(None, builtins.TNone())
1674-
elif types.is_builtin(typ, "now"):
1675-
if len(node.args) == 0 and len(node.keywords) == 0:
1676-
now_mu = self.append(ir.Builtin("now_mu", [], builtins.TInt64()))
1677-
now_mu_float = self.append(ir.Coerce(now_mu, builtins.TFloat()))
1678-
return self.append(ir.Arith(ast.Mult(loc=None), now_mu_float, self.ref_period))
1679-
else:
1680-
assert False
1681-
elif types.is_builtin(typ, "delay") or types.is_builtin(typ, "at"):
1674+
elif types.is_builtin(typ, "delay"):
16821675
if len(node.args) == 1 and len(node.keywords) == 0:
16831676
arg = self.visit(node.args[0])
16841677
arg_mu_float = self.append(ir.Arith(ast.Div(loc=None), arg, self.ref_period))
16851678
arg_mu = self.append(ir.Coerce(arg_mu_float, builtins.TInt64()))
1686-
return self.append(ir.Builtin(typ.name + "_mu", [arg_mu], builtins.TNone()))
1679+
return self.append(ir.Builtin("delay_mu", [arg_mu], builtins.TNone()))
16871680
else:
16881681
assert False
16891682
elif types.is_builtin(typ, "now_mu") or types.is_builtin(typ, "delay_mu") \

‎artiq/test/lit/time/advance.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# RUN: %python -m artiq.compiler.testbench.jit %s
22
# REQUIRES: time
33

4-
assert now() == 0.0
4+
assert now_mu() == 0
55
delay(100.0)
6-
assert now() == 100.0
7-
at(12345.0)
8-
assert now() == 12345.0
9-
6+
assert now_mu() == 100000000
7+
at_mu(12345000000)
108
assert now_mu() == 12345000000

0 commit comments

Comments
 (0)
Please sign in to comment.