mirror of https://github.com/m-labs/artiq.git
language/db: remove implicit_core
This commit is contained in:
parent
ac697e3248
commit
0f007cb1a7
|
@ -15,9 +15,6 @@ class _RuntimeEnvironment(LinkInterface):
|
||||||
|
|
||||||
|
|
||||||
class Comm(AutoDB):
|
class Comm(AutoDB):
|
||||||
class DBKeys:
|
|
||||||
implicit_core = False
|
|
||||||
|
|
||||||
def get_runtime_env(self):
|
def get_runtime_env(self):
|
||||||
return _RuntimeEnvironment(1*ns)
|
return _RuntimeEnvironment(1*ns)
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ class Comm(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
serial_dev = Parameter("/dev/ttyUSB1")
|
serial_dev = Parameter("/dev/ttyUSB1")
|
||||||
baud_rate = Parameter(115200)
|
baud_rate = Parameter(115200)
|
||||||
implicit_core = False
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.port = serial.serial_for_url(self.serial_dev, baudrate=115200)
|
self.port = serial.serial_for_url(self.serial_dev, baudrate=115200)
|
||||||
|
|
|
@ -48,7 +48,6 @@ class Core(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
comm = Device()
|
comm = Device()
|
||||||
external_clock = Parameter(None)
|
external_clock = Parameter(None)
|
||||||
implicit_core = False
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.runtime_env = self.comm.get_runtime_env()
|
self.runtime_env = self.comm.get_runtime_env()
|
||||||
|
|
|
@ -25,6 +25,7 @@ class DDS(AutoDB):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
dds_sysclk = Parameter(1*GHz)
|
dds_sysclk = Parameter(1*GHz)
|
||||||
reg_channel = Argument()
|
reg_channel = Argument()
|
||||||
rtio_switch = Argument()
|
rtio_switch = Argument()
|
||||||
|
|
|
@ -4,6 +4,7 @@ from artiq.language.db import *
|
||||||
|
|
||||||
class GPIOOut(AutoDB):
|
class GPIOOut(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
channel = Argument()
|
channel = Argument()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
|
|
@ -13,6 +13,7 @@ class LLRTIOOut(AutoDB):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
channel = Argument()
|
channel = Argument()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
@ -53,6 +54,7 @@ class LLRTIOOut(AutoDB):
|
||||||
|
|
||||||
class _RTIOBase(AutoDB):
|
class _RTIOBase(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
channel = Argument()
|
channel = Argument()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|
|
@ -113,6 +113,7 @@ class _Frame:
|
||||||
|
|
||||||
class CompoundPDQ2(AutoDB):
|
class CompoundPDQ2(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
ids = Argument()
|
ids = Argument()
|
||||||
rtio_trigger = Argument()
|
rtio_trigger = Argument()
|
||||||
rtio_frame = Argument()
|
rtio_frame = Argument()
|
||||||
|
|
|
@ -19,7 +19,6 @@ from artiq.tools import file_import, verbosity_args, init_logger
|
||||||
class ELFRunner(AutoDB):
|
class ELFRunner(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
comm = Device()
|
comm = Device()
|
||||||
implicit_core = False
|
|
||||||
|
|
||||||
def run(self, filename):
|
def run(self, filename):
|
||||||
with open(filename, "rb") as f:
|
with open(filename, "rb") as f:
|
||||||
|
|
|
@ -75,20 +75,12 @@ class AutoDB:
|
||||||
def __init__(self, dbh=None, **kwargs):
|
def __init__(self, dbh=None, **kwargs):
|
||||||
self.dbh = dbh
|
self.dbh = dbh
|
||||||
|
|
||||||
dbkeys = self.DBKeys()
|
|
||||||
if getattr(dbkeys, "implicit_core", True):
|
|
||||||
if hasattr(dbkeys, "core"):
|
|
||||||
raise ValueError(
|
|
||||||
"Set implicit_core to False when"
|
|
||||||
" core is explicitly specified")
|
|
||||||
dbkeys.core = Device()
|
|
||||||
|
|
||||||
for k, v in kwargs.items():
|
for k, v in kwargs.items():
|
||||||
object.__setattr__(self, k, v)
|
object.__setattr__(self, k, v)
|
||||||
|
|
||||||
for k in dir(dbkeys):
|
for k in dir(self.DBKeys):
|
||||||
if k not in self.__dict__:
|
if k not in self.__dict__:
|
||||||
ak = getattr(dbkeys, k)
|
ak = getattr(self.DBKeys, k)
|
||||||
if isinstance(ak, Argument):
|
if isinstance(ak, Argument):
|
||||||
if ak.default is NoDefault:
|
if ak.default is NoDefault:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
from random import Random
|
from random import Random
|
||||||
|
|
||||||
from artiq.language.core import delay, kernel
|
from artiq.language.core import delay, kernel
|
||||||
from artiq.language.db import AutoDB, Argument
|
from artiq.language.db import *
|
||||||
from artiq.language import units
|
from artiq.language import units
|
||||||
from artiq.sim import time
|
from artiq.sim import time
|
||||||
|
|
||||||
|
|
||||||
class Core(AutoDB):
|
class Core(AutoDB):
|
||||||
class DBKeys:
|
|
||||||
implicit_core = False
|
|
||||||
|
|
||||||
_level = 0
|
_level = 0
|
||||||
|
|
||||||
def run(self, k_function, k_args, k_kwargs):
|
def run(self, k_function, k_args, k_kwargs):
|
||||||
|
@ -23,6 +20,7 @@ class Core(AutoDB):
|
||||||
|
|
||||||
class Input(AutoDB):
|
class Input(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
name = Argument()
|
name = Argument()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
@ -44,6 +42,7 @@ class Input(AutoDB):
|
||||||
|
|
||||||
class WaveOutput(AutoDB):
|
class WaveOutput(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
name = Argument()
|
name = Argument()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -54,6 +53,7 @@ class WaveOutput(AutoDB):
|
||||||
|
|
||||||
class VoltageOutput(AutoDB):
|
class VoltageOutput(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
name = Argument()
|
name = Argument()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
|
|
@ -30,6 +30,7 @@ def _run_on_host(k_class, **parameters):
|
||||||
|
|
||||||
class _Primes(AutoDB):
|
class _Primes(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
output_list = Argument()
|
output_list = Argument()
|
||||||
maximum = Argument()
|
maximum = Argument()
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ class _Misc(AutoDB):
|
||||||
|
|
||||||
class _PulseLogger(AutoDB):
|
class _PulseLogger(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
output_list = Argument()
|
output_list = Argument()
|
||||||
name = Argument()
|
name = Argument()
|
||||||
|
|
||||||
|
@ -108,6 +110,7 @@ class _PulseLogger(AutoDB):
|
||||||
|
|
||||||
class _Pulses(AutoDB):
|
class _Pulses(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
output_list = Argument()
|
output_list = Argument()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
@ -135,6 +138,7 @@ class _MyException(Exception):
|
||||||
|
|
||||||
class _Exceptions(AutoDB):
|
class _Exceptions(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
trace = Argument()
|
trace = Argument()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -258,6 +262,7 @@ class ExecutionCase(unittest.TestCase):
|
||||||
|
|
||||||
class _RTIOLoopback(AutoDB):
|
class _RTIOLoopback(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
i = Device()
|
i = Device()
|
||||||
o = Device()
|
o = Device()
|
||||||
npulses = Argument()
|
npulses = Argument()
|
||||||
|
@ -278,6 +283,7 @@ class _RTIOLoopback(AutoDB):
|
||||||
|
|
||||||
class _RTIOUnderflow(AutoDB):
|
class _RTIOUnderflow(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
o = Device()
|
o = Device()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -289,6 +295,7 @@ class _RTIOUnderflow(AutoDB):
|
||||||
|
|
||||||
class _RTIOSequenceError(AutoDB):
|
class _RTIOSequenceError(AutoDB):
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
o = Device()
|
o = Device()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
|
|
@ -6,6 +6,7 @@ class PulseRate(AutoDB):
|
||||||
__artiq_unit__ = "Pulse rate"
|
__artiq_unit__ = "Pulse rate"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
ttl0 = Device()
|
ttl0 = Device()
|
||||||
pulse_rate = Result()
|
pulse_rate = Result()
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class RPCTiming(AutoDB):
|
||||||
__artiq_unit__ = "RPC timing"
|
__artiq_unit__ = "RPC timing"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
repeats = Argument(100)
|
repeats = Argument(100)
|
||||||
rpc_time_mean = Result()
|
rpc_time_mean = Result()
|
||||||
rpc_time_stddev = Result()
|
rpc_time_stddev = Result()
|
||||||
|
|
|
@ -9,6 +9,7 @@ class RTIOSkew(AutoDB):
|
||||||
__artiq_unit__ = "RTIO skew"
|
__artiq_unit__ = "RTIO skew"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
pmt0 = Device()
|
pmt0 = Device()
|
||||||
ttl0 = Device()
|
ttl0 = Device()
|
||||||
rtio_skew = Result()
|
rtio_skew = Result()
|
||||||
|
|
|
@ -13,6 +13,7 @@ As a very first step, we will turn on a LED on the core device. Create a file ``
|
||||||
__artiq_unit__ = "ARTIQ tutorial"
|
__artiq_unit__ = "ARTIQ tutorial"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
led = Device()
|
led = Device()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -46,6 +47,7 @@ Modify the code as follows: ::
|
||||||
__artiq_unit__ = "ARTIQ tutorial"
|
__artiq_unit__ = "ARTIQ tutorial"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
led = Device()
|
led = Device()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -91,6 +93,7 @@ Create a new file ``rtio.py`` containing the following: ::
|
||||||
__artiq_unit__ = "ARTIQ tutorial"
|
__artiq_unit__ = "ARTIQ tutorial"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
ttl0 = Device()
|
ttl0 = Device()
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
@ -115,6 +118,7 @@ Try reducing the period of the generated waveform until the CPU cannot keep up w
|
||||||
__artiq_unit__ = "ARTIQ tutorial"
|
__artiq_unit__ = "ARTIQ tutorial"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
led = Device()
|
led = Device()
|
||||||
ttl0 = Device()
|
ttl0 = Device()
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ class DDSTest(AutoDB):
|
||||||
__artiq_unit__ = "DDS test"
|
__artiq_unit__ = "DDS test"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
dds0 = Device()
|
dds0 = Device()
|
||||||
dds1 = Device()
|
dds1 = Device()
|
||||||
dds2 = Device()
|
dds2 = Device()
|
||||||
|
|
|
@ -28,8 +28,6 @@ class FloppingF(AutoDB):
|
||||||
__artiq_gui_file__ = "flopping_f_simulation_gui.py"
|
__artiq_gui_file__ = "flopping_f_simulation_gui.py"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
implicit_core = False
|
|
||||||
|
|
||||||
npoints = Argument(100)
|
npoints = Argument(100)
|
||||||
min_freq = Argument(1000)
|
min_freq = Argument(1000)
|
||||||
max_freq = Argument(2000)
|
max_freq = Argument(2000)
|
||||||
|
|
|
@ -6,6 +6,9 @@ from artiq import *
|
||||||
class Mandelbrot(AutoDB):
|
class Mandelbrot(AutoDB):
|
||||||
__artiq_unit__ = "Mandelbrot set demo"
|
__artiq_unit__ = "Mandelbrot set demo"
|
||||||
|
|
||||||
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
|
|
||||||
def col(self, i):
|
def col(self, i):
|
||||||
sys.stdout.write(" .,-:;i+hHM$*#@ "[i])
|
sys.stdout.write(" .,-:;i+hHM$*#@ "[i])
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ class PhotonHistogram(AutoDB):
|
||||||
__artiq_unit__ = "Photon histogram"
|
__artiq_unit__ = "Photon histogram"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
bd = Device()
|
bd = Device()
|
||||||
bdd = Device()
|
bdd = Device()
|
||||||
pmt = Device()
|
pmt = Device()
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Transport(AutoDB):
|
||||||
__artiq_unit__ = "Transport"
|
__artiq_unit__ = "Transport"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
bd = Device()
|
bd = Device()
|
||||||
bdd = Device()
|
bdd = Device()
|
||||||
pmt = Device()
|
pmt = Device()
|
||||||
|
|
|
@ -5,6 +5,7 @@ class AluminumSpectroscopy(AutoDB):
|
||||||
__artiq_unit__ = "Aluminum spectroscopy (simulation)"
|
__artiq_unit__ = "Aluminum spectroscopy (simulation)"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
mains_sync = Device()
|
mains_sync = Device()
|
||||||
laser_cooling = Device()
|
laser_cooling = Device()
|
||||||
spectroscopy = Device()
|
spectroscopy = Device()
|
||||||
|
|
|
@ -5,6 +5,7 @@ class SimpleSimulation(AutoDB):
|
||||||
__artiq_unit__ = "Simple simulation"
|
__artiq_unit__ = "Simple simulation"
|
||||||
|
|
||||||
class DBKeys:
|
class DBKeys:
|
||||||
|
core = Device()
|
||||||
a = Device()
|
a = Device()
|
||||||
b = Device()
|
b = Device()
|
||||||
c = Device()
|
c = Device()
|
||||||
|
|
Loading…
Reference in New Issue