- improve to-do list in README

- move code that exercises searching for values at specific time
   within signals from src/vcd/parse.rs to sr/vcd/main.rs
 - make necessary struct and enum fields public as well as possibly the
   structs and enums themselves
This commit is contained in:
Yehowshua Immanuel 2022-09-02 17:00:14 -04:00
parent c25353073b
commit f4e27ffcb6
6 changed files with 39 additions and 30 deletions

View file

@ -39,20 +39,6 @@ pub fn parse_vcd(file: File) -> Result<VCD, String> {
parse_scopes(&mut word_gen, &mut vcd, &mut signal_map)?;
parse_events(&mut word_gen, &mut vcd, &mut signal_map)?;
let signal = vcd.try_dereference_alias(signal_map.get("Q").unwrap())?;
let name = match signal {
Signal::Data { name, .. } => name,
_ => "ERROR",
};
let val = signal
.query_num_val_on_tmln(
BigUint::from(4687u32),
&vcd.tmstmps_encoded_as_u8s,
&vcd.all_signals,
)
.unwrap();
dbg!(format!("{val:#X}"));
dbg!(name);
Ok(vcd)
}
@ -93,8 +79,6 @@ mod tests {
dbg!(file_name);
vcd.unwrap();
}
// assert!(vcd.is_ok());
}
}
}

View file

@ -7,7 +7,7 @@ use num::{BigUint, Zero};
pub struct LsbIdxOfTmstmpValOnTmln(pub(super) u32);
#[derive(Debug)]
pub(super) enum SigType {
pub enum SigType {
Integer,
Parameter,
Real,
@ -25,7 +25,7 @@ pub(super) enum TimelineQueryResults {
}
#[derive(Debug)]
pub(super) enum Signal {
pub enum Signal {
Data {
name: String,
sig_type: SigType,
@ -69,7 +69,7 @@ pub(super) enum Signal {
}
#[derive(Debug)]
pub(super) enum SignalErrors {
pub enum SignalErrors {
PreTimeline {
desired_time: BigUint,
timeline_start_time: BigUint,

View file

@ -24,10 +24,10 @@ pub(super) struct Metadata {
// We do a lot of arena allocation in this codebase.
#[derive(Debug, Copy, Clone)]
pub(super) struct ScopeIdx(pub(super) usize);
pub struct ScopeIdx(pub(super) usize);
#[derive(Debug, Copy, Clone, PartialEq)]
pub(super) struct SignalIdx(pub(super) usize);
pub struct SignalIdx(pub(super) usize);
#[derive(Debug)]
pub(super) struct Scope {
@ -54,7 +54,7 @@ pub struct VCD {
// keep track of all timestamp values, a given signal only needs to keep
// track of the timestamps at which the given signal value changes.
pub tmstmps_encoded_as_u8s: Vec<u8>,
pub(super) all_signals: Vec<Signal>,
pub all_signals: Vec<Signal>,
pub(super) all_scopes: Vec<Scope>,
pub(super) root_scopes: Vec<ScopeIdx>,
}