From 2a76034fbc018660efa0388f1f055dbba53df9ea Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Fri, 16 Jun 2017 19:06:00 +0200 Subject: [PATCH] cri: add note about clearing of o_data --- artiq/firmware/ksupport/rtio.rs | 2 ++ artiq/gateware/rtio/cri.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/artiq/firmware/ksupport/rtio.rs b/artiq/firmware/ksupport/rtio.rs index 064fb4951..3f9f5d4e4 100644 --- a/artiq/firmware/ksupport/rtio.rs +++ b/artiq/firmware/ksupport/rtio.rs @@ -55,6 +55,7 @@ unsafe fn process_exceptional_status(timestamp: i64, channel: i32, status: u32) pub extern fn output(timestamp: i64, channel: i32, addr: i32, data: i32) { unsafe { csr::rtio::chan_sel_write(channel as u32); + // writing timestamp clears o_data csr::rtio::timestamp_write(timestamp as u64); csr::rtio::o_address_write(addr as u32); rtio_o_data_write(0, data as u32); @@ -69,6 +70,7 @@ pub extern fn output(timestamp: i64, channel: i32, addr: i32, data: i32) { pub extern fn output_wide(timestamp: i64, channel: i32, addr: i32, data: CSlice) { unsafe { csr::rtio::chan_sel_write(channel as u32); + // writing timestamp clears o_data csr::rtio::timestamp_write(timestamp as u64); csr::rtio::o_address_write(addr as u32); for i in 0..data.len() { diff --git a/artiq/gateware/rtio/cri.py b/artiq/gateware/rtio/cri.py index cb0a467c3..f282ae307 100644 --- a/artiq/gateware/rtio/cri.py +++ b/artiq/gateware/rtio/cri.py @@ -49,7 +49,9 @@ class KernelInitiator(Module, AutoCSR): self.chan_sel = CSRStorage(24) self.timestamp = CSRStorage(64) - # writing timestamp set o_data to 0 + # Writing timestamp clears o_data. This implements automatic + # zero-extension of output event data by the gateware. When staging an + # output event, always write timestamp before o_data. self.o_data = CSRStorage(512, write_from_dev=True) self.o_address = CSRStorage(16) self.o_we = CSR()