forked from M-Labs/artiq
1
0
Fork 0

language/db: remove implicit_core

This commit is contained in:
Sebastien Bourdeauducq 2015-03-08 11:37:53 +01:00
parent ac697e3248
commit 0f007cb1a7
22 changed files with 33 additions and 22 deletions

View File

@ -15,9 +15,6 @@ class _RuntimeEnvironment(LinkInterface):
class Comm(AutoDB):
class DBKeys:
implicit_core = False
def get_runtime_env(self):
return _RuntimeEnvironment(1*ns)

View File

@ -64,7 +64,6 @@ class Comm(AutoDB):
class DBKeys:
serial_dev = Parameter("/dev/ttyUSB1")
baud_rate = Parameter(115200)
implicit_core = False
def build(self):
self.port = serial.serial_for_url(self.serial_dev, baudrate=115200)

View File

@ -48,7 +48,6 @@ class Core(AutoDB):
class DBKeys:
comm = Device()
external_clock = Parameter(None)
implicit_core = False
def build(self):
self.runtime_env = self.comm.get_runtime_env()

View File

@ -25,6 +25,7 @@ class DDS(AutoDB):
"""
class DBKeys:
core = Device()
dds_sysclk = Parameter(1*GHz)
reg_channel = Argument()
rtio_switch = Argument()

View File

@ -4,6 +4,7 @@ from artiq.language.db import *
class GPIOOut(AutoDB):
class DBKeys:
core = Device()
channel = Argument()
@kernel

View File

@ -13,6 +13,7 @@ class LLRTIOOut(AutoDB):
"""
class DBKeys:
core = Device()
channel = Argument()
def build(self):
@ -53,6 +54,7 @@ class LLRTIOOut(AutoDB):
class _RTIOBase(AutoDB):
class DBKeys:
core = Device()
channel = Argument()
def build(self):

View File

@ -113,6 +113,7 @@ class _Frame:
class CompoundPDQ2(AutoDB):
class DBKeys:
core = Device()
ids = Argument()
rtio_trigger = Argument()
rtio_frame = Argument()

View File

@ -19,7 +19,6 @@ from artiq.tools import file_import, verbosity_args, init_logger
class ELFRunner(AutoDB):
class DBKeys:
comm = Device()
implicit_core = False
def run(self, filename):
with open(filename, "rb") as f:

View File

