Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Mar 5, 2024
1 parent e92ccf4 commit da9f65d
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 162 deletions.
41 changes: 24 additions & 17 deletions src/ghw/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,37 +191,44 @@ impl HeaderData {
/// Contains information needed in order to decode value changes.
#[derive(Debug, Default)]
pub struct GhwDecodeInfo {
pub signals: Vec<GhwSignal>,

}

impl GhwDecodeInfo {
pub fn get_tpe_and_signal_ref(pos_id: usize) -> (SignalType, SignalRef) {
todo!()
}

pub fn get_vec_id_and_start(pos_id: usize) -> (usize, u32) {
todo!()
}
}

/// Holds information from the header needed in order to read the corresponding data in the signal section.
#[derive(Debug, Clone)]
pub struct GhwSignal {
/// Signal ID in the wavemem Encoder.
pub signal_ref: SignalRef,
pub tpe: SignalType,
// currently used for debugging
pub alias_entry: Option<NonZeroU32>,


#[derive(Debug, Clone, Copy)]
pub struct GhwVecInfo {
max: NonZeroU32,
min: NonZeroU32,
}

/// Specifies the signal type info that is needed in order to read it.
#[derive(Debug, PartialEq, Copy, Clone)]
#[repr(u8)]
#[derive(Debug, PartialEq, Copy, Clone, TryFromPrimitive)]
pub enum SignalType {
/// Nine value signal encoded as a single byte.
NineState,
/// A single bit in a 9 value bit vector. bit N / M bits.
NineStateBit(u32, u32),
/// A single bit in a 9 value bit vector.
NineStateVec,
/// Two value signal encoded as a single byte.
TwoState,
/// A single bit in a 2 value bit vector. bit N / M bits.
TwoStateBit(u32, u32),
TwoStateVec,
/// Binary signal encoded as a single byte with N valid bits.
U8(u32),
U8,
/// Binary signal encoded as a variable number of bytes with N valid bits.
#[allow(dead_code)]
Leb128Signed(u32),
Leb128Signed,
/// F64 (real)
#[allow(dead_code)]
F64,
}

Expand Down
Loading

0 comments on commit da9f65d

Please sign in to comment.