Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9ba8dfbf2365
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 50a463a6fd64
Choose a head ref
  • 3 commits
  • 8 files changed
  • 1 contributor

Commits on Dec 26, 2015

  1. Copy the full SHA
    0807520 View commit details
  2. Copy the full SHA
    ba6c527 View commit details
  3. Copy the full SHA
    50a463a View commit details
2 changes: 1 addition & 1 deletion artiq/gateware/rtio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from artiq.gateware.rtio.core import Channel, RTIO
from artiq.gateware.rtio.core import Channel, LogChannel, RTIO
from artiq.gateware.rtio.analyzer import Analyzer
from artiq.gateware.rtio.moninj import MonInj
15 changes: 15 additions & 0 deletions artiq/gateware/rtio/core.py
Original file line number Diff line number Diff line change
@@ -310,6 +310,15 @@ def from_phy(cls, phy, **kwargs):
return cls(phy.rtlink, probes, overrides, **kwargs)


class LogChannel:
"""A degenerate channel used to log messages into the analyzer."""
def __init__(self):
self.interface = rtlink.Interface(
rtlink.OInterface(32, suppress_nop=False))
self.probes = []
self.overrides = []


class _KernelCSRs(AutoCSR):
def __init__(self, chan_sel_width,
data_width, address_width, full_ts_width):
@@ -385,6 +394,12 @@ def __init__(self, channels, full_ts_width=63, guard_io_cycles=20):
o_statuses, i_statuses = [], []
sel = self.kcsrs.chan_sel.storage
for n, channel in enumerate(channels):
if isinstance(channel, LogChannel):
i_datas.append(0)
i_timestamps.append(0)
i_statuses.append(0)
continue

selected = Signal()
self.comb += selected.eq(sel == n)

8 changes: 8 additions & 0 deletions artiq/gateware/targets/kc705.py
Original file line number Diff line number Diff line change
@@ -185,6 +185,10 @@ def __init__(self, cpu_type="or1k", **kwargs):
rtio_channels.append(rtio.Channel.from_phy(phy,
ofifo_depth=512,
ififo_depth=4))

self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
rtio_channels.append(rtio.LogChannel())

self.add_rtio(rtio_channels)


@@ -230,6 +234,10 @@ def __init__(self, cpu_type="or1k", **kwargs):
rtio_channels.append(rtio.Channel.from_phy(phy,
ofifo_depth=512,
ififo_depth=4))

self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
rtio_channels.append(rtio.LogChannel())

self.add_rtio(rtio_channels)


3 changes: 3 additions & 0 deletions artiq/gateware/targets/pipistrello.py
Original file line number Diff line number Diff line change
@@ -190,6 +190,9 @@ def __init__(self, cpu_type="or1k", **kwargs):
ofifo_depth=512,
ififo_depth=4))

self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)
rtio_channels.append(rtio.LogChannel())

# RTIO core
self.submodules.rtio = rtio.RTIO(rtio_channels)
self.config["RTIO_FINE_TS_WIDTH"] = self.rtio.fine_ts_width
2 changes: 1 addition & 1 deletion artiq/runtime/analyzer.c
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ void analyzer_start(void)
analyzer_header.sent_bytes = analyzer_header.total_byte_count;

analyzer_header.overflow_occured = rtio_analyzer_message_encoder_overflow_read();
analyzer_header.log_channel = 0;
analyzer_header.log_channel = CONFIG_RTIO_LOG_CHANNEL;
analyzer_header.dds_channel = CONFIG_RTIO_DDS_CHANNEL;
#ifdef DDS_ONEHOT_SEL
analyzer_header.dds_onehot_sel = 1;
10 changes: 7 additions & 3 deletions artiq/runtime/ksupport.c
Original file line number Diff line number Diff line change
@@ -107,6 +107,7 @@ static const struct symbol runtime_exports[] = {

/* direct syscalls */
{"rtio_get_counter", &rtio_get_counter},
{"rtio_log", &rtio_log},

{"ttl_set_o", &ttl_set_o},
{"ttl_set_oe", &ttl_set_oe},
@@ -167,13 +168,15 @@ int fprintf(FILE *stream, const char *fmt, ...)
}

/* called by libunwind */
int dladdr (const void *address, Dl_info *info) {
int dladdr (const void *address, Dl_info *info)
{
/* we don't try to resolve names */
return 0;
}

/* called by libunwind */
int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *, size_t, void *), void *data) {
int dl_iterate_phdr (int (*callback)(struct dl_phdr_info *, size_t, void *), void *data)
{
Elf32_Ehdr *ehdr;
struct dl_phdr_info phdr_info;
int retval;
@@ -200,7 +203,8 @@ int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *, size_t, void *), vo
return retval;
}

static Elf32_Addr resolve_runtime_export(const char *name) {
static Elf32_Addr resolve_runtime_export(const char *name)
{
const struct symbol *sym = runtime_exports;
while(sym->name) {
if(!strcmp(sym->name, name))
29 changes: 29 additions & 0 deletions artiq/runtime/rtio.c
Original file line number Diff line number Diff line change
@@ -38,3 +38,32 @@ void rtio_process_exceptional_status(int status, long long int timestamp, int ch
timestamp, channel, 0);
}
}

void rtio_log(long long int timestamp, char *message)
{
unsigned int word;
int i;

rtio_chan_sel_write(CONFIG_RTIO_LOG_CHANNEL);
rtio_o_timestamp_write(timestamp);

i = 0;
word = 0;
while(1) {
word >>= 8;
word |= *message << 24;
if(*message == 0) {
rtio_o_data_write(word);
rtio_o_we_write(1);
break;
}
message++;
i++;
if(i == 4) {
rtio_o_data_write(word);
rtio_o_we_write(1);
word = 0;
i = 0;
}
}
}
1 change: 1 addition & 0 deletions artiq/runtime/rtio.h
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
void rtio_init(void);
long long int rtio_get_counter(void);
void rtio_process_exceptional_status(int status, long long int timestamp, int channel);
void rtio_log(long long int timestamp, char *message);

static inline void rtio_write_and_process_status(long long int timestamp, int channel)
{