Skip to content

Commit 61a50ee

Browse files
committedOct 19, 2014
reorganize for devices/controllers
1 parent c5acb68 commit 61a50ee

32 files changed

+147
-146
lines changed
 

‎artiq/coredevice/__init__.py

Whitespace-only changes.

‎artiq/devices/corecom_dummy.py ‎artiq/coredevice/comm_dummy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from operator import itemgetter
22
from fractions import Fraction
33

4-
from artiq.devices.runtime import LinkInterface
4+
from artiq.coredevice.runtime import LinkInterface
55

66

77
class _RuntimeEnvironment(LinkInterface):
@@ -12,7 +12,7 @@ def emit_object(self):
1212
return str(self.llvm_module)
1313

1414

15-
class CoreCom:
15+
class Comm:
1616
def get_runtime_env(self):
1717
return _RuntimeEnvironment(Fraction(1, 1000000000))
1818

‎artiq/devices/corecom_serial.py ‎artiq/coredevice/comm_serial.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import logging
88

99
from artiq.language import core as core_language
10-
from artiq.devices.runtime import Environment
11-
from artiq.devices import runtime_exceptions
10+
from artiq.coredevice.runtime import Environment
11+
from artiq.coredevice import runtime_exceptions
1212

1313

1414
logger = logging.getLogger(__name__)
@@ -54,7 +54,7 @@ def _read_exactly(f, n):
5454
return r
5555

5656

57-
class CoreCom:
57+
class Comm:
5858
def __init__(self, dev="/dev/ttyUSB1", baud=115200):
5959
self._fd = os.open(dev, os.O_RDWR | os.O_NOCTTY)
6060
self.port = os.fdopen(self._fd, "r+b", buffering=0)
File renamed without changes.

‎artiq/devices/dds_core.py ‎artiq/coredevice/dds.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from artiq.language.core import *
22
from artiq.language.units import *
3-
from artiq.devices import rtio_core
3+
from artiq.coredevice import rtio
44

55

66
class DDS(AutoContext):
77
"""Core device Direct Digital Synthesis (DDS) driver.
88
99
Controls DDS devices managed directly by the core device's runtime. It also
10-
uses a RTIO channel (through :class:`artiq.devices.rtio_core.RTIOOut`) to
10+
uses a RTIO channel (through :class:`artiq.coredevice.rtio.RTIOOut`) to
1111
control a RF switch that gates the output of the DDS device.
1212
1313
:param dds_sysclk: DDS system frequency, used for computing the frequency
@@ -21,7 +21,7 @@ class DDS(AutoContext):
2121

2222
def build(self):
2323
self.previous_frequency = 0*MHz
24-
self.sw = rtio_core.RTIOOut(self, channel=self.rtio_switch)
24+
self.sw = rtio.RTIOOut(self, channel=self.rtio_switch)
2525

2626
kernel_attr = "previous_frequency"
2727

File renamed without changes.

‎artiq/devices/rtio_core.py ‎artiq/coredevice/rtio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from artiq.language.core import *
2-
from artiq.devices.runtime_exceptions import RTIOSequenceError
2+
from artiq.coredevice.runtime_exceptions import RTIOSequenceError
33

44

55
class LLRTIOOut(AutoContext):
File renamed without changes.
File renamed without changes.

‎artiq/devices/pdq2.py ‎artiq/devices/pdq2/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from artiq.language.core import *
22
from artiq.language.units import *
3-
from artiq.devices import rtio_core
3+
from artiq.coredevice import rtio
44

55

66
# FIXME: check those numbers
@@ -104,10 +104,10 @@ class CompoundPDQ2(AutoContext):
104104
parameters = "ids rtio_trigger rtio_frame"
105105

106106
def build(self):
107-
self.trigger = rtio_core.LLRTIOOut(self, channel=self.rtio_trigger)
108-
self.frame0 = rtio_core.LLRTIOOut(self, channel=self.rtio_frame[0])
109-
self.frame1 = rtio_core.LLRTIOOut(self, channel=self.rtio_frame[1])
110-
self.frame2 = rtio_core.LLRTIOOut(self, channel=self.rtio_frame[2])
107+
self.trigger = rtio.LLRTIOOut(self, channel=self.rtio_trigger)
108+
self.frame0 = rtio.LLRTIOOut(self, channel=self.rtio_frame[0])
109+
self.frame1 = rtio.LLRTIOOut(self, channel=self.rtio_frame[1])
110+
self.frame2 = rtio.LLRTIOOut(self, channel=self.rtio_frame[2])
111111

112112
self.frames = []
113113
self.current_frame = -1

‎frontend/pdq2 ‎artiq/devices/pdq2/pdq2-client

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import logging
99
from scipy import interpolate
1010
import numpy as np
1111

12-
from artiq.devices.pdq2com import Pdq2
12+
from pdq2com import Pdq2
1313

1414

1515
def _main():
File renamed without changes.

‎artiq/language/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def __init__(self):
395395

396396
class RuntimeException(Exception):
397397
"""Base class for all exceptions used by the device runtime.
398-
Those exceptions are defined in ``artiq.devices.runtime_exceptions``.
398+
Those exceptions are defined in ``artiq.coredevice.runtime_exceptions``.
399399
400400
"""
401401
pass

‎doc/manual/drivers_reference.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
Drivers reference
22
=================
33

4-
:mod:`artiq.devices.rtio_core` module
5-
-------------------------------------
4+
:mod:`artiq.coredevice.rtio` module
5+
-----------------------------------
66

7-
.. automodule:: artiq.devices.rtio_core
7+
.. automodule:: artiq.coredevice.rtio
88
:members:
99

10-
:mod:`artiq.devices.dds_core` module
11-
-------------------------------------
10+
:mod:`artiq.coredevice.dds` module
11+
----------------------------------
1212

13-
.. automodule:: artiq.devices.dds_core
13+
.. automodule:: artiq.coredevice.dds
1414
:members:
1515

16-
:mod:`artiq.devices.runtime_exceptions` module
17-
----------------------------------------------
16+
:mod:`artiq.coredevice.runtime_exceptions` module
17+
-------------------------------------------------
1818

19-
.. automodule:: artiq.devices.runtime_exceptions
19+
.. automodule:: artiq.coredevice.runtime_exceptions
2020
:members:

‎doc/manual/tutorial.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Connecting to the core device
77
As a very first step, we will turn on a LED on the core device. Create a file ``led.py`` containing the following: ::
88

99
from artiq import *
10-
from artiq.devices import corecom_serial, core, gpio_core
10+
from artiq.coredevice import comm_serial, core, gpio
1111

1212
class LED(AutoContext):
1313
parameters = "led"
@@ -17,9 +17,9 @@ As a very first step, we will turn on a LED on the core device. Create a file ``
1717
self.led.set(1)
1818

1919
if __name__ == "__main__":
20-
with corecom_serial.CoreCom() as com:
21-
core_driver = core.Core(com)
22-
led_driver = gpio_core.GPIOOut(core=core_driver, channel=0)
20+
with comm_serial.Comm() as comm:
21+
core_driver = core.Core(comm)
22+
led_driver = gpio.GPIOOut(core=core_driver, channel=0)
2323
exp = LED(core=core_driver, led=led_driver)
2424
exp.run()
2525

@@ -82,7 +82,7 @@ The point of running code on the core device is the ability to meet demanding re
8282
Create a new file ``rtio.py`` containing the following: ::
8383

8484
from artiq import *
85-
from artiq.devices import corecom_serial, core, rtio_core
85+
from artiq.coredevice import comm_serial, core, rtio
8686

8787
class Tutorial(AutoContext):
8888
parameters = "o"
@@ -94,9 +94,9 @@ Create a new file ``rtio.py`` containing the following: ::
9494
delay(2*us)
9595

9696
if __name__ == "__main__":
97-
with corecom_serial.CoreCom() as com:
98-
core_driver = core.Core(com)
99-
out_driver = rtio_core.RTIOOut(core=core_driver, channel=1)
97+
with comm_serial.Comm() as comm:
98+
core_driver = core.Core(comm)
99+
out_driver = rtio.RTIOOut(core=core_driver, channel=1)
100100
exp = Tutorial(core=core_driver, o=out_driver)
101101
exp.run()
102102

@@ -106,7 +106,7 @@ Instead, inside the core device, output timing is generated by the gateware and
106106

107107
Try reducing the period of the generated waveform until the CPU cannot keep up with the generation of switching events and the underflow exception is raised. Then try catching it: ::
108108

109-
from artiq.devices.runtime_exceptions import RTIOUnderflow
109+
from artiq.coredevice.runtime_exceptions import RTIOUnderflow
110110

111111
def print_underflow():
112112
print("RTIO underflow occured")

‎examples/compiler_test.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ def run(self, n, t2):
3030

3131

3232
def main():
33-
from artiq.devices import corecom_dummy, core, dds_core
33+
from artiq.coredevice import comm_dummy, core, dds
3434

35-
coredev = core.Core(corecom_dummy.CoreCom())
35+
coredev = core.Core(comm_dummy.Comm())
3636
exp = CompilerTest(
3737
core=coredev,
38-
a=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
39-
reg_channel=0, rtio_switch=0),
40-
b=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
41-
reg_channel=1, rtio_switch=1),
42-
A=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
43-
reg_channel=2, rtio_switch=2),
44-
B=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
45-
reg_channel=3, rtio_switch=3)
38+
a=dds.DDS(core=coredev, dds_sysclk=1*GHz,
39+
reg_channel=0, rtio_switch=0),
40+
b=dds.DDS(core=coredev, dds_sysclk=1*GHz,
41+
reg_channel=1, rtio_switch=1),
42+
A=dds.DDS(core=coredev, dds_sysclk=1*GHz,
43+
reg_channel=2, rtio_switch=2),
44+
B=dds.DDS(core=coredev, dds_sysclk=1*GHz,
45+
reg_channel=3, rtio_switch=3)
4646
)
4747
exp.run(3, 100*us)
4848

‎examples/dds_test.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from artiq import *
2-
from artiq.devices import corecom_serial, core, dds_core, gpio_core
2+
from artiq.coredevice import comm_serial, core, dds, gpio
33

44

55
class DDSTest(AutoContext):
@@ -23,19 +23,19 @@ def run(self):
2323

2424

2525
def main():
26-
with corecom_serial.CoreCom() as com:
27-
coredev = core.Core(com)
26+
with comm_serial.Comm() as comm:
27+
coredev = core.Core(comm)
2828
exp = DDSTest(
2929
core=coredev,
30-
a=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
31-
reg_channel=0, rtio_switch=0),
32-
b=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
33-
reg_channel=1, rtio_switch=1),
34-
c=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
35-
reg_channel=2, rtio_switch=2),
36-
d=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
37-
reg_channel=3, rtio_switch=3),
38-
led=gpio_core.GPIOOut(core=coredev, channel=0)
30+
a=dds.DDS(core=coredev, dds_sysclk=1*GHz,
31+
reg_channel=0, rtio_switch=0),
32+
b=dds.DDS(core=coredev, dds_sysclk=1*GHz,
33+
reg_channel=1, rtio_switch=1),
34+
c=dds.DDS(core=coredev, dds_sysclk=1*GHz,
35+
reg_channel=2, rtio_switch=2),
36+
d=dds.DDS(core=coredev, dds_sysclk=1*GHz,
37+
reg_channel=3, rtio_switch=3),
38+
led=gpio.GPIOOut(core=coredev, channel=0)
3939
)
4040
exp.run()
4141

‎examples/mandelbrot.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22

33
from artiq import *
4-
from artiq.devices import corecom_serial, core
4+
from artiq.coredevice import comm_serial, core
55

66

77
class Mandelbrot(AutoContext):
@@ -39,8 +39,8 @@ def run(self):
3939

4040

4141
def main():
42-
with corecom_serial.CoreCom() as com:
43-
exp = Mandelbrot(core=core.Core(com))
42+
with comm_serial.Comm() as comm:
43+
exp = Mandelbrot(core=core.Core(comm))
4444
exp.run()
4545

4646
if __name__ == "__main__":

‎examples/photon_histogram.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from artiq import *
2-
from artiq.devices import corecom_serial, core, dds_core, rtio_core
2+
from artiq.coredevice import comm_serial, core, dds, rtio
33

44

55
class PhotonHistogram(AutoContext):
@@ -36,15 +36,15 @@ def run(self):
3636

3737

3838
def main():
39-
with corecom_serial.CoreCom() as com:
40-
coredev = core.Core(com)
39+
with comm_serial.Comm() as comm:
40+
coredev = core.Core(comm)
4141
exp = PhotonHistogram(
4242
core=coredev,
43-
bd=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
44-
reg_channel=0, rtio_switch=1),
45-
bdd=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
46-
reg_channel=1, rtio_switch=2),
47-
pmt=rtio_core.RTIOIn(core=coredev, channel=0),
43+
bd=dds.DDS(core=coredev, dds_sysclk=1*GHz,
44+
reg_channel=0, rtio_switch=1),
45+
bdd=dds.DDS(core=coredev, dds_sysclk=1*GHz,
46+
reg_channel=1, rtio_switch=2),
47+
pmt=rtio.RTIOIn(core=coredev, channel=0),
4848
repeats=100,
4949
nbins=100
5050
)

‎examples/pulse_performance.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from artiq import *
2-
from artiq.devices import corecom_serial, core, rtio_core
3-
from artiq.devices.runtime_exceptions import RTIOUnderflow
2+
from artiq.coredevice import comm_serial, core, rtio
3+
from artiq.coredevice.runtime_exceptions import RTIOUnderflow
44

55

66
def print_min_period(p):
@@ -27,8 +27,8 @@ def run(self):
2727

2828

2929
if __name__ == "__main__":
30-
with corecom_serial.CoreCom() as com:
31-
coredev = core.Core(com)
30+
with comm_serial.Comm() as comm:
31+
coredev = core.Core(comm)
3232
exp = PulsePerformance(core=coredev,
33-
o=rtio_core.RTIOOut(core=coredev, channel=1))
33+
o=rtio.RTIOOut(core=coredev, channel=1))
3434
exp.run()

‎examples/rtio_skew.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from artiq import *
2-
from artiq.devices import corecom_serial, core, rtio_core
2+
from artiq.coredevice import comm_serial, core, rtio
33

44

55
def print_skew(p):
@@ -28,9 +28,9 @@ def run(self):
2828
print_skew(int((out_t - in_t)/(1*ns)))
2929

3030
if __name__ == "__main__":
31-
with corecom_serial.CoreCom() as com:
32-
coredev = core.Core(com)
31+
with comm_serial.Comm() as comm:
32+
coredev = core.Core(comm)
3333
exp = RTIOSkew(core=coredev,
34-
i=rtio_core.RTIOIn(core=coredev, channel=0),
35-
o=rtio_core.RTIOOut(core=coredev, channel=1))
34+
i=rtio.RTIOIn(core=coredev, channel=0),
35+
o=rtio.RTIOOut(core=coredev, channel=1))
3636
exp.run()

‎examples/transport.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import numpy as np
22

33
from artiq import *
4-
from artiq.devices import corecom_serial, core, dds_core, rtio_core, pdq2
4+
from artiq.coredevice import comm_serial, core, dds, rtio
5+
from artiq.devices import pdq2
56

67

78
class Transport(AutoContext):
@@ -114,15 +115,15 @@ def scan(self, stops):
114115
# 4 devices, 3 board each, 3 dacs each
115116
)
116117

117-
with corecom_serial.CoreCom() as com:
118-
coredev = core.Core(com)
118+
with comm_serial.Comm() as comm:
119+
coredev = core.Core(comm)
119120
exp = Transport(
120121
core=coredev,
121-
bd=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
122-
reg_channel=0, rtio_switch=1),
123-
bdd=dds_core.DDS(core=coredev, dds_sysclk=1*GHz,
124-
reg_channel=1, rtio_switch=2),
125-
pmt=rtio_core.RTIOIn(core=coredev, channel=0),
122+
bd=dds.DDS(core=coredev, dds_sysclk=1*GHz,
123+
reg_channel=0, rtio_switch=1),
124+
bdd=dds.DDS(core=coredev, dds_sysclk=1*GHz,
125+
reg_channel=1, rtio_switch=2),
126+
pmt=rtio.RTIOIn(core=coredev, channel=0),
126127
# a compound pdq device that wraps multiple usb devices (looked up
127128
# by usb "serial number"/id) into one
128129
electrodes=pdq2.CompoundPDQ2(

‎frontend/runelf

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
import argparse
4-
from artiq.devices import corecom_serial
4+
from artiq.coredevice import comm_serial
55

66

77
def main():
@@ -16,13 +16,13 @@ def main():
1616

1717
with open(args.file, "rb") as f:
1818
binary = f.read()
19-
with corecom_serial.CoreCom() as com:
20-
runtime_env = com.get_runtime_env()
19+
with comm_serial.CoreCom() as comm:
20+
runtime_env = comm.get_runtime_env()
2121
if args.e:
2222
print(runtime_env)
23-
com.load(binary)
24-
com.run(args.f)
25-
com.serve(dict(), dict())
23+
comm.load(binary)
24+
comm.run(args.f)
25+
comm.serve(dict(), dict())
2626

2727
if __name__ == "__main__":
2828
main()

‎soc/runtime/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include $(MSCDIR)/software/common.mak
33
BOARD=papilio_pro
44
SERIAL=/dev/ttyUSB1
55

6-
OBJECTS=isr.o elf_loader.o exception_jmp.o exceptions.o services.o corecom_serial.o gpio.o rtio.o dds.o main.o
6+
OBJECTS=isr.o elf_loader.o exception_jmp.o exceptions.o services.o comm_serial.o gpio.o rtio.o dds.o main.o
77

88
all: runtime.bin
99

‎soc/runtime/comm.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef __COMM_H
2+
#define __COMM_H
3+
4+
enum {
5+
KERNEL_RUN_FINISHED,
6+
KERNEL_RUN_EXCEPTION,
7+
KERNEL_RUN_STARTUP_FAILED
8+
};
9+
10+
typedef int (*object_loader)(void *, int);
11+
typedef int (*kernel_runner)(const char *, int *);
12+
13+
void comm_serve(object_loader load_object, kernel_runner run_kernel);
14+
int comm_rpc(int rpc_num, int n_args, ...);
15+
void comm_log(const char *fmt, ...);
16+
17+
#endif /* __COMM_H */

‎soc/runtime/corecom_serial.c ‎soc/runtime/comm_serial.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <uart.h>
44
#include <generated/csr.h>
55

6-
#include "corecom.h"
6+
#include "comm.h"
77

88
/* host to device */
99
enum {
@@ -139,12 +139,12 @@ static void receive_and_run_kernel(kernel_runner run_kernel)
139139
send_char(MSGTYPE_KERNEL_STARTUP_FAILED);
140140
break;
141141
default:
142-
corecom_log("BUG: run_kernel returned unexpected value '%d'", r);
142+
comm_log("BUG: run_kernel returned unexpected value '%d'", r);
143143
break;
144144
}
145145
}
146146

147-
void corecom_serve(object_loader load_object, kernel_runner run_kernel)
147+
void comm_serve(object_loader load_object, kernel_runner run_kernel)
148148
{
149149
char msgtype;
150150

@@ -166,7 +166,7 @@ void corecom_serve(object_loader load_object, kernel_runner run_kernel)
166166
}
167167
}
168168

169-
int corecom_rpc(int rpc_num, int n_args, ...)
169+
int comm_rpc(int rpc_num, int n_args, ...)
170170
{
171171
send_char(MSGTYPE_RPC_REQUEST);
172172
send_sint(rpc_num);
@@ -181,7 +181,7 @@ int corecom_rpc(int rpc_num, int n_args, ...)
181181
return receive_int();
182182
}
183183

184-
void corecom_log(const char *fmt, ...)
184+
void comm_log(const char *fmt, ...)
185185
{
186186
va_list args;
187187
int len;

‎soc/runtime/corecom.h

-17
This file was deleted.

‎soc/runtime/elf_loader.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <string.h>
22

3-
#include "corecom.h"
3+
#include "comm.h"
44
#include "elf_loader.h"
55

66
#define EI_NIDENT 16
@@ -85,11 +85,11 @@ struct elf32_sym {
8585

8686
#define SANITIZE_OFFSET_SIZE(offset, size) \
8787
if(offset > 0x10000000) { \
88-
corecom_log("Incorrect offset in ELF data"); \
88+
comm_log("Incorrect offset in ELF data"); \
8989
return 0; \
9090
} \
9191
if((offset + size) > elf_length) { \
92-
corecom_log("Attempted to access past the end of ELF data"); \
92+
comm_log("Attempted to access past the end of ELF data"); \
9393
return 0; \
9494
}
9595

@@ -121,7 +121,7 @@ static int fixup(void *dest, int dest_length, struct elf32_rela *rela, void *tar
121121
val = _target - (_dest + offset);
122122
_dest[offset] = (_dest[offset] & 0xfc000000) | (val & 0x03ffffff);
123123
} else
124-
corecom_log("Unsupported relocation type: %d", type);
124+
comm_log("Unsupported relocation type: %d", type);
125125
return 1;
126126
}
127127

@@ -141,15 +141,15 @@ int load_elf(symbol_resolver resolver, symbol_callback callback, void *elf_data,
141141
/* validate ELF */
142142
GET_POINTER_SAFE(ehdr, struct elf32_ehdr, 0);
143143
if(memcmp(ehdr->ident, elf_magic_header, sizeof(elf_magic_header)) != 0) {
144-
corecom_log("Incorrect ELF header");
144+
comm_log("Incorrect ELF header");
145145
return 0;
146146
}
147147
if(ehdr->type != ET_REL) {
148-
corecom_log("ELF is not relocatable");
148+
comm_log("ELF is not relocatable");
149149
return 0;
150150
}
151151
if(ehdr->machine != EM_OR1K) {
152-
corecom_log("ELF is for a different machine");
152+
comm_log("ELF is for a different machine");
153153
return 0;
154154
}
155155

@@ -190,7 +190,7 @@ int load_elf(symbol_resolver resolver, symbol_callback callback, void *elf_data,
190190

191191
/* load .text section */
192192
if(textsize > dest_length) {
193-
corecom_log(".text section is too large");
193+
comm_log(".text section is too large");
194194
return 0;
195195
}
196196
memcpy(dest, (char *)elf_data + textoff, textsize);
@@ -209,13 +209,13 @@ int load_elf(symbol_resolver resolver, symbol_callback callback, void *elf_data,
209209
name = (char *)elf_data + strtaboff + sym->name;
210210
target = resolver(name);
211211
if(target == NULL) {
212-
corecom_log("Undefined symbol: %s", name);
212+
comm_log("Undefined symbol: %s", name);
213213
return 0;
214214
}
215215
if(!fixup(dest, dest_length, rela, target))
216216
return 0;
217217
} else {
218-
corecom_log("Unsupported relocation");
218+
comm_log("Unsupported relocation");
219219
return 0;
220220
}
221221
}

‎soc/runtime/exceptions.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "exceptions.h"
2-
#include "corecom.h"
2+
#include "comm.h"
33

44
#define MAX_EXCEPTION_CONTEXTS 64
55

@@ -34,7 +34,7 @@ void exception_raise(int id)
3434
stored_id = id;
3535
exception_longjmp(exception_contexts[--ec_top].jb);
3636
} else {
37-
corecom_log("ERROR: uncaught exception, ID=%d\n", id);
37+
comm_log("ERROR: uncaught exception, ID=%d\n", id);
3838
while(1);
3939
}
4040
}

‎soc/runtime/main.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <time.h>
77
#include <generated/csr.h>
88

9-
#include "corecom.h"
9+
#include "comm.h"
1010
#include "elf_loader.h"
1111
#include "exceptions.h"
1212
#include "services.h"
@@ -31,7 +31,7 @@ static void symtab_init(void)
3131
static int symtab_add(const char *name, void *target)
3232
{
3333
if(_symtab_count >= sizeof(symtab)/sizeof(symtab[0])) {
34-
corecom_log("Too many provided symbols in object");
34+
comm_log("Too many provided symbols in object");
3535
symtab_init();
3636
return 0;
3737
}
@@ -41,7 +41,7 @@ static int symtab_add(const char *name, void *target)
4141

4242
while(1) {
4343
if(_symtab_strptr >= &_symtab_strings[sizeof(_symtab_strings)]) {
44-
corecom_log("Provided symbol string table overflow");
44+
comm_log("Provided symbol string table overflow");
4545
symtab_init();
4646
return 0;
4747
}
@@ -72,7 +72,7 @@ static int run_kernel(const char *kernel_name, int *eid)
7272

7373
k = find_symbol(symtab, kernel_name);
7474
if(k == NULL) {
75-
corecom_log("Failed to find kernel entry point '%s' in object", kernel_name);
75+
comm_log("Failed to find kernel entry point '%s' in object", kernel_name);
7676
return KERNEL_RUN_STARTUP_FAILED;
7777
}
7878

@@ -113,6 +113,6 @@ int main(void)
113113
rtio_init();
114114
dds_init();
115115
blink_led();
116-
corecom_serve(load_object, run_kernel);
116+
comm_serve(load_object, run_kernel);
117117
return 0;
118118
}

‎soc/runtime/services.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include <string.h>
22

33
#include "elf_loader.h"
4-
#include "corecom.h"
4+
#include "comm.h"
55
#include "gpio.h"
66
#include "rtio.h"
77
#include "dds.h"
88
#include "exceptions.h"
99
#include "services.h"
1010

1111
static const struct symbol syscalls[] = {
12-
{"rpc", corecom_rpc},
12+
{"rpc", comm_rpc},
1313
{"gpio_set", gpio_set},
1414
{"rtio_oe", rtio_oe},
1515
{"rtio_set", rtio_set},

‎test/full_stack.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
from operator import itemgetter
33

44
from artiq import *
5-
from artiq.devices import corecom_serial, core, runtime_exceptions, rtio_core
5+
from artiq.coredevice import comm_serial, core, runtime_exceptions, rtio
66
from artiq.sim import devices as sim_devices
77

88

99
def _run_on_device(k_class, **parameters):
10-
with corecom_serial.CoreCom() as com:
11-
coredev = core.Core(com)
10+
with comm_serial.Comm() as comm:
11+
coredev = core.Core(comm)
1212
k_inst = k_class(core=coredev, **parameters)
1313
k_inst.run()
1414

@@ -190,33 +190,33 @@ def run(self):
190190
class RTIOCase(unittest.TestCase):
191191
def test_loopback(self):
192192
npulses = 4
193-
with corecom_serial.CoreCom() as com:
194-
coredev = core.Core(com)
193+
with comm_serial.Comm() as comm:
194+
coredev = core.Core(comm)
195195
uut = _RTIOLoopback(
196196
core=coredev,
197-
i=rtio_core.RTIOIn(core=coredev, channel=0),
198-
o=rtio_core.RTIOOut(core=coredev, channel=1),
197+
i=rtio.RTIOIn(core=coredev, channel=0),
198+
o=rtio.RTIOOut(core=coredev, channel=1),
199199
npulses=npulses
200200
)
201201
uut.run()
202202
self.assertEqual(uut.result, npulses)
203203

204204
def test_underflow(self):
205-
with corecom_serial.CoreCom() as com:
206-
coredev = core.Core(com)
205+
with comm_serial.Comm() as comm:
206+
coredev = core.Core(comm)
207207
uut = _RTIOUnderflow(
208208
core=coredev,
209-
o=rtio_core.RTIOOut(core=coredev, channel=1)
209+
o=rtio.RTIOOut(core=coredev, channel=1)
210210
)
211211
with self.assertRaises(runtime_exceptions.RTIOUnderflow):
212212
uut.run()
213213

214214
def test_sequence_error(self):
215-
with corecom_serial.CoreCom() as com:
216-
coredev = core.Core(com)
215+
with comm_serial.Comm() as comm:
216+
coredev = core.Core(comm)
217217
uut = _RTIOSequenceError(
218218
core=coredev,
219-
o=rtio_core.RTIOOut(core=coredev, channel=1)
219+
o=rtio.RTIOOut(core=coredev, channel=1)
220220
)
221221
with self.assertRaises(runtime_exceptions.RTIOSequenceError):
222222
uut.run()

0 commit comments

Comments
 (0)
Please sign in to comment.