diff --git a/README.md b/README.md index c5315b3..0070709 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ PROPRIETARY - Copyright - Yehowshua Immanuel - loads 400MB of VCD waveform per second on an 8 core 2017 desktop CPU with NVMe storage - consumes roughly between 10 - 50MB of memory per GB of waveform -## Planed Features +## Planned Features - elegant/pretty UI - can be easily ported to work in browser via webassembly - allows high-performance custom Rust plugins to manipulate and @@ -27,7 +27,8 @@ The first build of the program may take some time. You can run all the tests with ``cargo test`` # TODO - - [ ] support parsing dates with commas + - [ ] make a custon date parser for possibly up to 18 different versions(that + is, for each possible tool). - [ ] Fix warning especially usage and restriction warnings once I'm able to successfully parse all sample VCDs. - [ ] Should be able to load waveform whilst viewing it live. @@ -40,5 +41,9 @@ You can run all the tests with ``cargo test`` - [ ] Take a look at GTKWave parser to compare effificiency. - [ ] Send survey to community channel. +# Questions to Answer + - [ ] Is it safe to assume that we may treat any values before the first + non-zero timestamp as having occured on `#0`? + # Probably No Longer Needed - [ ] Should insert nodes in BFS order \ No newline at end of file diff --git a/src/vcd/parse.rs b/src/vcd/parse.rs index c7821f1..4ab523c 100644 --- a/src/vcd/parse.rs +++ b/src/vcd/parse.rs @@ -1,5 +1,7 @@ use std::{fs::File}; -use std::collections::{BTreeMap, HashMap}; +use std::collections::HashMap; +use num::BigInt; +use num::bigint::ToBigInt; use super::*; @@ -15,6 +17,32 @@ use metadata::*; mod scopes; use scopes::*; +use function_name::named; + +#[named] +fn parse_events<'a>( + word_reader : &mut WordReader, + vcd : &'a mut VCD, + signal_map : &mut HashMap +) -> Result<(), String> { + + loop { + let next_word = word_reader.next_word(); + // if we've reached the end of the file, then there is obviously + // nothing left to do... + if next_word.is_none() {break}; + + let (word, cursor) = next_word.unwrap(); + match &word[0..1] { + "$" => {continue} + "#" => {continue} + _ => {} + } + } + + Ok(()) +} + pub fn parse_vcd(file : File) -> Result { let mut word_gen = WordReader::new(file); @@ -24,12 +52,14 @@ pub fn parse_vcd(file : File) -> Result { let mut vcd = VCD{ metadata : header, + cursor : 0.to_bigint().unwrap(), all_signals: vec![], all_scopes : vec![], scope_roots: vec![], }; parse_scopes(&mut word_gen, None, &mut vcd, &mut signal_map)?; + // parse_events(&mut word_gen, &mut vcd, &mut signal_map)?; Ok(vcd) } diff --git a/src/vcd/parse/scopes.rs b/src/vcd/parse/scopes.rs index b1a1f1e..d03001c 100644 --- a/src/vcd/parse/scopes.rs +++ b/src/vcd/parse/scopes.rs @@ -84,7 +84,7 @@ pub(super) fn parse_var<'a>( sig_type: var_type, num_bits: no_bits, self_idx: signal_idx, - timeline: BTreeMap::new(), + timeline: vec![], scope_parent: parent_scope_idx }; (signal, signal_idx) } diff --git a/src/vcd/types.rs b/src/vcd/types.rs index 51c5ce8..6796179 100644 --- a/src/vcd/types.rs +++ b/src/vcd/types.rs @@ -23,6 +23,9 @@ pub(super) struct Signal_Idx(pub(super) usize); #[derive(Debug)] pub(super) enum Sig_Type {Integer, Parameter, Real, Reg, Str, Wire, Tri1, Time} +#[derive(Debug)] +pub(super) struct TimeStamp(BigInt); + #[derive(Debug)] pub(super) enum Sig_Value { Numeric(BigInt), @@ -36,7 +39,7 @@ pub(super) enum Signal{ num_bits : Option, // TODO : may be able to remove self_idx self_idx : Signal_Idx, - timeline : BTreeMap, + timeline : Vec<(TimeStamp, Sig_Value)>, scope_parent : Scope_Idx}, Alias{ name : String, @@ -58,6 +61,7 @@ pub(super) struct Scope { #[derive(Debug)] pub struct VCD { pub(super) metadata : Metadata, + pub(super) cursor : BigInt, pub(super) all_signals : Vec, pub(super) all_scopes : Vec, pub(super) scope_roots : Vec}