forked from M-Labs/artiq
1
0
Fork 0

language/core: add array function

This commit is contained in:
Sebastien Bourdeauducq 2014-09-09 17:12:37 +08:00
parent 1bf2142785
commit f410b4d241
1 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,6 @@
from collections import namedtuple from collections import namedtuple
from fractions import Fraction from fractions import Fraction
from copy import copy
from artiq.language import units from artiq.language import units
@ -35,6 +36,10 @@ def round64(x):
return int64(round(x)) return int64(round(x))
def array(element, count):
return [copy(element) for i in range(count)]
def _make_kernel_ro(value): def _make_kernel_ro(value):
return isinstance( return isinstance(
value, (bool, int, int64, float, Fraction, units.Quantity)) value, (bool, int, int64, float, Fraction, units.Quantity))