Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/nodes/lib/rushB/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
//! Shared Rust contract for the backend-neutral rushB host ABI.
//! Backend-neutral rushB protocol and runtime.

mod protocol;
mod runtime;

pub use protocol::{CommandId, DmaChunk, DmaOperation, RushCommand, RushEvent, RushEventKind, RushResponse, WaitMode};
pub use runtime::{RushBackend, RushMessage, RushRequest, RushRuntime};

pub const FUNCT7_FENCE: u32 = 0;
pub const FUNCT7_MVOUT: u32 = 16;
Expand Down
52 changes: 52 additions & 0 deletions src/nodes/lib/rushB/src/protocol.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pub type CommandId = u64;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct RushCommand {
pub id: CommandId,
pub core_id: u32,
pub xs1: u64,
pub xs2: u64,
pub funct7: u32,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum WaitMode {
Accepted,
Completed,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum RushEventKind {
Accepted,
Completed,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct RushEvent {
pub command_id: CommandId,
pub core_id: u32,
pub kind: RushEventKind,
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DmaChunk {
pub offset: usize,
pub data: Vec<u8>,
}

#[derive(Debug)]
pub enum DmaOperation {
None,
Mvin {
spans: Vec<(usize, usize)>,
chunks: Vec<DmaChunk>,
},
Mvout {
spans: Vec<(usize, usize)>,
},
}

#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct RushResponse {
pub output: Vec<DmaChunk>,
}
Loading