From 2248a2eb9efada026c58467735e985c91c18f4ca Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 6 Apr 2016 22:38:31 +0000 Subject: [PATCH] embedding: s/kernel_constant_attributes/kernel_invariants/g Requested in #359. --- artiq/compiler/embedding.py | 6 +++--- artiq/coredevice/core.py | 6 +++--- artiq/coredevice/dds.py | 8 ++++---- artiq/coredevice/ttl.py | 6 +++--- artiq/test/coredevice/test_rtio.py | 4 +++- artiq/test/lit/embedding/error_attr_constant.py | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/artiq/compiler/embedding.py b/artiq/compiler/embedding.py index ffe9f3426..006d274ad 100644 --- a/artiq/compiler/embedding.py +++ b/artiq/compiler/embedding.py @@ -137,9 +137,9 @@ class ASTSynthesizer: instance_type = types.TInstance("{}.{}".format(typ.__module__, typ.__qualname__), OrderedDict()) instance_type.attributes['__objectid__'] = builtins.TInt32() - if hasattr(typ, 'kernel_constant_attributes'): - assert isinstance(typ.kernel_constant_attributes, set) - instance_type.constant_attributes = typ.kernel_constant_attributes + if hasattr(typ, 'kernel_invariants'): + assert isinstance(typ.kernel_invariants, set) + instance_type.constant_attributes = typ.kernel_invariants constructor_type = types.TConstructor(instance_type) constructor_type.attributes['__objectid__'] = builtins.TInt32() diff --git a/artiq/coredevice/core.py b/artiq/coredevice/core.py index 1b3e10fdb..9ac755b34 100644 --- a/artiq/coredevice/core.py +++ b/artiq/coredevice/core.py @@ -59,9 +59,9 @@ class Core: :param comm_device: name of the device used for communications. """ - kernel_constant_attributes = { - 'core', 'ref_period', 'coarse_ref_period', 'ref_multiplier', - 'external_clock', + kernel_invariants = { + "core", "ref_period", "coarse_ref_period", "ref_multiplier", + "external_clock", } def __init__(self, dmgr, ref_period, external_clock=False, diff --git a/artiq/coredevice/dds.py b/artiq/coredevice/dds.py index 120ede4c1..dbe749e08 100644 --- a/artiq/coredevice/dds.py +++ b/artiq/coredevice/dds.py @@ -29,7 +29,7 @@ def dds_batch_exit() -> TNone: class _BatchContextManager: - kernel_constant_attributes = {'core', 'core_dds'} + kernel_invariants = {"core", "core_dds"} def __init__(self, core_dds): self.core_dds = core_dds @@ -53,7 +53,7 @@ class CoreDDS: phase-locked multiple of the RTIO clock. """ - kernel_constant_attributes = {'core', 'sysclk', 'batch'} + kernel_invariants = {"core", "sysclk", "batch"} def __init__(self, dmgr, sysclk, core_device="core"): self.core = dmgr.get(core_device) @@ -88,8 +88,8 @@ class _DDSGeneric: :param channel: channel number of the DDS device to control. """ - kernel_constant_attributes = { - 'core', 'core_dds', 'bus_channel', 'channel', 'pow_width' + kernel_invariants = { + "core", "core_dds", "bus_channel", "channel", "pow_width" } def __init__(self, dmgr, bus_channel, channel, core_dds_device="core_dds"): diff --git a/artiq/coredevice/ttl.py b/artiq/coredevice/ttl.py index bd917c1de..34c7d1edf 100644 --- a/artiq/coredevice/ttl.py +++ b/artiq/coredevice/ttl.py @@ -10,7 +10,7 @@ class TTLOut: :param channel: channel number """ - kernel_constant_attributes = {"core", "channel"} + kernel_invariants = {"core", "channel"} def __init__(self, dmgr, channel, core_device="core"): self.core = dmgr.get(core_device) @@ -84,7 +84,7 @@ class TTLInOut: :param channel: channel number """ - kernel_constant_attributes = {"core", "channel"} + kernel_invariants = {"core", "channel"} def __init__(self, dmgr, channel, core_device="core"): self.core = dmgr.get(core_device) @@ -236,7 +236,7 @@ class TTLClockGen: :param channel: channel number """ - kernel_constant_attributes = {"core", "channel", "acc_width"} + kernel_invariants = {"core", "channel", "acc_width"} def __init__(self, dmgr, channel, core_device="core"): self.core = dmgr.get(core_device) diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index bbe151429..13ddb0eb7 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -83,6 +83,8 @@ class ClockGeneratorLoopback(EnvExperiment): class PulseRate(EnvExperiment): + kernel_invariants = {"core", "ttl_out"} + def build(self): self.setattr_device("core") self.setattr_device("ttl_out") @@ -105,7 +107,7 @@ class PulseRate(EnvExperiment): class PulseRateDDS(EnvExperiment): - kernel_constant_attributes = {"core", "core_dds", "dds0", "dds1"} + kernel_invariants = {"core", "core_dds", "dds0", "dds1"} def build(self): self.setattr_device("core") diff --git a/artiq/test/lit/embedding/error_attr_constant.py b/artiq/test/lit/embedding/error_attr_constant.py index 22e8fe977..1adda638c 100644 --- a/artiq/test/lit/embedding/error_attr_constant.py +++ b/artiq/test/lit/embedding/error_attr_constant.py @@ -5,7 +5,7 @@ from artiq.language.core import * from artiq.language.types import * class c: - kernel_constant_attributes = {'a'} + kernel_invariants = {'a'} def __init__(self): self.a = 1