mirror of
https://gitlab.cern.ch/wotsubo/endcap-sl-software-ri-generator.git
synced 2025-02-23 09:07:07 +09:00
add types
This commit is contained in:
parent
f64c225ea0
commit
202c900aea
3 changed files with 143 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
|
pub mod types;
|
||||||
|
|
|
@ -13,4 +13,8 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("Parsed: {:#?}", doc);
|
println!("Parsed: {:#?}", doc);
|
||||||
println!("Root: {:?}", doc.root_element());
|
println!("Root: {:?}", doc.root_element());
|
||||||
|
{
|
||||||
|
let root = doc.root_element();
|
||||||
|
println!("tag: {:?}", root.tag_name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
138
src/types.rs
Normal file
138
src/types.rs
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
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>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum ModuleBlockElements {
|
||||||
|
Block(Block),
|
||||||
|
Register(Register),
|
||||||
|
Memory(Memory),
|
||||||
|
Fifo(Fifo),
|
||||||
|
}
|
||||||
|
|
||||||
|
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>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Block {
|
||||||
|
pub name: String,
|
||||||
|
/// Fill this with proper calc.
|
||||||
|
pub addr: u32,
|
||||||
|
/// Fill this with proper calc.
|
||||||
|
pub r#type: DataType,
|
||||||
|
/// Fill this with proper calc.
|
||||||
|
pub modf: RwSpecifier,
|
||||||
|
// TODO: should this be expanded?
|
||||||
|
pub multiple: Option<MultipleParams>,
|
||||||
|
// TODO
|
||||||
|
pub decoder: String,
|
||||||
|
pub size: u32,
|
||||||
|
pub desc: Option<String>,
|
||||||
|
pub elements: Vec<ModuleBlockElements>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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>,
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
pub struct Field {
|
||||||
|
pub name: String,
|
||||||
|
/// TODO: is this optional?
|
||||||
|
pub mask: u32,
|
||||||
|
/// Fill this with proper calc.
|
||||||
|
pub modf: RwSpecifier,
|
||||||
|
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>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Value {
|
||||||
|
pub name: String,
|
||||||
|
pub data: u32,
|
||||||
|
pub desc: Option<String>
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum AmodValues {
|
||||||
|
A16,
|
||||||
|
A24,
|
||||||
|
A32,
|
||||||
|
CRCSR,
|
||||||
|
USER1,
|
||||||
|
USER2,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum DataType {
|
||||||
|
D32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum RwSpecifier {
|
||||||
|
R,
|
||||||
|
W,
|
||||||
|
RW,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MultipleParams {
|
||||||
|
pub multiple: u32,
|
||||||
|
pub offset: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum FieldFifoInterface {
|
||||||
|
Vector,
|
||||||
|
Block,
|
||||||
|
Both,
|
||||||
|
}
|
Loading…
Reference in a new issue