notable restructuring

This commit is contained in:
Yehowshua Immanuel 2022-09-09 02:59:33 -04:00
parent 4c1af97760
commit 320b0d348d
43 changed files with 154 additions and 142 deletions

34
examples/vcd1.rs Normal file
View file

@ -0,0 +1,34 @@
use clap::Parser;
use std::fs::File;
use fastwave::*;
use num::{BigUint};
fn main() -> std::io::Result<()> {
use std::time::Instant;
let now = Instant::now();
let file_path = "tests/vcd-files/icarus/CPU.vcd";
let file = File::open(file_path).unwrap();
let vcd = parse_vcd(file).unwrap();
let elapsed = now.elapsed();
println!("Parsed VCD file {} : {:.2?}", file_path, elapsed);
// testbench -> CPU -> rs2_data[31:0] @ 4687s
let rs2_data_signal = &vcd.all_signals[51];
let name = rs2_data_signal.name();
let time = BigUint::from(4687u32);
let val = rs2_data_signal
.query_num_val_on_tmln(
&time,
&vcd.tmstmps_encoded_as_u8s,
&vcd.all_signals,
)
.unwrap();
println!("Signal `{name}` has value `{val}` at time `{time}`");
Ok(())
}