@ -75,20 +75,12 @@ class AutoDB:
def __init__(self, dbh=None, **kwargs):
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():
object.__setattr__(self, k, v)
for k in dir(dbkeys):
for k in dir(self.DBKeys):
if k not in self.__dict__:
ak = getattr(dbkeys, k)
ak = getattr(self.DBKeys, k)
if isinstance(ak, Argument):
if ak.default is NoDefault:
raise AttributeError(

View File

@ -1,15 +1,12 @@
from random import Random
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.sim import time
class Core(AutoDB):
class DBKeys:
implicit_core = False
_level = 0
def run(self, k_function, k_args, k_kwargs):
@ -23,6 +20,7 @@ class Core(AutoDB):
class Input(AutoDB):
class DBKeys:
core = Device()
name = Argument()
def build(self):
@ -44,6 +42,7 @@ class Input(AutoDB):
class WaveOutput(AutoDB):
class DBKeys:
core = Device()
name = Argument()
@kernel
@ -54,6 +53,7 @@ class WaveOutput(AutoDB):
class VoltageOutput(AutoDB):
class DBKeys:
core = Device()
name = Argument()
@kernel

View File

@ -30,6 +30,7 @@ def _run_on_host(k_class, **parameters):
class _Primes(AutoDB):
class DBKeys:
core = Device()
output_list = Argument()
maximum = Argument()
@ -85,6 +86,7 @@ class _Misc(AutoDB):
class _PulseLogger(AutoDB):
class DBKeys:
core = Device()
output_list = Argument()
name = Argument()
@ -108,6 +110,7 @@ class _PulseLogger(AutoDB):
class _Pulses(AutoDB):
class DBKeys:
core = Device()
output_list = Argument()
def build(self):
@ -135,6 +138,7 @@ class _MyException(Exception):
class _Exceptions(AutoDB):
class DBKeys:
core = Device()
trace = Argument()
@kernel
@ -258,6 +262,7 @@ class ExecutionCase(unittest.TestCase):
class _RTIOLoopback(AutoDB):
class DBKeys:
core = Device()
i = Device()
o = Device()
npulses = Argument()
@ -278,6 +283,7 @@ class _RTIOLoopback(AutoDB):
class _RTIOUnderflow(AutoDB):
class DBKeys:
core = Device()
o = Device()
@kernel
@ -289,6 +295,7 @@ class _RTIOUnderflow(AutoDB):
class _RTIOSequenceError(AutoDB):
class DBKeys:
core = Device()
o = Device()
@kernel

View File

@ -6,6 +6,7 @@ class PulseRate(AutoDB):
__artiq_unit__ = "Pulse rate"
class DBKeys:
core = Device()
ttl0 = Device()
pulse_rate = Result()

View File

@ -7,6 +7,7 @@ class RPCTiming(AutoDB):
__artiq_unit__ = "RPC timing"
class DBKeys:
core = Device()
repeats = Argument(100)
rpc_time_mean = Result()
rpc_time_stddev = Result()

View File

@ -9,6 +9,7 @@ class RTIOSkew(AutoDB):
__artiq_unit__ = "RTIO skew"
class DBKeys:
core = Device()
pmt0 = Device()
ttl0 = Device()
rtio_skew = Result()

View File

@ -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"
class DBKeys:
core = Device()
led = Device()
@kernel
@ -46,6 +47,7 @@ Modify the code as follows: ::
__artiq_unit__ = "ARTIQ tutorial"
class DBKeys:
core = Device()
led = Device()
@kernel
@ -91,6 +93,7 @@ Create a new file ``rtio.py`` containing the following: ::
__artiq_unit__ = "ARTIQ tutorial"
class DBKeys:
core = Device()
ttl0 = Device()
@kernel
@ -115,6 +118,7 @@ Try reducing the period of the generated waveform until the CPU cannot keep up w
__artiq_unit__ = "ARTIQ tutorial"
class DBKeys:
core = Device()
led = Device()
ttl0 = Device()

View File

@ -5,6 +5,7 @@ class DDSTest(AutoDB):
__artiq_unit__ = "DDS test"
class DBKeys:
core = Device()
dds0 = Device()
dds1 = Device()
dds2 = Device()

View File

@ -28,8 +28,6 @@ class FloppingF(AutoDB):
__artiq_gui_file__ = "flopping_f_simulation_gui.py"
class DBKeys:
implicit_core = False
npoints = Argument(100)
min_freq = Argument(1000)
max_freq = Argument(2000)

View File

@ -6,6 +6,9 @@ from artiq import *
class Mandelbrot(AutoDB):
__artiq_unit__ = "Mandelbrot set demo"
class DBKeys:
core = Device()
def col(self, i):
sys.stdout.write(" .,-:;i+hHM$*#@ "[i])

View File

@ -5,6 +5,7 @@ class PhotonHistogram(AutoDB):
__artiq_unit__ = "Photon histogram"
class DBKeys:
core = Device()
bd = Device()
bdd = Device()
pmt = Device()

View File

@ -14,6 +14,7 @@ class Transport(AutoDB):
__artiq_unit__ = "Transport"
class DBKeys:
core = Device()
bd = Device()
bdd = Device()
pmt = Device()

View File

@ -5,6 +5,7 @@ class AluminumSpectroscopy(AutoDB):
__artiq_unit__ = "Aluminum spectroscopy (simulation)"
class DBKeys:
core = Device()
mains_sync = Device()
laser_cooling = Device()
spectroscopy = Device()

View File

@ -5,6 +5,7 @@ class SimpleSimulation(AutoDB):
__artiq_unit__ = "Simple simulation"
class DBKeys:
core = Device()
a = Device()
b = Device()
c = Device()