- 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:
parent
c25353073b
commit
f4e27ffcb6
14
README.md
14
README.md
|
@ -68,14 +68,20 @@ Here's a command to test on a malformed VCD:
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
## Features and Other
|
## Features and Other
|
||||||
- [ ] add timeline value scanner code
|
- [ ] add documenting comments
|
||||||
- [ ] test against large waveform directly within SpinalHDL
|
- [ ] add lz4 compression support and compare memory perf before and after
|
||||||
|
- [ ] add string support for timeline value scanner
|
||||||
|
- [ ] test against large waveforms from the
|
||||||
|
[verilog-vcd-parser](https://github.com/ben-marshall/verilog-vcd-parser)
|
||||||
|
tool
|
||||||
- [ ] (a bit of work) consolidate error messages in validation phase
|
- [ ] (a bit of work) consolidate error messages in validation phase
|
||||||
|
- [ ] once the access patterns of the GUI frontend are well understood,
|
||||||
|
create specific functions and restrict as many types to private
|
||||||
|
as possible
|
||||||
- [ ] be explicit with imports, remove exports as possible
|
- [ ] be explicit with imports, remove exports as possible
|
||||||
once FastWave is known to be fairly stable.
|
once FastWave is known to be fairly stable.
|
||||||
- [ ] do a read through all the code
|
|
||||||
- make contents of src/types.rs public as necessary.
|
|
||||||
- [ ] Print out git commit or release number.
|
- [ ] Print out git commit or release number.
|
||||||
|
- [ ] do a read through all the code - look for uneeded code
|
||||||
- [ ] Take a look at GTKWave parser to compare efficiency.
|
- [ ] Take a look at GTKWave parser to compare efficiency.
|
||||||
- [ ] Move part of the performance section to another markdown file.
|
- [ ] Move part of the performance section to another markdown file.
|
||||||
|
|
||||||
|
|
25
src/main.rs
25
src/main.rs
|
@ -4,7 +4,9 @@ use std::fs::File;
|
||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
pub mod vcd;
|
pub mod vcd;
|
||||||
use vcd::parse_vcd;
|
use vcd::*;
|
||||||
|
|
||||||
|
use num::BigUint;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
|
@ -20,12 +22,29 @@ fn main() -> std::io::Result<()> {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
let file = File::open(&args.path)?;
|
let file = File::open(&args.path)?;
|
||||||
parse_vcd(file).unwrap();
|
let vcd = parse_vcd(file).unwrap();
|
||||||
|
|
||||||
let elapsed = now.elapsed();
|
let elapsed = now.elapsed();
|
||||||
println!("Elapsed: {:.2?}", elapsed);
|
println!("Elapsed: {:.2?}", elapsed);
|
||||||
|
|
||||||
// std::thread::sleep(std::time::Duration::from_secs(10));
|
// the following is really only for test-vcd-files/icarus/CPU.vcd
|
||||||
|
// at the moment
|
||||||
|
if args.path.as_os_str().to_str().unwrap() == "test-vcd-files/icarus/CPU.vcd" {
|
||||||
|
let signal = &vcd.all_signals[51];
|
||||||
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ mod parse;
|
||||||
pub use parse::*;
|
pub use parse::*;
|
||||||
|
|
||||||
mod signal;
|
mod signal;
|
||||||
use signal::*;
|
pub use signal::*;
|
||||||
|
|
||||||
mod utilities;
|
mod utilities;
|
||||||
use utilities::*;
|
use utilities::*;
|
||||||
|
|
|
@ -39,20 +39,6 @@ pub fn parse_vcd(file: File) -> Result<VCD, String> {
|
||||||
|
|
||||||
parse_scopes(&mut word_gen, &mut vcd, &mut signal_map)?;
|
parse_scopes(&mut word_gen, &mut vcd, &mut signal_map)?;
|
||||||
parse_events(&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)
|
Ok(vcd)
|
||||||
}
|
}
|
||||||
|
@ -93,8 +79,6 @@ mod tests {
|
||||||
dbg!(file_name);
|
dbg!(file_name);
|
||||||
vcd.unwrap();
|
vcd.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// assert!(vcd.is_ok());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use num::{BigUint, Zero};
|
||||||
pub struct LsbIdxOfTmstmpValOnTmln(pub(super) u32);
|
pub struct LsbIdxOfTmstmpValOnTmln(pub(super) u32);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) enum SigType {
|
pub enum SigType {
|
||||||
Integer,
|
Integer,
|
||||||
Parameter,
|
Parameter,
|
||||||
Real,
|
Real,
|
||||||
|
@ -25,7 +25,7 @@ pub(super) enum TimelineQueryResults {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) enum Signal {
|
pub enum Signal {
|
||||||
Data {
|
Data {
|
||||||
name: String,
|
name: String,
|
||||||
sig_type: SigType,
|
sig_type: SigType,
|
||||||
|
@ -69,7 +69,7 @@ pub(super) enum Signal {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) enum SignalErrors {
|
pub enum SignalErrors {
|
||||||
PreTimeline {
|
PreTimeline {
|
||||||
desired_time: BigUint,
|
desired_time: BigUint,
|
||||||
timeline_start_time: BigUint,
|
timeline_start_time: BigUint,
|
||||||
|
|
|
@ -24,10 +24,10 @@ pub(super) struct Metadata {
|
||||||
|
|
||||||
// We do a lot of arena allocation in this codebase.
|
// We do a lot of arena allocation in this codebase.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub(super) struct ScopeIdx(pub(super) usize);
|
pub struct ScopeIdx(pub(super) usize);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||||
pub(super) struct SignalIdx(pub(super) usize);
|
pub struct SignalIdx(pub(super) usize);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) struct Scope {
|
pub(super) struct Scope {
|
||||||
|
@ -54,7 +54,7 @@ pub struct VCD {
|
||||||
// keep track of all timestamp values, a given signal only needs to keep
|
// keep track of all timestamp values, a given signal only needs to keep
|
||||||
// track of the timestamps at which the given signal value changes.
|
// track of the timestamps at which the given signal value changes.
|
||||||
pub tmstmps_encoded_as_u8s: Vec<u8>,
|
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) all_scopes: Vec<Scope>,
|
||||||
pub(super) root_scopes: Vec<ScopeIdx>,
|
pub(super) root_scopes: Vec<ScopeIdx>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue