From 5b94ce82e476fe11038562f120dd1326e26d66d9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 9 May 2023 14:26:59 +0800 Subject: [PATCH 01/20] artiq_ddb_template: fix almazny --- artiq/frontend/artiq_ddb_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artiq/frontend/artiq_ddb_template.py b/artiq/frontend/artiq_ddb_template.py index 5bfa11cc7..b79d8f140 100755 --- a/artiq/frontend/artiq_ddb_template.py +++ b/artiq/frontend/artiq_ddb_template.py @@ -334,7 +334,7 @@ class PeripheralManager: "module": "artiq.coredevice.almazny", "class": "AlmaznyChannel", "arguments": {{ - "cpld_device": "{name}_cpld", + "host_mirny": "{name}_cpld", "channel": {i}, }}, }}""", From c53d333d46c5de0a3e9531585b07d006181f0d87 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 9 May 2023 14:27:37 +0800 Subject: [PATCH 02/20] almazny: fix parameter --- artiq/coredevice/almazny.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artiq/coredevice/almazny.py b/artiq/coredevice/almazny.py index 9e0206986..a78992b28 100644 --- a/artiq/coredevice/almazny.py +++ b/artiq/coredevice/almazny.py @@ -134,7 +134,7 @@ class AlmaznyChannel: def __init__(self, dmgr, host_mirny, channel): self.channel = channel - self.mirny_cpld = dmgr.get(cpld_device) + self.mirny_cpld = dmgr.get(host_mirny) @portable def to_mu(self, att, enable, led): From e015483e4853303ed0dfe51f125fef33b9512f60 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 9 May 2023 14:56:06 +0800 Subject: [PATCH 03/20] RELEASE_NOTES: add LMDB migration script (#1743) --- RELEASE_NOTES.rst | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 71179152d..13f378a81 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -27,7 +27,22 @@ Highlights: * Full Python 3.10 support. * Distributed DMA is now supported, allowing DMA to be run directly on satellites for corresponding RTIO events, increasing bandwidth in scenarios with heavy satellite usage. -* Persistent datasets are now stored in a LMDB database for improved performance. +* Persistent datasets are now stored in a LMDB database for improved performance. PYON databases can + be converted with the script below. + +:: + + from sipyco import pyon + import lmdb + + old = pyon.load_file("dataset_db.pyon") + new = lmdb.open("dataset_db.mdb", subdir=False, map_size=2**30) + with new.begin(write=True) as txn: + for key, value in old.items(): + txn.put(key.encode(), pyon.encode(value).encode()) + new.close() + + ARTIQ-7 ------- From df15f53ee97558b31c23a3bbe93f32c14b18fe74 Mon Sep 17 00:00:00 2001 From: "Hartmann Michael (IFAG PSS SIS SCE QSE)" Date: Fri, 12 May 2023 17:44:26 +0800 Subject: [PATCH 04/20] doc: conda installation notes --- doc/manual/installing.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/manual/installing.rst b/doc/manual/installing.rst index dcf079949..75aa31efb 100644 --- a/doc/manual/installing.rst +++ b/doc/manual/installing.rst @@ -129,6 +129,12 @@ Set up the Conda channel and install ARTIQ into a new Conda environment: :: .. note:: If you do not need to flash boards, the ``artiq`` package is sufficient. The packages named ``artiq-board-*`` contain only firmware for the FPGA board, and you should not install them unless you are reflashing an FPGA board. Controllers for third-party devices (e.g. Thorlabs TCube, Lab Brick Digital Attenuator, etc.) that are not shipped with ARTIQ can also be installed with Conda. Browse `Hydra `_ or see the list of NDSPs in this manual to find the names of the corresponding packages. +.. note:: + On Windows, if the last command that creates and installs the ARTIQ environment fails with an error similar to "seeking backwards is not allowed", try to re-run the command with admin rights. + +.. note:: + For commercial use you might need a license for Anaconda/Miniconda or for using the Anaconda package channel. `Miniforge `_ might be an alternative in a commercial environment as it does not include the Anaconda package channel by default. If you want to use Anaconda/Miniconda/Miniforge in a commercial environment, please check the license and the latest terms of service. + After the installation, activate the newly created environment by name. :: $ conda activate artiq From 3ca47537b805b90d6c944daa44d8fb8356bef517 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Thu, 18 May 2023 11:49:52 +0100 Subject: [PATCH 05/20] Fix mismatched signatures for the wide interface Lists are passed by-reference from python code, and so should be &CSlice<_> not CSlice<_>. Signed-off-by: Jonathan Coates --- artiq/firmware/ksupport/lib.rs | 2 +- artiq/firmware/ksupport/rtio.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 0c949f2b2..685516e2b 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -343,7 +343,7 @@ extern fn dma_record_output(target: i32, word: i32) { } #[unwind(aborts)] -extern fn dma_record_output_wide(target: i32, words: CSlice) { +extern fn dma_record_output_wide(target: i32, words: &CSlice) { assert!(words.len() <= 16); // enforce the hardware limit unsafe { diff --git a/artiq/firmware/ksupport/rtio.rs b/artiq/firmware/ksupport/rtio.rs index b0168ba03..18cd9b11d 100644 --- a/artiq/firmware/ksupport/rtio.rs +++ b/artiq/firmware/ksupport/rtio.rs @@ -89,7 +89,7 @@ mod imp { } } - pub extern fn output_wide(target: i32, data: CSlice) { + pub extern fn output_wide(target: i32, data: &CSlice) { unsafe { csr::rtio::target_write(target as u32); // writing target clears o_data @@ -235,7 +235,7 @@ mod imp { unimplemented!("not(has_rtio)") } - pub extern fn output_wide(_target: i32, _data: CSlice) { + pub extern fn output_wide(_target: i32, _data: &CSlice) { unimplemented!("not(has_rtio)") } From c0ca27e6cff582fb5a7fba5b35d4b4f100f55f24 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 10 May 2023 10:27:41 +0800 Subject: [PATCH 06/20] satellite: add rtio_analyzer, only for local rtio --- artiq/gateware/targets/kasli.py | 6 +++++- artiq/gateware/targets/kc705.py | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/artiq/gateware/targets/kasli.py b/artiq/gateware/targets/kasli.py index ecb49451f..4322972aa 100755 --- a/artiq/gateware/targets/kasli.py +++ b/artiq/gateware/targets/kasli.py @@ -360,7 +360,7 @@ class MasterBase(MiniSoC, AMPSoC): self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") - self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.cri_con.switch.slave, + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.rtio_core.cri, self.get_native_sdram_if(), cpu_dw=self.cpu_dw) self.csr_devices.append("rtio_analyzer") @@ -576,6 +576,10 @@ class SatelliteBase(BaseSoC): self.csr_devices.append("cri_con") self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") + + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.cri_con.switch.slave, + self.get_native_sdram_if(), cpu_dw=self.cpu_dw) + self.csr_devices.append("rtio_analyzer") class Master(MasterBase): diff --git a/artiq/gateware/targets/kc705.py b/artiq/gateware/targets/kc705.py index 6444410cd..70733dfe3 100755 --- a/artiq/gateware/targets/kc705.py +++ b/artiq/gateware/targets/kc705.py @@ -308,6 +308,10 @@ class _MasterBase(MiniSoC, AMPSoC): self.register_kernel_cpu_csrdevice("cri_con") self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.rtio_core.cri, + self.get_native_sdram_if(), cpu_dw=self.cpu_dw) + self.csr_devices.append("rtio_analyzer") + class _SatelliteBase(BaseSoC): @@ -460,6 +464,9 @@ class _SatelliteBase(BaseSoC): self.csr_devices.append("cri_con") self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.rtio_core.cri, + self.get_native_sdram_if(), cpu_dw=self.cpu_dw) + self.csr_devices.append("rtio_analyzer") class _NIST_CLOCK_RTIO: From c36b6b3b651671afc8ff8023a6afa6513556895f Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 10 May 2023 11:38:15 +0800 Subject: [PATCH 07/20] master: only local rtio events in analyzer --- artiq/gateware/targets/kasli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artiq/gateware/targets/kasli.py b/artiq/gateware/targets/kasli.py index 4322972aa..98bf6c990 100755 --- a/artiq/gateware/targets/kasli.py +++ b/artiq/gateware/targets/kasli.py @@ -577,7 +577,7 @@ class SatelliteBase(BaseSoC): self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") - self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.cri_con.switch.slave, + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.rtio_core.cri, self.get_native_sdram_if(), cpu_dw=self.cpu_dw) self.csr_devices.append("rtio_analyzer") From fdca1ab7fc8640520abeb4bfef1f8e0bea76f63a Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 10 May 2023 15:56:37 +0800 Subject: [PATCH 08/20] drtioaux: add analyzer related messages --- .../firmware/libproto_artiq/drtioaux_proto.rs | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/artiq/firmware/libproto_artiq/drtioaux_proto.rs b/artiq/firmware/libproto_artiq/drtioaux_proto.rs index efbf56bae..6f50b1b9d 100644 --- a/artiq/firmware/libproto_artiq/drtioaux_proto.rs +++ b/artiq/firmware/libproto_artiq/drtioaux_proto.rs @@ -14,8 +14,8 @@ impl From> for Error { } } -/* 512 (max size) - 4 (CRC) - 1 (packet ID) - 1 (destination) - 4 (trace ID) - 1 (last) - 2 (length) */ -pub const DMA_TRACE_MAX_SIZE: usize = 499; +pub const DMA_TRACE_MAX_SIZE: usize = /*max size*/512 - /*CRC*/4 - /*packet ID*/1 - /*trace ID*/4 - /*last*/1 -/*length*/2; +pub const ANALYZER_MAX_SIZE: usize = /*max size*/512 - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2; #[derive(PartialEq, Debug)] pub enum Packet { @@ -58,6 +58,9 @@ pub enum Packet { SpiReadReply { succeeded: bool, data: u32 }, SpiBasicReply { succeeded: bool }, + AnalyzerRequest { destination: u8 }, + AnalyzerData { last: bool, length: u16, data: [u8; ANALYZER_MAX_SIZE]}, + DmaAddTraceRequest { destination: u8, id: u32, last: bool, length: u16, trace: [u8; DMA_TRACE_MAX_SIZE] }, DmaAddTraceReply { succeeded: bool }, DmaRemoveTraceRequest { destination: u8, id: u32 }, @@ -65,7 +68,6 @@ pub enum Packet { DmaPlaybackRequest { destination: u8, id: u32, timestamp: u64 }, DmaPlaybackReply { succeeded: bool }, DmaPlaybackStatus { destination: u8, id: u32, error: u8, channel: u32, timestamp: u64 } - } impl Packet { @@ -197,6 +199,22 @@ impl Packet { succeeded: reader.read_bool()? }, + 0xa0 => Packet::AnalyzerRequest { + destination: reader.read_u8()? + }, + + 0xa1 => { + let last = reader.read_bool()?; + let length = reader.read_u16()?; + let mut data: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; + reader.read_exact(&mut trace[0..length as usize])?; + Packet::AnalyzerData { + last: last, + length: length, + data: data + } + } + 0xb0 => { let destination = reader.read_u8()?; let id = reader.read_u32()?; @@ -397,6 +415,17 @@ impl Packet { writer.write_bool(succeeded)?; }, + Packet::AnalyzerRequest { destination } => { + writer.write_u8(0xa0)?; + writer.write_u8(destination)?; + }, + Packet::AnalyzerData { last, length, data } => { + writer.write_u8(0xa1)?; + writer.write_bool(last)?; + writer.write_u16(length)?; + writer.write_all(&data[0..length as usize])?; + }, + Packet::DmaAddTraceRequest { destination, id, last, trace, length } => { writer.write_u8(0xb0)?; writer.write_u8(destination)?; From 0b03126038a462dc8a7f379ccd213386dffa8b33 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 10 May 2023 17:22:56 +0800 Subject: [PATCH 09/20] satman: support analyzer packets --- artiq/firmware/Cargo.lock | 1 + .../firmware/libproto_artiq/drtioaux_proto.rs | 21 ++++-- artiq/firmware/satman/Cargo.toml | 1 + artiq/firmware/satman/analyzer.rs | 71 +++++++++++++++++++ artiq/firmware/satman/main.rs | 14 ++++ artiq/gateware/targets/kasli.py | 2 +- artiq/gateware/targets/kc705.py | 2 +- 7 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 artiq/firmware/satman/analyzer.rs diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index 71d4a3af5..23ded9aa2 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -352,6 +352,7 @@ dependencies = [ "board_misoc", "build_misoc", "log", + "proto_artiq", "riscv", ] diff --git a/artiq/firmware/libproto_artiq/drtioaux_proto.rs b/artiq/firmware/libproto_artiq/drtioaux_proto.rs index 6f50b1b9d..d09be2745 100644 --- a/artiq/firmware/libproto_artiq/drtioaux_proto.rs +++ b/artiq/firmware/libproto_artiq/drtioaux_proto.rs @@ -59,6 +59,7 @@ pub enum Packet { SpiBasicReply { succeeded: bool }, AnalyzerRequest { destination: u8 }, + AnalyzerHeader { sent_bytes: u32, total_byte_count: u64, overflow_occurred: bool }, AnalyzerData { last: bool, length: u16, data: [u8; ANALYZER_MAX_SIZE]}, DmaAddTraceRequest { destination: u8, id: u32, last: bool, length: u16, trace: [u8; DMA_TRACE_MAX_SIZE] }, @@ -202,18 +203,22 @@ impl Packet { 0xa0 => Packet::AnalyzerRequest { destination: reader.read_u8()? }, - - 0xa1 => { + 0xa1 => Packet::AnalyzerHeader { + sent_bytes: reader.read_u32()?, + total_byte_count: reader.read_u64()?, + overflow_occurred: reader.read_bool()?, + }, + 0xa2 => { let last = reader.read_bool()?; let length = reader.read_u16()?; let mut data: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; - reader.read_exact(&mut trace[0..length as usize])?; + reader.read_exact(&mut data[0..length as usize])?; Packet::AnalyzerData { last: last, length: length, data: data } - } + }, 0xb0 => { let destination = reader.read_u8()?; @@ -419,8 +424,14 @@ impl Packet { writer.write_u8(0xa0)?; writer.write_u8(destination)?; }, - Packet::AnalyzerData { last, length, data } => { + Packet::AnalyzerHeader { sent_bytes, total_byte_count, overflow_occurred } => { writer.write_u8(0xa1)?; + writer.write_u32(sent_bytes)?; + writer.write_u64(total_byte_count)?; + writer.write_bool(overflow_occurred)?; + }, + Packet::AnalyzerData { last, length, data } => { + writer.write_u8(0xa2)?; writer.write_bool(last)?; writer.write_u16(length)?; writer.write_all(&data[0..length as usize])?; diff --git a/artiq/firmware/satman/Cargo.toml b/artiq/firmware/satman/Cargo.toml index 53b08d7b5..0b219c15f 100644 --- a/artiq/firmware/satman/Cargo.toml +++ b/artiq/firmware/satman/Cargo.toml @@ -18,3 +18,4 @@ board_misoc = { path = "../libboard_misoc", features = ["uart_console", "log"] } board_artiq = { path = "../libboard_artiq" } alloc_list = { path = "../liballoc_list" } riscv = { version = "0.6.0", features = ["inline-asm"] } +proto_artiq = { path = "../libproto_artiq", features = ["log", "alloc"] } diff --git a/artiq/firmware/satman/analyzer.rs b/artiq/firmware/satman/analyzer.rs new file mode 100644 index 000000000..4378d1deb --- /dev/null +++ b/artiq/firmware/satman/analyzer.rs @@ -0,0 +1,71 @@ +use board_misoc::{csr, cache}; +use board_artiq::drtioaux; +use proto_artiq::drtioaux_proto::ANALYZER_MAX_SIZE; + +const BUFFER_SIZE: usize = 512 * 1024; + +#[repr(align(64))] +struct Buffer { + data: [u8; BUFFER_SIZE], +} + +static mut BUFFER: Buffer = Buffer { + data: [0; BUFFER_SIZE] +}; + +pub fn arm() { + unsafe { + let base_addr = &mut BUFFER.data[0] as *mut _ as usize; + let last_addr = &mut BUFFER.data[BUFFER_SIZE - 1] as *mut _ as usize; + csr::rtio_analyzer::message_encoder_overflow_reset_write(1); + csr::rtio_analyzer::dma_base_address_write(base_addr as u64); + csr::rtio_analyzer::dma_last_address_write(last_addr as u64); + csr::rtio_analyzer::dma_reset_write(1); + csr::rtio_analyzer::enable_write(1); + } +} + +pub fn disarm() { + unsafe { + csr::rtio_analyzer::enable_write(0); + while csr::rtio_analyzer::busy_read() != 0 {} + cache::flush_cpu_dcache(); + cache::flush_l2_cache(); + } +} + +pub fn send() -> Result<(), drtioaux::Error> { + let data = unsafe { &BUFFER.data[..] }; + let overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; + let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; + let pointer = (total_byte_count % BUFFER_SIZE as u64) as usize; + let wraparound = total_byte_count >= BUFFER_SIZE as u64; + let sent_bytes = if wraparound { BUFFER_SIZE } else { total_byte_count as usize }; + + drtioaux::send(0, &drtioaux::Packet::AnalyzerHeader { + total_byte_count: total_byte_count, + sent_bytes: sent_bytes as u32, + overflow_occurred: overflow_occurred, + })?; + + let mut i = if wraparound { pointer } else { 0 }; + while i < sent_bytes { + let mut data_slice: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; + let len: usize = if i + ANALYZER_MAX_SIZE < sent_bytes { ANALYZER_MAX_SIZE } else { sent_bytes - i } as usize; + let last = i + len == sent_bytes; + if i + len >= BUFFER_SIZE { + data_slice[..len].clone_from_slice(&data[i..BUFFER_SIZE]); + data_slice[..len].clone_from_slice(&data[..(i+len) % BUFFER_SIZE]); + } else { + data_slice[..len].clone_from_slice(&data[i..i+len]); + } + i += len; + drtioaux::send(0, &drtioaux::Packet::AnalyzerData { + last: last, + length: len as u16, + data: data_slice, + })?; + } + + Ok(()) +} diff --git a/artiq/firmware/satman/main.rs b/artiq/firmware/satman/main.rs index 3b770a2c0..65282701e 100644 --- a/artiq/firmware/satman/main.rs +++ b/artiq/firmware/satman/main.rs @@ -8,6 +8,7 @@ extern crate board_misoc; extern crate board_artiq; extern crate riscv; extern crate alloc; +extern crate proto_artiq; use core::convert::TryFrom; use board_misoc::{csr, ident, clock, uart_logger, i2c, pmp}; @@ -23,6 +24,7 @@ static mut ALLOC: alloc_list::ListAlloc = alloc_list::EMPTY; mod repeater; mod dma; +mod analyzer; fn drtiosat_reset(reset: bool) { unsafe { @@ -300,6 +302,15 @@ fn process_aux_packet(_manager: &mut DmaManager, _repeaters: &mut [repeater::Rep &drtioaux::Packet::SpiReadReply { succeeded: false, data: 0 }) } } + + drtioaux::Packet::AnalyzerRequest { destination: _destination } => { + forward!(_routing_table, _destination, *_rank, _repeaters, &packet); + analyzer::disarm(); + let res = analyzer::send(); + analyzer::arm(); + res + } + #[cfg(has_rtio_dma)] drtioaux::Packet::DmaAddTraceRequest { destination: _destination, id, last, length, trace } => { forward!(_routing_table, _destination, *_rank, _repeaters, &packet); @@ -546,6 +557,9 @@ pub extern fn main() -> i32 { // without a manual intervention. let mut dma_manager = DmaManager::new(); + // Reset the analyzer as well. + analyzer::arm(); + drtioaux::reset(0); drtiosat_reset(false); drtiosat_reset_phy(false); diff --git a/artiq/gateware/targets/kasli.py b/artiq/gateware/targets/kasli.py index 98bf6c990..c09615e9c 100755 --- a/artiq/gateware/targets/kasli.py +++ b/artiq/gateware/targets/kasli.py @@ -577,7 +577,7 @@ class SatelliteBase(BaseSoC): self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") - self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.rtio_core.cri, + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.local_io.cri, self.get_native_sdram_if(), cpu_dw=self.cpu_dw) self.csr_devices.append("rtio_analyzer") diff --git a/artiq/gateware/targets/kc705.py b/artiq/gateware/targets/kc705.py index 70733dfe3..ed2e70ac4 100755 --- a/artiq/gateware/targets/kc705.py +++ b/artiq/gateware/targets/kc705.py @@ -464,7 +464,7 @@ class _SatelliteBase(BaseSoC): self.csr_devices.append("cri_con") self.submodules.routing_table = rtio.RoutingTableAccess(self.cri_con) self.csr_devices.append("routing_table") - self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.rtio_core.cri, + self.submodules.rtio_analyzer = rtio.Analyzer(self.rtio_tsc, self.local_io.cri, self.get_native_sdram_if(), cpu_dw=self.cpu_dw) self.csr_devices.append("rtio_analyzer") From 6c96033d41c85534aff2703100adc3704fb7ce04 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 17 May 2023 17:12:14 +0800 Subject: [PATCH 10/20] analyzer: implement querying up satellites for data --- artiq/firmware/runtime/analyzer.rs | 100 ++++++++++++++++++++++++----- artiq/firmware/runtime/main.rs | 8 ++- artiq/firmware/runtime/rtio_mgt.rs | 55 ++++++++++++++++ 3 files changed, 147 insertions(+), 16 deletions(-) diff --git a/artiq/firmware/runtime/analyzer.rs b/artiq/firmware/runtime/analyzer.rs index 5b090f732..0674d3ddc 100644 --- a/artiq/firmware/runtime/analyzer.rs +++ b/artiq/firmware/runtime/analyzer.rs @@ -1,7 +1,11 @@ use io::{Write, Error as IoError}; use board_misoc::{csr, cache}; -use sched::{Io, TcpListener, TcpStream, Error as SchedError}; +use sched::{Io, Mutex, TcpListener, TcpStream, Error as SchedError}; use analyzer_proto::*; +use alloc::vec::Vec; +use urc::Urc; +use board_artiq::drtio_routing; +use core::cell::RefCell; const BUFFER_SIZE: usize = 512 * 1024; @@ -35,17 +39,78 @@ fn disarm() { } } -fn worker(stream: &mut TcpStream) -> Result<(), IoError> { - let data = unsafe { &BUFFER.data[..] }; - let overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; - let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; - let pointer = (total_byte_count % BUFFER_SIZE as u64) as usize; - let wraparound = total_byte_count >= BUFFER_SIZE as u64; +#[cfg(has_drtio)] +pub mod remote_analyzer { + use super::*; + use rtio_mgt::drtio; + + pub struct RemoteBuffer { + pub total_byte_count: u64, + pub sent_bytes: u32, + pub overflow_occurred: bool, + pub data: Vec + } + pub fn get_data(io: &Io, aux_mutex: &Mutex, ddma_mutex: &Mutex, + routing_table: &drtio_routing::RoutingTable, + up_destinations: &Urc>) -> RemoteBuffer { + // gets data from satellites and returns consolidated data + let mut remote_data: Vec = Vec::new(); + let mut remote_overflow = false; + let mut remote_sent_bytes = 0; + let mut remote_total_bytes = 0; + + let data_vec = match drtio::analyzer_query(io, aux_mutex, ddma_mutex, routing_table, up_destinations) { + Ok(data_vec) => data_vec, + Err(e) => { error!("error retrieving remote analyzer data: {}", e); Vec::new() } + }; + for data in data_vec { + remote_total_bytes += data.total_byte_count; + remote_sent_bytes += data.sent_bytes; + remote_overflow |= data.overflow_occurred; + remote_data.extend(data.data); + } + + RemoteBuffer { + total_byte_count: remote_total_bytes, + sent_bytes: remote_sent_bytes, + overflow_occurred: remote_overflow, + data: remote_data + } + } +} + + + +fn worker(stream: &mut TcpStream, _io: &Io, _aux_mutex: &Mutex, _ddma_mutex: &Mutex, + _routing_table: &drtio_routing::RoutingTable, + _up_destinations: &Urc> +) -> Result<(), IoError> { + let local_data = unsafe { &BUFFER.data[..] }; + let local_overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; + let local_total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; + + let wraparound = local_total_byte_count >= BUFFER_SIZE as u64; + let local_sent_bytes = if wraparound { BUFFER_SIZE as u32 } else { local_total_byte_count as u32 }; + let pointer = (local_total_byte_count % BUFFER_SIZE as u64) as usize; + + #[cfg(has_drtio)] + let remote = remote_analyzer::get_data( + _io, _aux_mutex, _ddma_mutex, _routing_table, _up_destinations); + #[cfg(has_drtio)] let header = Header { - total_byte_count: total_byte_count, - sent_bytes: if wraparound { BUFFER_SIZE as u32 } else { total_byte_count as u32 }, - overflow_occurred: overflow_occurred, + total_byte_count: local_total_byte_count + remote.total_byte_count, + sent_bytes: local_sent_bytes + remote.sent_bytes, + overflow_occurred: local_overflow_occurred | remote.overflow_occurred, + log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8, + dds_onehot_sel: true + }; + + #[cfg(not(has_drtio))] + let header = Header { + total_byte_count: local_total_byte_count, + sent_bytes: local_sent_bytes, + overflow_occurred: local_overflow_occurred, log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8, dds_onehot_sel: true // kept for backward compatibility of analyzer dumps }; @@ -54,16 +119,20 @@ fn worker(stream: &mut TcpStream) -> Result<(), IoError> { stream.write_all("e".as_bytes())?; header.write_to(stream)?; if wraparound { - stream.write_all(&data[pointer..])?; - stream.write_all(&data[..pointer])?; + stream.write_all(&local_data[pointer..])?; + stream.write_all(&local_data[..pointer])?; } else { - stream.write_all(&data[..pointer])?; + stream.write_all(&local_data[..pointer])?; } + #[cfg(has_drtio)] + stream.write_all(&remote.data)?; Ok(()) } -pub fn thread(io: Io) { +pub fn thread(io: Io, aux_mutex: &Mutex, ddma_mutex: &Mutex, + routing_table: &Urc>, + up_destinations: &Urc>) { let listener = TcpListener::new(&io, 65535); listener.listen(1382).expect("analyzer: cannot listen"); @@ -75,7 +144,8 @@ pub fn thread(io: Io) { disarm(); - match worker(&mut stream) { + let routing_table = routing_table.borrow(); + match worker(&mut stream, &io, aux_mutex, ddma_mutex, &routing_table, up_destinations) { Ok(()) => (), Err(err) => error!("analyzer aborted: {}", err) } diff --git a/artiq/firmware/runtime/main.rs b/artiq/firmware/runtime/main.rs index 994c9dfc0..31901227f 100644 --- a/artiq/firmware/runtime/main.rs +++ b/artiq/firmware/runtime/main.rs @@ -209,7 +209,13 @@ fn startup() { io.spawn(4096, move |io| { moninj::thread(io, &aux_mutex, &ddma_mutex, &drtio_routing_table) }); } #[cfg(has_rtio_analyzer)] - io.spawn(4096, analyzer::thread); + { + let aux_mutex = aux_mutex.clone(); + let drtio_routing_table = drtio_routing_table.clone(); + let up_destinations = up_destinations.clone(); + let ddma_mutex = ddma_mutex.clone(); + io.spawn(4096, move |io| { analyzer::thread(io, &aux_mutex, &ddma_mutex, &drtio_routing_table, &up_destinations) }); + } #[cfg(has_grabber)] io.spawn(4096, grabber_thread); diff --git a/artiq/firmware/runtime/rtio_mgt.rs b/artiq/firmware/runtime/rtio_mgt.rs index 6b864c128..916ef86d9 100644 --- a/artiq/firmware/runtime/rtio_mgt.rs +++ b/artiq/firmware/runtime/rtio_mgt.rs @@ -19,6 +19,8 @@ pub mod drtio { use drtioaux; use proto_artiq::drtioaux_proto::DMA_TRACE_MAX_SIZE; use rtio_dma::remote_dma; + #[cfg(has_rtio_analyzer)] + use analyzer::remote_analyzer::RemoteBuffer; pub fn startup(io: &Io, aux_mutex: &Mutex, routing_table: &Urc>, @@ -404,6 +406,59 @@ pub mod drtio { } } + #[cfg(has_rtio_analyzer)] + fn analyzer_get_data(io: &Io, aux_mutex: &Mutex, ddma_mutex: &Mutex, + routing_table: &drtio_routing::RoutingTable, destination: u8 + ) -> Result { + let linkno = routing_table.0[destination as usize][0] - 1; + let reply = aux_transact(io, aux_mutex, ddma_mutex, linkno, &drtioaux::Packet::AnalyzerRequest { + destination: destination }); + let (sent, total, overflow) = match reply { + Ok(drtioaux::Packet::AnalyzerHeader { + sent_bytes, total_byte_count, overflow_occurred } + ) => (sent_bytes, total_byte_count, overflow_occurred), + Ok(_) => return Err("received unexpected aux packet during remote analyzer data request"), + Err(_) => return Err("aux error on remote analyzer request") + }; + + let mut remote_data: Vec = Vec::new(); + if sent > 0 { + let mut last_packet = false; + while !last_packet { + let reply = recv_aux_timeout(io, linkno, 200); + match reply { + Ok(drtioaux::Packet::AnalyzerData { last, length, data }) => { + last_packet = last; + remote_data.extend(&data[0..length as usize]); + }, + Ok(_) => return Err("received unexpected aux packet during remote analyzer data request"), + Err(_) => return Err("aux error on remote analyzer request") + } + } + } + + Ok(RemoteBuffer { + sent_bytes: sent, + total_byte_count: total, + overflow_occurred: overflow, + data: remote_data + }) + } + + #[cfg(has_rtio_analyzer)] + pub fn analyzer_query(io: &Io, aux_mutex: &Mutex, ddma_mutex: &Mutex, + routing_table: &drtio_routing::RoutingTable, + up_destinations: &Urc> + ) -> Result, &'static str> { + let mut remote_buffers: Vec = Vec::new(); + for i in 0..drtio_routing::DEST_COUNT as u8 { + if destination_up(up_destinations, i) { + remote_buffers.push(analyzer_get_data(io, aux_mutex, ddma_mutex, routing_table, i)?); + } + } + Ok(remote_buffers) + } + } #[cfg(not(has_drtio))] From ddfe51e7ac2f7a68b01006c9ec97a35aeed416c9 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 19 May 2023 09:41:26 +0800 Subject: [PATCH 11/20] analyzer: use transactions for data transmission --- .../firmware/libproto_artiq/drtioaux_proto.rs | 18 ++- artiq/firmware/runtime/analyzer.rs | 37 +++-- artiq/firmware/runtime/main.rs | 2 +- artiq/firmware/runtime/rtio_mgt.rs | 19 +-- artiq/firmware/satman/analyzer.rs | 126 ++++++++++++++---- artiq/firmware/satman/main.rs | 36 +++-- 6 files changed, 173 insertions(+), 65 deletions(-) diff --git a/artiq/firmware/libproto_artiq/drtioaux_proto.rs b/artiq/firmware/libproto_artiq/drtioaux_proto.rs index d09be2745..94f26dca7 100644 --- a/artiq/firmware/libproto_artiq/drtioaux_proto.rs +++ b/artiq/firmware/libproto_artiq/drtioaux_proto.rs @@ -58,8 +58,9 @@ pub enum Packet { SpiReadReply { succeeded: bool, data: u32 }, SpiBasicReply { succeeded: bool }, - AnalyzerRequest { destination: u8 }, + AnalyzerHeaderRequest { destination: u8 }, AnalyzerHeader { sent_bytes: u32, total_byte_count: u64, overflow_occurred: bool }, + AnalyzerDataRequest { destination: u8 }, AnalyzerData { last: bool, length: u16, data: [u8; ANALYZER_MAX_SIZE]}, DmaAddTraceRequest { destination: u8, id: u32, last: bool, length: u16, trace: [u8; DMA_TRACE_MAX_SIZE] }, @@ -200,7 +201,7 @@ impl Packet { succeeded: reader.read_bool()? }, - 0xa0 => Packet::AnalyzerRequest { + 0xa0 => Packet::AnalyzerHeaderRequest { destination: reader.read_u8()? }, 0xa1 => Packet::AnalyzerHeader { @@ -208,7 +209,10 @@ impl Packet { total_byte_count: reader.read_u64()?, overflow_occurred: reader.read_bool()?, }, - 0xa2 => { + 0xa2 => Packet::AnalyzerDataRequest { + destination: reader.read_u8()? + }, + 0xa3 => { let last = reader.read_bool()?; let length = reader.read_u16()?; let mut data: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; @@ -420,7 +424,7 @@ impl Packet { writer.write_bool(succeeded)?; }, - Packet::AnalyzerRequest { destination } => { + Packet::AnalyzerHeaderRequest { destination } => { writer.write_u8(0xa0)?; writer.write_u8(destination)?; }, @@ -430,8 +434,12 @@ impl Packet { writer.write_u64(total_byte_count)?; writer.write_bool(overflow_occurred)?; }, - Packet::AnalyzerData { last, length, data } => { + Packet::AnalyzerDataRequest { destination } => { writer.write_u8(0xa2)?; + writer.write_u8(destination)?; + }, + Packet::AnalyzerData { last, length, data } => { + writer.write_u8(0xa3)?; writer.write_bool(last)?; writer.write_u16(length)?; writer.write_all(&data[0..length as usize])?; diff --git a/artiq/firmware/runtime/analyzer.rs b/artiq/firmware/runtime/analyzer.rs index 0674d3ddc..4b5bd222d 100644 --- a/artiq/firmware/runtime/analyzer.rs +++ b/artiq/firmware/runtime/analyzer.rs @@ -2,7 +2,6 @@ use io::{Write, Error as IoError}; use board_misoc::{csr, cache}; use sched::{Io, Mutex, TcpListener, TcpStream, Error as SchedError}; use analyzer_proto::*; -use alloc::vec::Vec; use urc::Urc; use board_artiq::drtio_routing; use core::cell::RefCell; @@ -43,6 +42,7 @@ fn disarm() { pub mod remote_analyzer { use super::*; use rtio_mgt::drtio; + use alloc::vec::Vec; pub struct RemoteBuffer { pub total_byte_count: u64, @@ -53,7 +53,7 @@ pub mod remote_analyzer { pub fn get_data(io: &Io, aux_mutex: &Mutex, ddma_mutex: &Mutex, routing_table: &drtio_routing::RoutingTable, - up_destinations: &Urc>) -> RemoteBuffer { + up_destinations: &Urc>) -> Result { // gets data from satellites and returns consolidated data let mut remote_data: Vec = Vec::new(); let mut remote_overflow = false; @@ -62,7 +62,7 @@ pub mod remote_analyzer { let data_vec = match drtio::analyzer_query(io, aux_mutex, ddma_mutex, routing_table, up_destinations) { Ok(data_vec) => data_vec, - Err(e) => { error!("error retrieving remote analyzer data: {}", e); Vec::new() } + Err(e) => return Err(e) }; for data in data_vec { remote_total_bytes += data.total_byte_count; @@ -71,12 +71,12 @@ pub mod remote_analyzer { remote_data.extend(data.data); } - RemoteBuffer { + Ok(RemoteBuffer { total_byte_count: remote_total_bytes, sent_bytes: remote_sent_bytes, overflow_occurred: remote_overflow, data: remote_data - } + }) } } @@ -98,12 +98,25 @@ fn worker(stream: &mut TcpStream, _io: &Io, _aux_mutex: &Mutex, _ddma_mutex: &Mu let remote = remote_analyzer::get_data( _io, _aux_mutex, _ddma_mutex, _routing_table, _up_destinations); #[cfg(has_drtio)] - let header = Header { - total_byte_count: local_total_byte_count + remote.total_byte_count, - sent_bytes: local_sent_bytes + remote.sent_bytes, - overflow_occurred: local_overflow_occurred | remote.overflow_occurred, - log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8, - dds_onehot_sel: true + let (header, remote_data) = match remote { + Ok(remote) => (Header { + total_byte_count: local_total_byte_count + remote.total_byte_count, + sent_bytes: local_sent_bytes + remote.sent_bytes, + overflow_occurred: local_overflow_occurred | remote.overflow_occurred, + log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8, + dds_onehot_sel: true + }, remote.data), + Err(e) => { + error!("Error getting remote analyzer data: {}", e); + (Header { + total_byte_count: local_total_byte_count, + sent_bytes: local_sent_bytes, + overflow_occurred: true, + log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8, + dds_onehot_sel: true + }, + Vec::new()) + } }; #[cfg(not(has_drtio))] @@ -125,7 +138,7 @@ fn worker(stream: &mut TcpStream, _io: &Io, _aux_mutex: &Mutex, _ddma_mutex: &Mu stream.write_all(&local_data[..pointer])?; } #[cfg(has_drtio)] - stream.write_all(&remote.data)?; + stream.write_all(&remote_data)?; Ok(()) } diff --git a/artiq/firmware/runtime/main.rs b/artiq/firmware/runtime/main.rs index 31901227f..285768e8e 100644 --- a/artiq/firmware/runtime/main.rs +++ b/artiq/firmware/runtime/main.rs @@ -214,7 +214,7 @@ fn startup() { let drtio_routing_table = drtio_routing_table.clone(); let up_destinations = up_destinations.clone(); let ddma_mutex = ddma_mutex.clone(); - io.spawn(4096, move |io| { analyzer::thread(io, &aux_mutex, &ddma_mutex, &drtio_routing_table, &up_destinations) }); + io.spawn(8192, move |io| { analyzer::thread(io, &aux_mutex, &ddma_mutex, &drtio_routing_table, &up_destinations) }); } #[cfg(has_grabber)] diff --git a/artiq/firmware/runtime/rtio_mgt.rs b/artiq/firmware/runtime/rtio_mgt.rs index 916ef86d9..de1b3332c 100644 --- a/artiq/firmware/runtime/rtio_mgt.rs +++ b/artiq/firmware/runtime/rtio_mgt.rs @@ -411,28 +411,29 @@ pub mod drtio { routing_table: &drtio_routing::RoutingTable, destination: u8 ) -> Result { let linkno = routing_table.0[destination as usize][0] - 1; - let reply = aux_transact(io, aux_mutex, ddma_mutex, linkno, &drtioaux::Packet::AnalyzerRequest { - destination: destination }); + let reply = aux_transact(io, aux_mutex, ddma_mutex, linkno, + &drtioaux::Packet::AnalyzerHeaderRequest { destination: destination }); let (sent, total, overflow) = match reply { Ok(drtioaux::Packet::AnalyzerHeader { sent_bytes, total_byte_count, overflow_occurred } ) => (sent_bytes, total_byte_count, overflow_occurred), - Ok(_) => return Err("received unexpected aux packet during remote analyzer data request"), - Err(_) => return Err("aux error on remote analyzer request") + Ok(_) => return Err("received unexpected aux packet during remote analyzer header request"), + Err(e) => return Err(e) }; let mut remote_data: Vec = Vec::new(); if sent > 0 { let mut last_packet = false; while !last_packet { - let reply = recv_aux_timeout(io, linkno, 200); + let reply = aux_transact(io, aux_mutex, ddma_mutex, linkno, + &drtioaux::Packet::AnalyzerDataRequest { destination: destination }); match reply { Ok(drtioaux::Packet::AnalyzerData { last, length, data }) => { last_packet = last; remote_data.extend(&data[0..length as usize]); }, Ok(_) => return Err("received unexpected aux packet during remote analyzer data request"), - Err(_) => return Err("aux error on remote analyzer request") + Err(e) => return Err(e) } } } @@ -451,9 +452,9 @@ pub mod drtio { up_destinations: &Urc> ) -> Result, &'static str> { let mut remote_buffers: Vec = Vec::new(); - for i in 0..drtio_routing::DEST_COUNT as u8 { - if destination_up(up_destinations, i) { - remote_buffers.push(analyzer_get_data(io, aux_mutex, ddma_mutex, routing_table, i)?); + for i in 1..drtio_routing::DEST_COUNT { + if destination_up(up_destinations, i as u8) { + remote_buffers.push(analyzer_get_data(io, aux_mutex, ddma_mutex, routing_table, i as u8)?); } } Ok(remote_buffers) diff --git a/artiq/firmware/satman/analyzer.rs b/artiq/firmware/satman/analyzer.rs index 4378d1deb..189d931f6 100644 --- a/artiq/firmware/satman/analyzer.rs +++ b/artiq/firmware/satman/analyzer.rs @@ -1,5 +1,4 @@ use board_misoc::{csr, cache}; -use board_artiq::drtioaux; use proto_artiq::drtioaux_proto::ANALYZER_MAX_SIZE; const BUFFER_SIZE: usize = 512 * 1024; @@ -13,7 +12,7 @@ static mut BUFFER: Buffer = Buffer { data: [0; BUFFER_SIZE] }; -pub fn arm() { +fn arm() { unsafe { let base_addr = &mut BUFFER.data[0] as *mut _ as usize; let last_addr = &mut BUFFER.data[BUFFER_SIZE - 1] as *mut _ as usize; @@ -25,7 +24,7 @@ pub fn arm() { } } -pub fn disarm() { +fn disarm() { unsafe { csr::rtio_analyzer::enable_write(0); while csr::rtio_analyzer::busy_read() != 0 {} @@ -34,38 +33,109 @@ pub fn disarm() { } } -pub fn send() -> Result<(), drtioaux::Error> { - let data = unsafe { &BUFFER.data[..] }; - let overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; - let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; - let pointer = (total_byte_count % BUFFER_SIZE as u64) as usize; - let wraparound = total_byte_count >= BUFFER_SIZE as u64; - let sent_bytes = if wraparound { BUFFER_SIZE } else { total_byte_count as usize }; +pub struct Analyzer { + // necessary for keeping track of sent data + sent_bytes: usize, + data_iter: usize +} - drtioaux::send(0, &drtioaux::Packet::AnalyzerHeader { - total_byte_count: total_byte_count, - sent_bytes: sent_bytes as u32, - overflow_occurred: overflow_occurred, - })?; +pub struct Header { + pub total_byte_count: u64, + pub sent_bytes: u32, + pub overflow: bool +} - let mut i = if wraparound { pointer } else { 0 }; - while i < sent_bytes { - let mut data_slice: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; - let len: usize = if i + ANALYZER_MAX_SIZE < sent_bytes { ANALYZER_MAX_SIZE } else { sent_bytes - i } as usize; - let last = i + len == sent_bytes; +pub struct AnalyzerSliceMeta { + pub len: u16, + pub last: bool +} + +impl Analyzer { + pub fn new() -> Analyzer { + // create and arm new Analyzer + arm(); + Analyzer { + sent_bytes: 0, + data_iter: 0 + } + } + + pub fn get_header(&mut self) -> Header { + disarm(); + + let overflow = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; + let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; + let wraparound = total_byte_count >= BUFFER_SIZE as u64; + self.sent_bytes = if wraparound { BUFFER_SIZE } else { total_byte_count as usize }; + self.data_iter = if wraparound { (total_byte_count % BUFFER_SIZE as u64) as usize } else { 0 }; + + Header { + total_byte_count: total_byte_count, + sent_bytes: self.sent_bytes as u32, + overflow: overflow + } + } + + pub fn get_data(&mut self, data_slice: &mut [u8; ANALYZER_MAX_SIZE]) -> AnalyzerSliceMeta { + let data = unsafe { &BUFFER.data[..] }; + let i = self.data_iter; + let len = if i + ANALYZER_MAX_SIZE < self.sent_bytes { ANALYZER_MAX_SIZE } else { self.sent_bytes - i }; + let last = i + len == self.sent_bytes; if i + len >= BUFFER_SIZE { data_slice[..len].clone_from_slice(&data[i..BUFFER_SIZE]); data_slice[..len].clone_from_slice(&data[..(i+len) % BUFFER_SIZE]); } else { data_slice[..len].clone_from_slice(&data[i..i+len]); } - i += len; - drtioaux::send(0, &drtioaux::Packet::AnalyzerData { - last: last, - length: len as u16, - data: data_slice, - })?; - } + self.data_iter += len; - Ok(()) + if last { + arm(); + } + + AnalyzerSliceMeta { + len: len as u16, + last: last + } + } } + + +// pub fn send() -> Result<(), drtioaux::Error> { +// let data = unsafe { &BUFFER.data[..] }; +// let overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; +// let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; +// let pointer = (total_byte_count % BUFFER_SIZE as u64) as usize; +// let wraparound = total_byte_count >= BUFFER_SIZE as u64; +// let sent_bytes = if wraparound { BUFFER_SIZE } else { total_byte_count as usize }; + +// drtioaux::send(0, &drtioaux::Packet::AnalyzerHeader { +// total_byte_count: total_byte_count, +// sent_bytes: sent_bytes as u32, +// overflow_occurred: overflow_occurred, +// })?; + +// info!("header sent, total bytes: {}; sent: {}, overflow: {}", total_byte_count, sent_bytes, overflow_occurred); + +// let mut i = if wraparound { pointer } else { 0 }; +// while i < sent_bytes { +// let mut data_slice: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; +// let len: usize = if i + ANALYZER_MAX_SIZE < sent_bytes { ANALYZER_MAX_SIZE } else { sent_bytes - i } as usize; +// let last = i + len == sent_bytes; +// if i + len >= BUFFER_SIZE { +// data_slice[..len].clone_from_slice(&data[i..BUFFER_SIZE]); +// data_slice[..len].clone_from_slice(&data[..(i+len) % BUFFER_SIZE]); +// } else { +// data_slice[..len].clone_from_slice(&data[i..i+len]); +// } +// i += len; +// drtioaux::send(0, &drtioaux::Packet::AnalyzerData { +// last: last, +// length: len as u16, +// data: data_slice, +// })?; +// //info!("sent data, last: {}, length: {}", last, len); +// } + +// Ok(()) +// } diff --git a/artiq/firmware/satman/main.rs b/artiq/firmware/satman/main.rs index 65282701e..4e9f8fa33 100644 --- a/artiq/firmware/satman/main.rs +++ b/artiq/firmware/satman/main.rs @@ -16,8 +16,10 @@ use board_misoc::{csr, ident, clock, uart_logger, i2c, pmp}; use board_artiq::si5324; use board_artiq::{spi, drtioaux}; use board_artiq::drtio_routing; +use proto_artiq::drtioaux_proto::ANALYZER_MAX_SIZE; use riscv::register::{mcause, mepc, mtval}; use dma::Manager as DmaManager; +use analyzer::Analyzer; #[global_allocator] static mut ALLOC: alloc_list::ListAlloc = alloc_list::EMPTY; @@ -75,7 +77,7 @@ macro_rules! forward { ($routing_table:expr, $destination:expr, $rank:expr, $repeaters:expr, $packet:expr) => {} } -fn process_aux_packet(_manager: &mut DmaManager, _repeaters: &mut [repeater::Repeater], +fn process_aux_packet(_manager: &mut DmaManager, analyzer: &mut Analyzer, _repeaters: &mut [repeater::Repeater], _routing_table: &mut drtio_routing::RoutingTable, _rank: &mut u8, packet: drtioaux::Packet) -> Result<(), drtioaux::Error> { // In the code below, *_chan_sel_write takes an u8 if there are fewer than 256 channels, @@ -303,12 +305,25 @@ fn process_aux_packet(_manager: &mut DmaManager, _repeaters: &mut [repeater::Rep } } - drtioaux::Packet::AnalyzerRequest { destination: _destination } => { + drtioaux::Packet::AnalyzerHeaderRequest { destination: _destination } => { forward!(_routing_table, _destination, *_rank, _repeaters, &packet); - analyzer::disarm(); - let res = analyzer::send(); - analyzer::arm(); - res + let header = analyzer.get_header(); + drtioaux::send(0, &drtioaux::Packet::AnalyzerHeader { + total_byte_count: header.total_byte_count, + sent_bytes: header.sent_bytes, + overflow_occurred: header.overflow, + }) + } + + drtioaux::Packet::AnalyzerDataRequest { destination: _destination } => { + forward!(_routing_table, _destination, *_rank, _repeaters, &packet); + let mut data_slice: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; + let meta = analyzer.get_data(&mut data_slice); + drtioaux::send(0, &drtioaux::Packet::AnalyzerData { + last: meta.last, + length: meta.len, + data: data_slice, + }) } #[cfg(has_rtio_dma)] @@ -340,12 +355,13 @@ fn process_aux_packet(_manager: &mut DmaManager, _repeaters: &mut [repeater::Rep } } -fn process_aux_packets(dma_manager: &mut DmaManager, repeaters: &mut [repeater::Repeater], +fn process_aux_packets(dma_manager: &mut DmaManager, analyzer: &mut Analyzer, + repeaters: &mut [repeater::Repeater], routing_table: &mut drtio_routing::RoutingTable, rank: &mut u8) { let result = drtioaux::recv(0).and_then(|packet| { if let Some(packet) = packet { - process_aux_packet(dma_manager, repeaters, routing_table, rank, packet) + process_aux_packet(dma_manager, analyzer, repeaters, routing_table, rank, packet) } else { Ok(()) } @@ -558,7 +574,7 @@ pub extern fn main() -> i32 { let mut dma_manager = DmaManager::new(); // Reset the analyzer as well. - analyzer::arm(); + let mut analyzer = Analyzer::new(); drtioaux::reset(0); drtiosat_reset(false); @@ -566,7 +582,7 @@ pub extern fn main() -> i32 { while drtiosat_link_rx_up() { drtiosat_process_errors(); - process_aux_packets(&mut dma_manager, &mut repeaters, &mut routing_table, &mut rank); + process_aux_packets(&mut dma_manager, &mut analyzer, &mut repeaters, &mut routing_table, &mut rank); for rep in repeaters.iter_mut() { rep.service(&routing_table, rank); } From ab52748cac198618e84d14217a791b96fe41dc76 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 19 May 2023 10:23:01 +0800 Subject: [PATCH 12/20] analyzer sat: disarm on drop --- artiq/firmware/satman/analyzer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/artiq/firmware/satman/analyzer.rs b/artiq/firmware/satman/analyzer.rs index 189d931f6..c597196a1 100644 --- a/artiq/firmware/satman/analyzer.rs +++ b/artiq/firmware/satman/analyzer.rs @@ -60,6 +60,10 @@ impl Analyzer { } } + fn drop(&mut self) { + disarm(); + } + pub fn get_header(&mut self) -> Header { disarm(); From c1d6fd4bbe9292802ba9c3f9f54a1879369513c8 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 19 May 2023 11:26:13 +0800 Subject: [PATCH 13/20] satman analyzer: remove forgotten comment --- artiq/firmware/satman/analyzer.rs | 40 ------------------------------- 1 file changed, 40 deletions(-) diff --git a/artiq/firmware/satman/analyzer.rs b/artiq/firmware/satman/analyzer.rs index c597196a1..8ad021c2f 100644 --- a/artiq/firmware/satman/analyzer.rs +++ b/artiq/firmware/satman/analyzer.rs @@ -103,43 +103,3 @@ impl Analyzer { } } } - - -// pub fn send() -> Result<(), drtioaux::Error> { -// let data = unsafe { &BUFFER.data[..] }; -// let overflow_occurred = unsafe { csr::rtio_analyzer::message_encoder_overflow_read() != 0 }; -// let total_byte_count = unsafe { csr::rtio_analyzer::dma_byte_count_read() }; -// let pointer = (total_byte_count % BUFFER_SIZE as u64) as usize; -// let wraparound = total_byte_count >= BUFFER_SIZE as u64; -// let sent_bytes = if wraparound { BUFFER_SIZE } else { total_byte_count as usize }; - -// drtioaux::send(0, &drtioaux::Packet::AnalyzerHeader { -// total_byte_count: total_byte_count, -// sent_bytes: sent_bytes as u32, -// overflow_occurred: overflow_occurred, -// })?; - -// info!("header sent, total bytes: {}; sent: {}, overflow: {}", total_byte_count, sent_bytes, overflow_occurred); - -// let mut i = if wraparound { pointer } else { 0 }; -// while i < sent_bytes { -// let mut data_slice: [u8; ANALYZER_MAX_SIZE] = [0; ANALYZER_MAX_SIZE]; -// let len: usize = if i + ANALYZER_MAX_SIZE < sent_bytes { ANALYZER_MAX_SIZE } else { sent_bytes - i } as usize; -// let last = i + len == sent_bytes; -// if i + len >= BUFFER_SIZE { -// data_slice[..len].clone_from_slice(&data[i..BUFFER_SIZE]); -// data_slice[..len].clone_from_slice(&data[..(i+len) % BUFFER_SIZE]); -// } else { -// data_slice[..len].clone_from_slice(&data[i..i+len]); -// } -// i += len; -// drtioaux::send(0, &drtioaux::Packet::AnalyzerData { -// last: last, -// length: len as u16, -// data: data_slice, -// })?; -// //info!("sent data, last: {}, length: {}", last, len); -// } - -// Ok(()) -// } From ea9fe9b4e1b43b4cbb4c79dea722e469540d2530 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Tue, 23 May 2023 04:15:39 +0100 Subject: [PATCH 14/20] dma: fix off-by-one error in RawSlicer (#2090) Signed-off-by: Jonathan Coates --- artiq/gateware/rtio/dma.py | 2 +- artiq/gateware/test/rtio/test_dma.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/artiq/gateware/rtio/dma.py b/artiq/gateware/rtio/dma.py index f81559dde..68d6a3877 100644 --- a/artiq/gateware/rtio/dma.py +++ b/artiq/gateware/rtio/dma.py @@ -122,7 +122,7 @@ class RawSlicer(Module): for i in range(out_size)})), If(shift_buf, Case(self.source_consume, {i: buf.eq(buf[i*g:]) - for i in range(out_size)})), + for i in range(out_size + 1)})), ] fsm = FSM(reset_state="FETCH") diff --git a/artiq/gateware/test/rtio/test_dma.py b/artiq/gateware/test/rtio/test_dma.py index 54b996b4f..42be76183 100644 --- a/artiq/gateware/test/rtio/test_dma.py +++ b/artiq/gateware/test/rtio/test_dma.py @@ -68,6 +68,7 @@ def do_dma(dut, address): test_writes1 = [ (0x01, 0x23, 0x12, 0x33), (0x901, 0x902, 0x11, 0xeeeeeeeeeeeeeefffffffffffffffffffffffffffffff28888177772736646717738388488), + (0x82, 0x289, 0x99, int.from_bytes(b"\xf0" * 64, "little")), (0x81, 0x288, 0x88, 0x8888) ] From 598c7b1d25ecbb496b585ab5e9169b165b2d5b90 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 23 May 2023 11:26:30 +0800 Subject: [PATCH 15/20] flake: update qasync --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 2d9a03c12..a7207c8b9 100644 --- a/flake.nix +++ b/flake.nix @@ -69,12 +69,12 @@ qasync = pkgs.python3Packages.buildPythonPackage rec { pname = "qasync"; - version = "0.19.0"; + version = "0.24.1"; src = pkgs.fetchFromGitHub { owner = "CabbageDevelopment"; repo = "qasync"; rev = "v${version}"; - sha256 = "sha256-xGAUAyOq+ELwzMGbLLmXijxLG8pv4a6tPvfAVOt1YwU="; + sha256 = "sha256-DAzmobw+c29Pt/URGO3bWXHBxgu9bDHhdTUBE9QJDe4="; }; propagatedBuildInputs = [ pkgs.python3Packages.pyqt5 ]; checkInputs = [ pkgs.python3Packages.pytest ]; From 58cc3b8d0a957b24834e08cb3fbe70c148fd17b4 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 23 May 2023 19:36:06 +0800 Subject: [PATCH 16/20] kasli_generic: fix LooseVersion deprecation warning --- artiq/gateware/targets/kasli_generic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/gateware/targets/kasli_generic.py b/artiq/gateware/targets/kasli_generic.py index 910ff46ca..3fc50b661 100755 --- a/artiq/gateware/targets/kasli_generic.py +++ b/artiq/gateware/targets/kasli_generic.py @@ -2,7 +2,7 @@ import argparse import logging -from distutils.version import LooseVersion +from packaging.version import Version from misoc.integration.builder import builder_args, builder_argdict from misoc.targets.kasli import soc_kasli_args, soc_kasli_argdict @@ -150,7 +150,7 @@ def main(): description = jsondesc.load(args.description) min_artiq_version = description.get("min_artiq_version", "0") - if LooseVersion(artiq_version) < LooseVersion(min_artiq_version): + if Version(artiq_version) < Version(min_artiq_version): logger.warning("ARTIQ version mismatch: current %s < %s minimum", artiq_version, min_artiq_version) From c2b0c97640ad4afca5b00fec9fc7ed350fde9dee Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Tue, 23 May 2023 20:42:10 +0100 Subject: [PATCH 17/20] worker: Wait until datasets are written before quitting Avoids a race condition in worker_impl.py where HDF5 dataset saving was cut off before it finished for large datasets. --- artiq/master/worker_impl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index ed7ec748e..7c5ad2c2f 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -347,12 +347,13 @@ def main(): elif action == "analyze": try: exp_inst.analyze() - put_completed() finally: # browser's analyze shouldn't write results, # since it doesn't run the experiment and cannot have rid if rid is not None: write_results() + + put_completed() elif action == "examine": examine(ExamineDeviceMgr, ExamineDatasetMgr, obj["file"]) put_completed() From b9c7905b204a15cb3d7b98cc47c69030af3745cd Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 27 May 2023 17:16:31 +0800 Subject: [PATCH 18/20] nixpkgs 23.05 --- artiq/firmware/ksupport/Makefile | 2 +- artiq/firmware/runtime/Makefile | 2 +- flake.lock | 28 ++++++++++++++-------------- flake.nix | 24 ++++++++++++++---------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/artiq/firmware/ksupport/Makefile b/artiq/firmware/ksupport/Makefile index e1e3e48fd..7a7e26d85 100644 --- a/artiq/firmware/ksupport/Makefile +++ b/artiq/firmware/ksupport/Makefile @@ -26,7 +26,7 @@ $(RUSTOUT)/libksupport.a: ksupport.elf: $(RUSTOUT)/libksupport.a glue.o $(link) -T $(KSUPPORT_DIRECTORY)/ksupport.ld \ - -lunwind-$(CPU)-elf -lprintf-float -lm + -lunwind-$(CPU)-libc -lprintf-float -lm %.o: $(KSUPPORT_DIRECTORY)/%.c $(compile) diff --git a/artiq/firmware/runtime/Makefile b/artiq/firmware/runtime/Makefile index 3e4b91ba3..0427d763f 100644 --- a/artiq/firmware/runtime/Makefile +++ b/artiq/firmware/runtime/Makefile @@ -22,7 +22,7 @@ $(RUSTOUT)/libruntime.a: runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o $(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \ - -lunwind-bare -m elf32lriscv + -lunwind-vexriscv-bare -m elf32lriscv ksupport_data.o: ../ksupport/ksupport.elf $(LD) -r -m elf32lriscv -b binary -o $@ $< diff --git a/flake.lock b/flake.lock index 81eff9ce0..ce6453721 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ "mozilla-overlay": { "flake": false, "locked": { - "lastModified": 1677493379, - "narHash": "sha256-A1gO8zlWLv3+tZ3cGVB1WYvvoN9pbFyv0xIJHcTsckw=", + "lastModified": 1684487559, + "narHash": "sha256-SZcJEM+NnLr8ctzeQf1BGAqBHzJ3jn+tdSeO7lszIJc=", "owner": "mozilla", "repo": "nixpkgs-mozilla", - "rev": "78e723925daf5c9e8d0a1837ec27059e61649cb6", + "rev": "e6ca26fe8b9df914d4567604e426fbc185d9ef3e", "type": "github" }, "original": { @@ -57,16 +57,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1682173319, - "narHash": "sha256-tPhOpJJ+wrWIusvGgIB2+x6ILfDkEgQMX0BTtM5vd/4=", + "lastModified": 1685004253, + "narHash": "sha256-AbVL1nN/TDicUQ5wXZ8xdLERxz/eJr7+o8lqkIOVuaE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ee7ec1c71adc47d2e3c2d5eb0d6b8fbbd42a8d1c", + "rev": "3e01645c40b92d29f3ae76344a6d654986a91a91", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.11", + "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } @@ -89,11 +89,11 @@ ] }, "locked": { - "lastModified": 1681290481, - "narHash": "sha256-VEZcGhbtJGonRrrWi31evNDVSerlLjEPL0MZGm9VlB8=", + "lastModified": 1685094262, + "narHash": "sha256-7DvbdTUYP7PbhZClT/tob66iMV95v7124RynMpPc5VA=", "owner": "m-labs", "repo": "sipyco", - "rev": "727631ada6e59dc6ef0ad50bfcc376d2ffe805aa", + "rev": "f1f0fc1d3071c5a6ba6dd613b54bb4176ad1e8dc", "type": "github" }, "original": { @@ -121,11 +121,11 @@ "src-misoc": { "flake": false, "locked": { - "lastModified": 1679903508, - "narHash": "sha256-TI0agjSSMJtH4mgAMpSO128zxcwSo/AjY1B6AW7zBQQ=", + "lastModified": 1685174995, + "narHash": "sha256-90UwWt9/TAaFAoYDpiIzHXqMWYfftlps8sodv/Gf07c=", "ref": "refs/heads/master", - "rev": "0cf0ebb7d4f56cc6d44a3dea3e386efab9d82419", - "revCount": 2437, + "rev": "d83499b318e8ef021b12e2df261707a165eb3afa", + "revCount": 2439, "submodules": true, "type": "git", "url": "https://github.com/m-labs/misoc.git" diff --git a/flake.nix b/flake.nix index a7207c8b9..24f1560aa 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "A leading-edge control system for quantum information experiments"; - inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-22.11; + inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05; inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; }; inputs.sipyco.url = github:m-labs/sipyco; inputs.sipyco.inputs.nixpkgs.follows = "nixpkgs"; @@ -44,7 +44,7 @@ }); vivadoDeps = pkgs: with pkgs; [ - libxcrypt + libxcrypt-legacy ncurses5 zlib libuuid @@ -77,10 +77,8 @@ sha256 = "sha256-DAzmobw+c29Pt/URGO3bWXHBxgu9bDHhdTUBE9QJDe4="; }; propagatedBuildInputs = [ pkgs.python3Packages.pyqt5 ]; - checkInputs = [ pkgs.python3Packages.pytest ]; - checkPhase = '' - pytest -k 'test_qthreadexec.py' # the others cause the test execution to be aborted, I think because of asyncio - ''; + nativeCheckInputs = [ pkgs.python3Packages.pytest-runner pkgs.python3Packages.pytestCheckHook ]; + disabledTestPaths = [ "tests/test_qeventloop.py" ]; }; outputcheck = pkgs.python3Packages.buildPythonApplication rec { @@ -136,8 +134,14 @@ wrapQtApp "$out/bin/artiq_session" ''; - # Modifies PATH to pass the wrapped python environment (i.e. python3.withPackages(...) to subprocesses. - # Allows subprocesses using python to find all packages you have installed + preFixup = + '' + # Ensure that wrapProgram uses makeShellWrapper rather than makeBinaryWrapper + # brought in by wrapQtAppsHook. Only makeShellWrapper supports --run. + wrapProgram() { wrapProgramShell "$@"; } + ''; + ## Modifies PATH to pass the wrapped python environment (i.e. python3.withPackages(...) to subprocesses. + ## Allows subprocesses using python to find all packages you have installed makeWrapperArgs = [ ''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' '' "--set FONTCONFIG_FILE ${pkgs.fontconfig.out}/etc/fonts/fonts.conf" @@ -146,7 +150,7 @@ # FIXME: automatically propagate lld_11 llvm_11 dependencies # cacert is required in the check stage only, as certificates are to be # obtained from system elsewhere - checkInputs = [ pkgs.lld_11 pkgs.llvm_11 libartiq-support pkgs.lit outputcheck pkgs.cacert ]; + nativeCheckInputs = [ pkgs.lld_11 pkgs.llvm_11 libartiq-support pkgs.lit outputcheck pkgs.cacert ]; checkPhase = '' python -m unittest discover -v artiq.test @@ -401,7 +405,7 @@ ]; shellHook = '' export LIBARTIQ_SUPPORT=`libartiq-support` - export QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtPluginPrefix} + export QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtPluginPrefix} export QML2_IMPORT_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtQmlPrefix} ''; }; From 779810163f3d85f092f3716b773ac0351926deb8 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 27 May 2023 17:40:36 +0800 Subject: [PATCH 19/20] flake: fix rustPlatform deprecation warnings --- flake.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 24f1560aa..db713e774 100644 --- a/flake.nix +++ b/flake.nix @@ -96,7 +96,7 @@ libartiq-support = pkgs.stdenv.mkDerivation { name = "libartiq-support"; src = self; - buildInputs = [ rustPlatform.rust.rustc ]; + buildInputs = [ rust ]; buildPhase = '' rustc $src/artiq/test/libartiq_support/lib.rs -Cpanic=unwind -g ''; @@ -225,8 +225,7 @@ }; nativeBuildInputs = [ (pkgs.python3.withPackages(ps: [ ps.jsonschema migen misoc (artiq.withExperimentalFeatures experimentalFeatures) ])) - rustPlatform.rust.rustc - rustPlatform.rust.cargo + rust pkgs.cargo-xbuild pkgs.llvmPackages_11.clang-unwrapped pkgs.llvm_11 @@ -386,8 +385,7 @@ name = "artiq-dev-shell"; buildInputs = [ (pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc artiq ps.paramiko ps.jsonschema microscope ])) - rustPlatform.rust.rustc - rustPlatform.rust.cargo + rust pkgs.cargo-xbuild pkgs.llvmPackages_11.clang-unwrapped pkgs.llvm_11 From ef2cc2cc125f0aa5fe6e92d87865b0b0bf1dae4c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 27 May 2023 18:03:18 +0800 Subject: [PATCH 20/20] flake: buildFHSUserEnv -> buildFHSEnv --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index db713e774..9d92902f4 100644 --- a/flake.nix +++ b/flake.nix @@ -201,12 +201,12 @@ propagatedBuildInputs = with pkgs.python3Packages; [ pyserial prettytable msgpack migen ]; }; - vivadoEnv = pkgs.buildFHSUserEnv { + vivadoEnv = pkgs.buildFHSEnv { name = "vivado-env"; targetPkgs = vivadoDeps; }; - vivado = pkgs.buildFHSUserEnv { + vivado = pkgs.buildFHSEnv { name = "vivado"; targetPkgs = vivadoDeps; profile = "set -e; source /opt/Xilinx/Vivado/2022.2/settings64.sh";