- 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
|
||||
|
||||
## Features and Other
|
||||
- [ ] add timeline value scanner code
|
||||
- [ ] test against large waveform directly within SpinalHDL
|
||||
- [ ] add documenting comments
|
||||
- [ ] 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
|
||||
- [ ] 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
|
||||
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.
|
||||
- [ ] do a read through all the code - look for uneeded code
|
||||
- [ ] Take a look at GTKWave parser to compare efficiency.
|
||||
- [ ] 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 vcd;
|
||||
use vcd::parse_vcd;
|
||||
use vcd::*;
|
||||
|
||||
use num::BigUint;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
|
@ -20,12 +22,29 @@ fn main() -> std::io::Result<()> {
|
|||
let now = Instant::now();
|
||||
|
||||
let file = File::open(&args.path)?;
|
||||
parse_vcd(file).unwrap();
|
||||
let vcd = parse_vcd(file).unwrap();
|
||||
|
||||
let elapsed = now.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(())
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ mod parse;
|
|||
pub use parse::*;
|
||||
|
||||
mod signal;
|
||||
use signal::*;
|
||||
pub use signal::*;
|
||||
|
||||
mod 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_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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue