artiq.language.experiment -> artiq.language.core

This commit is contained in:
Sebastien Bourdeauducq 2014-07-10 18:13:37 +02:00
parent 5f01b061f7
commit 6509f1fd04
10 changed files with 17 additions and 14 deletions

View File

@ -2,7 +2,8 @@ from collections import namedtuple, defaultdict
import inspect, textwrap, ast import inspect, textwrap, ast
from artiq.compiler.tools import eval_ast, value_to_ast from artiq.compiler.tools import eval_ast, value_to_ast
from artiq.language import experiment, units from artiq.language import core as core_language
from artiq.language import units
def _replace_global(obj, ref): def _replace_global(obj, ref):
try: try:
@ -32,7 +33,7 @@ class _ReferenceManager:
self.use_count["Quantity"] = 1 self.use_count["Quantity"] = 1
self.use_count["base_s_unit"] = 1 self.use_count["base_s_unit"] = 1
self.use_count["base_Hz_unit"] = 1 self.use_count["base_Hz_unit"] = 1
for kg in experiment.kernel_globals: for kg in core_language.kernel_globals:
self.use_count[kg] = 1 self.use_count[kg] = 1
self.use_count["range"] = 1 self.use_count["range"] = 1
@ -123,7 +124,8 @@ class _ReferenceManager:
_embeddable_calls = { _embeddable_calls = {
units.Quantity, units.Quantity,
experiment.delay, experiment.at, experiment.now, experiment.syscall, core_language.delay, core_language.at, core_language.now,
core_language.syscall,
range range
} }

View File

@ -1,6 +1,7 @@
import ast import ast
from artiq.language import experiment, units from artiq.language import core as core_language
from artiq.language import units
def eval_ast(expr, symdict=dict()): def eval_ast(expr, symdict=dict()):
if not isinstance(expr, ast.Expression): if not isinstance(expr, ast.Expression):
@ -15,8 +16,8 @@ def value_to_ast(value):
elif isinstance(value, str): elif isinstance(value, str):
return ast.Str(value) return ast.Str(value)
else: else:
for kg in experiment.kernel_globals: for kg in core_language.kernel_globals:
if value is getattr(experiment, kg): if value is getattr(core_language, kg):
return ast.Name(kg, ast.Load()) return ast.Name(kg, ast.Load())
if isinstance(value, units.Quantity): if isinstance(value, units.Quantity):
return ast.Call( return ast.Call(

View File

@ -1,4 +1,4 @@
from artiq.language.experiment import * from artiq.language.core import *
from artiq.language.units import * from artiq.language.units import *
class DDS: class DDS:

View File

@ -1,4 +1,4 @@
from artiq.language.experiment import * from artiq.language.core import *
class GPIOOut: class GPIOOut:
def __init__(self, core, channel=0): def __init__(self, core, channel=0):

View File

@ -1,7 +1,7 @@
from operator import itemgetter from operator import itemgetter
from artiq.language.units import * from artiq.language.units import *
from artiq.language import experiment from artiq.language import core as core_language
class SequentialTimeContext: class SequentialTimeContext:
def __init__(self, current_time): def __init__(self, current_time):
@ -65,4 +65,4 @@ class Manager:
return r return r
manager = Manager() manager = Manager()
experiment.set_time_manager(manager) core_language.set_time_manager(manager)

View File

@ -1,5 +1,5 @@
from artiq.language.units import * from artiq.language.units import *
from artiq.language.experiment import * from artiq.language.core import *
class AluminumSpectroscopy(MPO): class AluminumSpectroscopy(MPO):
channels = "mains_sync laser_cooling spectroscopy spectroscopy_b state_detection pmt" channels = "mains_sync laser_cooling spectroscopy spectroscopy_b state_detection pmt"

View File

@ -1,5 +1,5 @@
from artiq.language.units import * from artiq.language.units import *
from artiq.language.experiment import * from artiq.language.core import *
my_range = range my_range = range

View File

@ -1,4 +1,4 @@
from artiq.language.experiment import MPO, kernel from artiq.language.core import MPO, kernel
from artiq.devices import corecom_serial, runtime, core, gpio_core from artiq.devices import corecom_serial, runtime, core, gpio_core
class CompilerTest(MPO): class CompilerTest(MPO):

View File

@ -1,5 +1,5 @@
from artiq.language.units import * from artiq.language.units import *
from artiq.language.experiment import * from artiq.language.core import *
class SimpleSimulation(MPO): class SimpleSimulation(MPO):
channels = "a b c d" channels = "a b c d"