FastWaveBackend/examples/parse_vcd.rs

34 lines
769 B
Rust
Raw Permalink Normal View History

2022-09-14 20:28:12 +00:00
// Copyright (C) 2022 Yehowshua Immanuel
// This program is distributed under both the GPLV3 license
// and the YEHOWSHUA license, both of which can be found at
// the root of the folder containing the sources for this program.
2022-09-09 06:59:33 +00:00
use clap::Parser;
use std::fs::File;
2022-10-26 05:16:39 +00:00
use fastwave_backend::parse_vcd;
2022-09-09 06:59:33 +00:00
#[derive(Parser)]
struct Cli {
/// The path to the file to read
path: std::path::PathBuf,
}
fn main() -> std::io::Result<()> {
let args = Cli::parse();
use std::time::Instant;
2023-09-26 11:16:14 +00:00
2022-09-09 06:59:33 +00:00
let now = Instant::now();
let file = File::open(&args.path)?;
2022-10-26 05:16:39 +00:00
parse_vcd(file).unwrap();
2022-09-09 06:59:33 +00:00
let elapsed = now.elapsed();
2023-09-26 11:16:14 +00:00
println!(
"Parsed VCD file {} : {:.2?}",
&args.path.as_os_str().to_str().unwrap(),
elapsed
);
2022-09-09 06:59:33 +00:00
Ok(())
}