forked from M-Labs/artiq-zynq
Compare commits
3 Commits
4d3895094d
...
bc53d87539
Author | SHA1 | Date |
---|---|---|
Simon Renblad | bc53d87539 | |
Simon Renblad | 343831f438 | |
Simon Renblad | f13a554596 |
|
@ -1,70 +0,0 @@
|
||||||
core_addr = "192.168.1.57"
|
|
||||||
|
|
||||||
device_db = {
|
|
||||||
"core": {
|
|
||||||
"type": "local",
|
|
||||||
"module": "artiq.coredevice.core",
|
|
||||||
"class": "Core",
|
|
||||||
"arguments": {
|
|
||||||
"host": core_addr,
|
|
||||||
"ref_period": 1e-9,
|
|
||||||
"target": "cortexa9",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"core_log": {
|
|
||||||
"type": "controller",
|
|
||||||
"host": "::1",
|
|
||||||
"port": 1068,
|
|
||||||
"command": "aqctl_corelog -p {port} --bind {bind} " + core_addr,
|
|
||||||
},
|
|
||||||
"core_moninj": {
|
|
||||||
"type": "controller",
|
|
||||||
"host": "::1",
|
|
||||||
"port_proxy": 1383,
|
|
||||||
"port": 1384,
|
|
||||||
"command": "aqctl_moninj_proxy --port-proxy {port_proxy} --port-control {port} --bind {bind} "
|
|
||||||
+ core_addr,
|
|
||||||
},
|
|
||||||
"core_analyzer": {
|
|
||||||
"type": "controller",
|
|
||||||
"host": "::1",
|
|
||||||
"port_proxy": 1385,
|
|
||||||
"port": 1386,
|
|
||||||
"command": "aqctl_coreanalyzer_proxy --port-proxy {port_proxy} --port-control {port} --bind {bind} "
|
|
||||||
+ core_addr,
|
|
||||||
},
|
|
||||||
"core_cache": {
|
|
||||||
"type": "local",
|
|
||||||
"module": "artiq.coredevice.cache",
|
|
||||||
"class": "CoreCache",
|
|
||||||
},
|
|
||||||
"core_dma": {"type": "local", "module": "artiq.coredevice.dma", "class": "CoreDMA"},
|
|
||||||
"led0": {
|
|
||||||
"type": "local",
|
|
||||||
"module": "artiq.coredevice.ttl",
|
|
||||||
"class": "TTLOut",
|
|
||||||
"arguments": {"channel": 0},
|
|
||||||
},
|
|
||||||
"led1": {
|
|
||||||
"type": "local",
|
|
||||||
"module": "artiq.coredevice.ttl",
|
|
||||||
"class": "TTLOut",
|
|
||||||
"arguments": {"channel": 1},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
device_db.update(
|
|
||||||
spi0={
|
|
||||||
"type": "local",
|
|
||||||
"module": "artiq.coredevice.spi2",
|
|
||||||
"class": "SPIMaster",
|
|
||||||
"arguments": {"channel": 2},
|
|
||||||
},
|
|
||||||
dds0={
|
|
||||||
"type": "local",
|
|
||||||
"module": "artiq.coredevice.ad9834",
|
|
||||||
"class": "AD9834",
|
|
||||||
"arguments": {"spi_device": "spi0"},
|
|
||||||
},
|
|
||||||
)
|
|
|
@ -384,9 +384,9 @@ checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nalgebra"
|
name = "nalgebra"
|
||||||
version = "0.33.1"
|
version = "0.33.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3bf139e93ad757869338ad85239cb1d6c067b23b94e5846e637ca6328ee4be60"
|
checksum = "3c4b5f057b303842cf3262c27e465f4c303572e7f6b0648f60e16248ac3397f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx",
|
"approx",
|
||||||
"num-complex",
|
"num-complex",
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import analyzer
|
|
||||||
import dma
|
|
||||||
from artiq.gateware import rtio
|
|
||||||
from artiq.gateware.rtio.phy import dds, spi2, ttl_simple
|
|
||||||
from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path
|
|
||||||
from config import write_csr_file, write_mem_file, write_rustc_cfg_file
|
|
||||||
from migen import *
|
from migen import *
|
||||||
from migen.build.generic_platform import IOStandard, Misc, Pins, Subsignal
|
|
||||||
from migen.build.platforms import ebaz4205
|
from migen.build.platforms import ebaz4205
|
||||||
|
from migen.build.generic_platform import Pins, Subsignal, IOStandard, Misc
|
||||||
from migen_axi.integration.soc_core import SoCCore
|
from migen_axi.integration.soc_core import SoCCore
|
||||||
from misoc.interconnect.csr import *
|
from misoc.interconnect.csr import *
|
||||||
|
|
||||||
|
from artiq.gateware import rtio
|
||||||
|
from artiq.gateware.rtio.phy import ttl_simple
|
||||||
|
from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path
|
||||||
|
|
||||||
|
import dma
|
||||||
|
import analyzer
|
||||||
|
|
||||||
|
from config import write_csr_file, write_mem_file, write_rustc_cfg_file
|
||||||
|
|
||||||
_ps = [
|
_ps = [
|
||||||
(
|
(
|
||||||
"ps",
|
"ps",
|
||||||
|
@ -79,17 +83,6 @@ _i2c = [
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
_spi = [
|
|
||||||
(
|
|
||||||
"spi",
|
|
||||||
0,
|
|
||||||
Subsignal("clk", Pins("V20")),
|
|
||||||
Subsignal("mosi", Pins("U20")),
|
|
||||||
Subsignal("cs_n", Pins("P19")),
|
|
||||||
IOStandard("LVCMOS33"),
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class EBAZ4205(SoCCore):
|
class EBAZ4205(SoCCore):
|
||||||
def __init__(self, rtio_clk=125e6, acpki=False):
|
def __init__(self, rtio_clk=125e6, acpki=False):
|
||||||
|
@ -104,7 +97,6 @@ class EBAZ4205(SoCCore):
|
||||||
platform.add_extension(_ps)
|
platform.add_extension(_ps)
|
||||||
platform.add_extension(_ddr)
|
platform.add_extension(_ddr)
|
||||||
platform.add_extension(_i2c)
|
platform.add_extension(_i2c)
|
||||||
platform.add_extension(_spi)
|
|
||||||
|
|
||||||
gmii = platform.request("gmii")
|
gmii = platform.request("gmii")
|
||||||
platform.add_period_constraint(gmii.rx_clk, 10)
|
platform.add_period_constraint(gmii.rx_clk, 10)
|
||||||
|
@ -179,11 +171,6 @@ class EBAZ4205(SoCCore):
|
||||||
phy = ttl_simple.Output(user_led)
|
phy = ttl_simple.Output(user_led)
|
||||||
self.submodules += phy
|
self.submodules += phy
|
||||||
self.rtio_channels.append(rtio.Channel.from_phy(phy))
|
self.rtio_channels.append(rtio.Channel.from_phy(phy))
|
||||||
|
|
||||||
print("SPI at RTIO channel 0x{:06x}".format(len(self.rtio_channels)))
|
|
||||||
spi_phy = spi2.SPIMaster(platform.request("spi"))
|
|
||||||
self.submodules += spi_phy
|
|
||||||
self.rtio_channels.append(rtio.Channel.from_phy(spi_phy, ififo_depth=4))
|
|
||||||
self.config["RTIO_LOG_CHANNEL"] = len(self.rtio_channels)
|
self.config["RTIO_LOG_CHANNEL"] = len(self.rtio_channels)
|
||||||
self.rtio_channels.append(rtio.LogChannel())
|
self.rtio_channels.append(rtio.LogChannel())
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,6 @@ pub enum Packet {
|
||||||
destination: u8,
|
destination: u8,
|
||||||
id: u32,
|
id: u32,
|
||||||
run: bool,
|
run: bool,
|
||||||
timestamp: u64,
|
|
||||||
},
|
},
|
||||||
SubkernelLoadRunReply {
|
SubkernelLoadRunReply {
|
||||||
destination: u8,
|
destination: u8,
|
||||||
|
@ -515,7 +514,6 @@ impl Packet {
|
||||||
destination: reader.read_u8()?,
|
destination: reader.read_u8()?,
|
||||||
id: reader.read_u32()?,
|
id: reader.read_u32()?,
|
||||||
run: reader.read_bool()?,
|
run: reader.read_bool()?,
|
||||||
timestamp: reader.read_u64()?,
|
|
||||||
},
|
},
|
||||||
0xc5 => Packet::SubkernelLoadRunReply {
|
0xc5 => Packet::SubkernelLoadRunReply {
|
||||||
destination: reader.read_u8()?,
|
destination: reader.read_u8()?,
|
||||||
|
@ -879,14 +877,12 @@ impl Packet {
|
||||||
destination,
|
destination,
|
||||||
id,
|
id,
|
||||||
run,
|
run,
|
||||||
timestamp,
|
|
||||||
} => {
|
} => {
|
||||||
writer.write_u8(0xc4)?;
|
writer.write_u8(0xc4)?;
|
||||||
writer.write_u8(source)?;
|
writer.write_u8(source)?;
|
||||||
writer.write_u8(destination)?;
|
writer.write_u8(destination)?;
|
||||||
writer.write_u32(id)?;
|
writer.write_u32(id)?;
|
||||||
writer.write_bool(run)?;
|
writer.write_bool(run)?;
|
||||||
writer.write_u64(timestamp)?;
|
|
||||||
}
|
}
|
||||||
Packet::SubkernelLoadRunReply { destination, succeeded } => {
|
Packet::SubkernelLoadRunReply { destination, succeeded } => {
|
||||||
writer.write_u8(0xc5)?;
|
writer.write_u8(0xc5)?;
|
||||||
|
|
|
@ -25,14 +25,12 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn attribute_writeback(typeinfo: *const ()) {
|
unsafe fn attribute_writeback(typeinfo: *const ()) {
|
||||||
#[repr(C)]
|
|
||||||
struct Attr {
|
struct Attr {
|
||||||
offset: usize,
|
offset: usize,
|
||||||
tag: CSlice<'static, u8>,
|
tag: CSlice<'static, u8>,
|
||||||
name: CSlice<'static, u8>,
|
name: CSlice<'static, u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
struct Type {
|
struct Type {
|
||||||
attributes: *const *const Attr,
|
attributes: *const *const Attr,
|
||||||
objects: *const *const (),
|
objects: *const *const (),
|
||||||
|
|
|
@ -81,7 +81,6 @@ pub enum Message {
|
||||||
id: u32,
|
id: u32,
|
||||||
destination: u8,
|
destination: u8,
|
||||||
run: bool,
|
run: bool,
|
||||||
timestamp: u64,
|
|
||||||
},
|
},
|
||||||
#[cfg(has_drtio)]
|
#[cfg(has_drtio)]
|
||||||
SubkernelLoadRunReply {
|
SubkernelLoadRunReply {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use alloc::vec::Vec;
|
||||||
use cslice::CSlice;
|
use cslice::CSlice;
|
||||||
|
|
||||||
use super::{Message, SubkernelStatus, KERNEL_CHANNEL_0TO1, KERNEL_CHANNEL_1TO0};
|
use super::{Message, SubkernelStatus, KERNEL_CHANNEL_0TO1, KERNEL_CHANNEL_1TO0};
|
||||||
use crate::{artiq_raise, eh_artiq, rpc::send_args, rtio::now_mu};
|
use crate::{artiq_raise, eh_artiq, rpc::send_args};
|
||||||
|
|
||||||
pub extern "C" fn load_run(id: u32, destination: u8, run: bool) {
|
pub extern "C" fn load_run(id: u32, destination: u8, run: bool) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -14,7 +14,6 @@ pub extern "C" fn load_run(id: u32, destination: u8, run: bool) {
|
||||||
id: id,
|
id: id,
|
||||||
destination: destination,
|
destination: destination,
|
||||||
run: run,
|
run: run,
|
||||||
timestamp: now_mu() as u64,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
match unsafe { KERNEL_CHANNEL_0TO1.as_mut().unwrap() }.recv() {
|
match unsafe { KERNEL_CHANNEL_0TO1.as_mut().unwrap() }.recv() {
|
||||||
|
|
|
@ -405,9 +405,8 @@ async fn handle_run_kernel(
|
||||||
id,
|
id,
|
||||||
destination: _,
|
destination: _,
|
||||||
run,
|
run,
|
||||||
timestamp,
|
|
||||||
} => {
|
} => {
|
||||||
let succeeded = match subkernel::load(aux_mutex, routing_table, timer, id, run, timestamp).await {
|
let succeeded = match subkernel::load(aux_mutex, routing_table, timer, id, run).await {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error loading subkernel: {:?}", e);
|
error!("Error loading subkernel: {:?}", e);
|
||||||
|
|
|
@ -38,7 +38,6 @@ where
|
||||||
let ptr = storage as *mut u32;
|
let ptr = storage as *mut u32;
|
||||||
let dest = core::slice::from_raw_parts_mut(ptr as *mut u8, length * 4);
|
let dest = core::slice::from_raw_parts_mut(ptr as *mut u8, length * 4);
|
||||||
proto_async::read_chunk(stream, dest).await?;
|
proto_async::read_chunk(stream, dest).await?;
|
||||||
drop(dest);
|
|
||||||
let dest = core::slice::from_raw_parts_mut(ptr, length);
|
let dest = core::slice::from_raw_parts_mut(ptr, length);
|
||||||
NativeEndian::from_slice_u32(dest);
|
NativeEndian::from_slice_u32(dest);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,6 @@ where
|
||||||
let ptr = storage as *mut u64;
|
let ptr = storage as *mut u64;
|
||||||
let dest = core::slice::from_raw_parts_mut(ptr as *mut u8, length * 8);
|
let dest = core::slice::from_raw_parts_mut(ptr as *mut u8, length * 8);
|
||||||
proto_async::read_chunk(stream, dest).await?;
|
proto_async::read_chunk(stream, dest).await?;
|
||||||
drop(dest);
|
|
||||||
let dest = core::slice::from_raw_parts_mut(ptr, length);
|
let dest = core::slice::from_raw_parts_mut(ptr, length);
|
||||||
NativeEndian::from_slice_u64(dest);
|
NativeEndian::from_slice_u64(dest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -792,7 +792,6 @@ pub mod drtio {
|
||||||
id: u32,
|
id: u32,
|
||||||
destination: u8,
|
destination: u8,
|
||||||
run: bool,
|
run: bool,
|
||||||
timestamp: u64,
|
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let linkno = routing_table.0[destination as usize][0] - 1;
|
let linkno = routing_table.0[destination as usize][0] - 1;
|
||||||
let reply = aux_transact(
|
let reply = aux_transact(
|
||||||
|
@ -804,7 +803,6 @@ pub mod drtio {
|
||||||
source: 0,
|
source: 0,
|
||||||
destination: destination,
|
destination: destination,
|
||||||
run: run,
|
run: run,
|
||||||
timestamp,
|
|
||||||
},
|
},
|
||||||
timer,
|
timer,
|
||||||
)
|
)
|
||||||
|
|
|
@ -100,22 +100,12 @@ pub async fn load(
|
||||||
timer: GlobalTimer,
|
timer: GlobalTimer,
|
||||||
id: u32,
|
id: u32,
|
||||||
run: bool,
|
run: bool,
|
||||||
timestamp: u64,
|
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
if let Some(subkernel) = SUBKERNELS.async_lock().await.get_mut(&id) {
|
if let Some(subkernel) = SUBKERNELS.async_lock().await.get_mut(&id) {
|
||||||
if subkernel.state != SubkernelState::Uploaded {
|
if subkernel.state != SubkernelState::Uploaded {
|
||||||
return Err(Error::IncorrectState);
|
return Err(Error::IncorrectState);
|
||||||
}
|
}
|
||||||
drtio::subkernel_load(
|
drtio::subkernel_load(aux_mutex, routing_table, timer, id, subkernel.destination, run).await?;
|
||||||
aux_mutex,
|
|
||||||
routing_table,
|
|
||||||
timer,
|
|
||||||
id,
|
|
||||||
subkernel.destination,
|
|
||||||
run,
|
|
||||||
timestamp,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
if run {
|
if run {
|
||||||
subkernel.state = SubkernelState::Running;
|
subkernel.state = SubkernelState::Running;
|
||||||
}
|
}
|
||||||
|
|
|
@ -826,7 +826,6 @@ fn process_aux_packet(
|
||||||
destination: _destination,
|
destination: _destination,
|
||||||
id,
|
id,
|
||||||
run,
|
run,
|
||||||
timestamp,
|
|
||||||
} => {
|
} => {
|
||||||
forward!(
|
forward!(
|
||||||
router,
|
router,
|
||||||
|
@ -845,7 +844,7 @@ fn process_aux_packet(
|
||||||
// cannot run kernel while DDMA is running
|
// cannot run kernel while DDMA is running
|
||||||
succeeded = false;
|
succeeded = false;
|
||||||
} else {
|
} else {
|
||||||
succeeded |= kernel_manager.run(source, id, timestamp).is_ok();
|
succeeded |= kernel_manager.run(source, id).is_ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
router.send(
|
router.send(
|
||||||
|
|
|
@ -356,7 +356,7 @@ impl<'a> Manager<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(&mut self, source: u8, id: u32, timestamp: u64) -> Result<(), Error> {
|
pub fn run(&mut self, source: u8, id: u32) -> Result<(), Error> {
|
||||||
if self.session.kernel_state != KernelState::Loaded || self.session.id != id {
|
if self.session.kernel_state != KernelState::Loaded || self.session.id != id {
|
||||||
self.load(id)?;
|
self.load(id)?;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,6 @@ impl<'a> Manager<'_> {
|
||||||
csr::cri_con::selected_write(2);
|
csr::cri_con::selected_write(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtio::at_mu(timestamp as i64);
|
|
||||||
self.control.tx.send(kernel::Message::StartRequest);
|
self.control.tx.send(kernel::Message::StartRequest);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -869,7 +868,6 @@ impl<'a> Manager<'_> {
|
||||||
id,
|
id,
|
||||||
destination: sk_destination,
|
destination: sk_destination,
|
||||||
run,
|
run,
|
||||||
timestamp,
|
|
||||||
} => {
|
} => {
|
||||||
self.session.kernel_state = KernelState::SubkernelAwaitLoad;
|
self.session.kernel_state = KernelState::SubkernelAwaitLoad;
|
||||||
router.route(
|
router.route(
|
||||||
|
@ -878,7 +876,6 @@ impl<'a> Manager<'_> {
|
||||||
destination: sk_destination,
|
destination: sk_destination,
|
||||||
id: id,
|
id: id,
|
||||||
run: run,
|
run: run,
|
||||||
timestamp,
|
|
||||||
},
|
},
|
||||||
routing_table,
|
routing_table,
|
||||||
rank,
|
rank,
|
||||||
|
|
Loading…
Reference in New Issue