Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 651ed71b79ef
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d51493fb5d1d
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Feb 24, 2015

  1. Copy the full SHA
    9485372 View commit details
  2. units: add support for V (Volt)

    fallen authored and sbourdeauducq committed Feb 24, 2015
    Copy the full SHA
    1b59442 View commit details

Commits on Feb 26, 2015

  1. Copy the full SHA
    d51493f View commit details
Showing with 6 additions and 4 deletions.
  1. +2 −4 artiq/language/core.py
  2. +4 −0 artiq/language/units.py
6 changes: 2 additions & 4 deletions artiq/language/core.py
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@
from collections import namedtuple as _namedtuple
from functools import wraps as _wraps

from artiq.language import units as _units


class int64(int):
"""64-bit integers for static compilation.
@@ -236,7 +234,7 @@ def time_to_cycles(time, core=None):
"""
if core is None:
raise ValueError("Core device must be specified for time conversion")
return round64(time.amount//core.runtime_env.ref_period)
return round64(time.amount//core.ref_period)


def cycles_to_time(cycles, core=None):
@@ -249,7 +247,7 @@ def cycles_to_time(cycles, core=None):
"""
if core is None:
raise ValueError("Core device must be specified for time conversion")
return cycles*core.runtime_env.ref_period*_units.s
return cycles*core.ref_period


def syscall(*args):
4 changes: 4 additions & 0 deletions artiq/language/units.py
Original file line number Diff line number Diff line change
@@ -156,6 +156,9 @@ def __neg__(self):
def __pos__(self):
return Quantity(self.amount.__pos__(), self.unit)

def __abs__(self):
return Quantity(abs(self.amount), self.unit)

# add/sub
def __add__(self, other):
return self._binop(other, "__add__", addsub_dimension)
@@ -212,6 +215,7 @@ def _register_unit(unit, prefixes):
_register_unit("s", "pnum_")
_register_unit("Hz", "_kMG")
_register_unit("dB", "_")
_register_unit("V", "um_k")


def check_unit(value, unit):