mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-18 16:06:30 +08:00
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.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
|
from artiq.language.units import Hz, kHz, MHz, GHz
|
||||||
|
@ -306,7 +306,7 @@ def delay(duration):
|
|||||||
|
|
||||||
|
|
||||||
def now():
|
def now():
|
||||||
"""Retrieves the current RTIO time, in microcycles.
|
"""Retrieves the current RTIO time, in seconds.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return _time_manager.get_time()
|
return _time_manager.get_time()
|
||||||
|
@ -157,6 +157,3 @@ def _register_unit(name, prefixes):
|
|||||||
|
|
||||||
_register_unit("s", "pnum_")
|
_register_unit("s", "pnum_")
|
||||||
_register_unit("Hz", "_kMG")
|
_register_unit("Hz", "_kMG")
|
||||||
|
|
||||||
microcycle_unit = Unit("microcycle")
|
|
||||||
microcycle = Quantity(1, microcycle_unit)
|
|
||||||
|
@ -49,7 +49,7 @@ class _ReferenceManager:
|
|||||||
self.use_count[kg] = 1
|
self.use_count[kg] = 1
|
||||||
for name in ("int", "round", "int64", "round64", "float", "array",
|
for name in ("int", "round", "int64", "round64", "float", "array",
|
||||||
"range", "Fraction", "Quantity", "EncodedException",
|
"range", "Fraction", "Quantity", "EncodedException",
|
||||||
"s_unit", "Hz_unit", "microcycle_unit"):
|
"s_unit", "Hz_unit"):
|
||||||
self.use_count[name] = 1
|
self.use_count[name] = 1
|
||||||
|
|
||||||
def new_name(self, base_name):
|
def new_name(self, base_name):
|
||||||
|
@ -7,7 +7,7 @@ from artiq.transforms.tools import *
|
|||||||
# -1 statement duration could not be pre-determined
|
# -1 statement duration could not be pre-determined
|
||||||
# 0 statement has no effect on timeline
|
# 0 statement has no effect on timeline
|
||||||
# >0 statement is a static delay that advances the 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):
|
def _get_duration(stmt):
|
||||||
if isinstance(stmt, (ast.Expr, ast.Assign)):
|
if isinstance(stmt, (ast.Expr, ast.Assign)):
|
||||||
return _get_duration(stmt.value)
|
return _get_duration(stmt.value)
|
||||||
|
@ -24,14 +24,11 @@ class _UnitsLowerer(ast.NodeTransformer):
|
|||||||
self.in_core_time = old_in_core_time
|
self.in_core_time = old_in_core_time
|
||||||
elif fn == "Quantity":
|
elif fn == "Quantity":
|
||||||
if self.in_core_time:
|
if self.in_core_time:
|
||||||
if node.args[1].id == "microcycle_units":
|
node = ast.copy_location(
|
||||||
node = node.args[0]
|
ast.BinOp(left=node.args[0],
|
||||||
else:
|
op=ast.Div(),
|
||||||
node = ast.copy_location(
|
right=value_to_ast(self.ref_period)),
|
||||||
ast.BinOp(left=node.args[0],
|
node)
|
||||||
op=ast.Div(),
|
|
||||||
right=value_to_ast(self.ref_period)),
|
|
||||||
node)
|
|
||||||
else:
|
else:
|
||||||
node = node.args[0]
|
node = node.args[0]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user