forked from M-Labs/artiq
Remove microcycle unit
Introducing it complicates things and has no advantage with good rational arithmetic support.
This commit is contained in:
parent
59194176a9
commit
2944592201
@ -1,3 +1,3 @@
|
||||
from artiq.language.core import *
|
||||
from artiq.language.units import microcycle, ps, ns, us, ms, s
|
||||
from artiq.language.units import ps, ns, us, ms, s
|
||||
from artiq.language.units import Hz, kHz, MHz, GHz
|
||||
|
@ -306,7 +306,7 @@ def delay(duration):
|
||||
|
||||
|
||||
def now():
|
||||
"""Retrieves the current RTIO time, in microcycles.
|
||||
"""Retrieves the current RTIO time, in seconds.
|
||||
|
||||
"""
|
||||
return _time_manager.get_time()
|
||||
|
@ -157,6 +157,3 @@ def _register_unit(name, prefixes):
|
||||
|
||||
_register_unit("s", "pnum_")
|
||||
_register_unit("Hz", "_kMG")
|
||||
|
||||
microcycle_unit = Unit("microcycle")
|
||||
microcycle = Quantity(1, microcycle_unit)
|
||||
|
@ -49,7 +49,7 @@ class _ReferenceManager:
|
||||
self.use_count[kg] = 1
|
||||
for name in ("int", "round", "int64", "round64", "float", "array",
|
||||
"range", "Fraction", "Quantity", "EncodedException",
|
||||
"s_unit", "Hz_unit", "microcycle_unit"):
|
||||
"s_unit", "Hz_unit"):
|
||||
self.use_count[name] = 1
|
||||
|
||||
def new_name(self, base_name):
|
||||
|
@ -7,7 +7,7 @@ from artiq.transforms.tools import *
|
||||
# -1 statement duration could not be pre-determined
|
||||
# 0 statement has no effect on timeline
|
||||
# >0 statement is a static delay that advances the timeline
|
||||
# by the given amount (in microcycles)
|
||||
# by the given amount
|
||||
def _get_duration(stmt):
|
||||
if isinstance(stmt, (ast.Expr, ast.Assign)):
|
||||
return _get_duration(stmt.value)
|
||||
|
@ -24,14 +24,11 @@ class _UnitsLowerer(ast.NodeTransformer):
|
||||
self.in_core_time = old_in_core_time
|
||||
elif fn == "Quantity":
|
||||
if self.in_core_time:
|
||||
if node.args[1].id == "microcycle_units":
|
||||
node = node.args[0]
|
||||
else:
|
||||
node = ast.copy_location(
|
||||
ast.BinOp(left=node.args[0],
|
||||
op=ast.Div(),
|
||||
right=value_to_ast(self.ref_period)),
|
||||
node)
|
||||
node = ast.copy_location(
|
||||
ast.BinOp(left=node.args[0],
|
||||
op=ast.Div(),
|
||||
right=value_to_ast(self.ref_period)),
|
||||
node)
|
||||
else:
|
||||
node = node.args[0]
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user