Add signal type query
This commit is contained in:
parent
0df20db383
commit
dba5773ebe
4 changed files with 68 additions and 45 deletions
|
@ -11,8 +11,8 @@ use num::BigUint;
|
|||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct LsbIdxOfTmstmpValOnTmln(pub(super) u32);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum SigType {
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum SignalType {
|
||||
Event,
|
||||
Integer,
|
||||
Parameter,
|
||||
|
@ -55,6 +55,11 @@ impl<'a> Signal<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn signal_type(&self) -> Option<&SignalType> {
|
||||
let Signal(signal_enum) = &self;
|
||||
signal_enum.signal_type()
|
||||
}
|
||||
|
||||
pub fn real_idx(&self) -> SignalIdx {
|
||||
match self.0 {
|
||||
SignalEnum::Data { self_idx, .. } => *self_idx,
|
||||
|
@ -129,7 +134,7 @@ pub(super) enum SignalEnum {
|
|||
Data {
|
||||
name: String,
|
||||
path: Vec<String>,
|
||||
sig_type: SigType,
|
||||
signal_type: SignalType,
|
||||
/// I've seen a 0 bit signal parameter in a xilinx
|
||||
/// simulation before that gets assigned 1 bit values.
|
||||
/// I consider this to be bad behavior. We capture such
|
||||
|
@ -204,6 +209,15 @@ impl SignalEnum {
|
|||
}
|
||||
.clone()
|
||||
}
|
||||
|
||||
pub fn signal_type(&self) -> Option<&SignalType> {
|
||||
match self {
|
||||
SignalEnum::Data { signal_type, .. } => Some(signal_type),
|
||||
// TODO: Follow aliases?
|
||||
SignalEnum::Alias { .. } => None,
|
||||
}
|
||||
.clone()
|
||||
}
|
||||
}
|
||||
|
||||
// helper functions ultimately used by Signal's query functions later on
|
||||
|
|
Reference in a new issue