2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Module {
|
|
|
|
pub name: String,
|
|
|
|
pub addr: u32,
|
|
|
|
pub size: u32,
|
|
|
|
pub amod: Option<AmodValues>,
|
|
|
|
pub r#type: Option<DataType>,
|
|
|
|
pub desc: Option<String>,
|
|
|
|
pub elements_bitstring: Vec<BitString>,
|
|
|
|
pub elements_other: Vec<ModuleBlockElements>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub enum ModuleBlockElements {
|
|
|
|
Block(Block),
|
|
|
|
Register(Register),
|
|
|
|
Memory(Memory),
|
|
|
|
Fifo(Fifo),
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct BitString {
|
|
|
|
pub name: String,
|
|
|
|
pub size: Option<u32>,
|
|
|
|
pub mask: Option<u32>,
|
|
|
|
pub modf: Option<RwSpecifier>,
|
|
|
|
pub desc: Option<String>,
|
|
|
|
pub elements_field: Vec<Field>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Block {
|
|
|
|
pub name: String,
|
|
|
|
/// Fill this with proper calc.
|
|
|
|
pub addr: u32,
|
|
|
|
/// Fill this with proper calc.
|
2025-01-30 15:33:05 +09:00
|
|
|
pub r#type: Option<DataType>,
|
2025-01-29 18:48:22 +09:00
|
|
|
/// Fill this with proper calc.
|
2025-01-30 15:33:05 +09:00
|
|
|
pub modf: Option<RwSpecifier>,
|
2025-01-29 18:48:22 +09:00
|
|
|
// TODO: should this be expanded?
|
|
|
|
pub multiple: Option<MultipleParams>,
|
|
|
|
// TODO
|
|
|
|
pub decoder: String,
|
|
|
|
pub size: u32,
|
|
|
|
pub desc: Option<String>,
|
|
|
|
pub elements: Vec<ModuleBlockElements>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Register {
|
|
|
|
pub name: String,
|
|
|
|
/// Fill this with proper calc.
|
|
|
|
pub addr: u32,
|
|
|
|
pub mask: Option<u32>,
|
|
|
|
/// Fill this with proper calc.
|
|
|
|
pub modf: RwSpecifier,
|
|
|
|
pub multiple: Option<MultipleParams>,
|
|
|
|
pub default: Option<u32>,
|
|
|
|
pub desc: Option<String>,
|
|
|
|
// BitString?
|
|
|
|
pub elements: Vec<Field>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Memory {
|
|
|
|
pub name: String,
|
|
|
|
/// Fill this with proper calc.
|
|
|
|
pub addr: u32,
|
|
|
|
pub mask: Option<u32>,
|
|
|
|
/// Fill this with proper calc
|
|
|
|
pub modf: RwSpecifier,
|
|
|
|
pub dma: Option<bool>,
|
|
|
|
pub multiple: Option<MultipleParams>,
|
|
|
|
// BitString?
|
|
|
|
pub desc: Option<String>,
|
|
|
|
pub elements: Vec<Field>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Fifo {
|
|
|
|
pub name: String,
|
|
|
|
/// Fill this with proper calc.
|
|
|
|
pub addr: u32,
|
|
|
|
pub size: u32,
|
|
|
|
pub mask: Option<u32>,
|
|
|
|
/// Fill this with proper calc.
|
|
|
|
pub modf: RwSpecifier,
|
|
|
|
pub interface: Option<FieldFifoInterface>,
|
|
|
|
pub multiple: Option<MultipleParams>,
|
|
|
|
// BitString?
|
|
|
|
pub desc: String,
|
|
|
|
pub elements: Vec<Field>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Field {
|
|
|
|
pub name: String,
|
|
|
|
pub mask: u32,
|
|
|
|
pub interface: Option<FieldFifoInterface>,
|
|
|
|
pub multiple: Option<MultipleParams>,
|
|
|
|
pub default: Option<u32>,
|
|
|
|
// TODO
|
|
|
|
pub sclr: Option<bool>,
|
|
|
|
pub desc: Option<String>,
|
|
|
|
pub elements: Vec<Value>,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct Value {
|
|
|
|
pub name: String,
|
|
|
|
pub data: u32,
|
|
|
|
pub desc: Option<String>
|
|
|
|
}
|
|
|
|
|
2025-01-30 01:18:31 +09:00
|
|
|
#[derive(Debug, PartialEq)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub enum AmodValues {
|
|
|
|
A16,
|
|
|
|
A24,
|
|
|
|
A32,
|
|
|
|
CRCSR,
|
|
|
|
USER1,
|
|
|
|
USER2,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub enum DataType {
|
|
|
|
D32,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub enum RwSpecifier {
|
|
|
|
R,
|
|
|
|
W,
|
|
|
|
RW,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub struct MultipleParams {
|
|
|
|
pub multiple: u32,
|
|
|
|
pub offset: u32,
|
|
|
|
}
|
|
|
|
|
2025-01-29 21:19:44 +09:00
|
|
|
#[derive(Debug)]
|
2025-01-29 18:48:22 +09:00
|
|
|
pub enum FieldFifoInterface {
|
|
|
|
Vector,
|
|
|
|
Block,
|
|
|
|
Both,
|
|
|
|
}
|