New parser #2
|
@ -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
|
- 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
|
- consumes roughly between 10 - 50MB of memory per GB of waveform
|
||||||
|
|
||||||
## Planed Features
|
## Planned Features
|
||||||
- elegant/pretty UI
|
- elegant/pretty UI
|
||||||
- can be easily ported to work in browser via webassembly
|
- can be easily ported to work in browser via webassembly
|
||||||
- allows high-performance custom Rust plugins to manipulate and
|
- 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``
|
You can run all the tests with ``cargo test``
|
||||||
|
|
||||||
# TODO
|
# 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
|
- [ ] Fix warning especially usage and restriction warnings once I'm
|
||||||
able to successfully parse all sample VCDs.
|
able to successfully parse all sample VCDs.
|
||||||
- [ ] Should be able to load waveform whilst viewing it live.
|
- [ ] 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.
|
- [ ] Take a look at GTKWave parser to compare effificiency.
|
||||||
- [ ] Send survey to community channel.
|
- [ ] 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
|
# Probably No Longer Needed
|
||||||
- [ ] Should insert nodes in BFS order
|
- [ ] Should insert nodes in BFS order
|
|
@ -1,5 +1,7 @@
|
||||||
use std::{fs::File};
|
use std::{fs::File};
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::HashMap;
|
||||||
|
use num::BigInt;
|
||||||
|
use num::bigint::ToBigInt;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -15,6 +17,32 @@ use metadata::*;
|
||||||
mod scopes;
|
mod scopes;
|
||||||
use scopes::*;
|
use scopes::*;
|
||||||
|
|
||||||
|
use function_name::named;
|
||||||
|
|
||||||
|
#[named]
|
||||||
|
fn parse_events<'a>(
|
||||||
|
word_reader : &mut WordReader,
|
||||||
|
vcd : &'a mut VCD,
|
||||||
|
signal_map : &mut HashMap<String, Signal_Idx>
|
||||||
|
) -> 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<VCD, String> {
|
pub fn parse_vcd(file : File) -> Result<VCD, String> {
|
||||||
let mut word_gen = WordReader::new(file);
|
let mut word_gen = WordReader::new(file);
|
||||||
|
|
||||||
|
@ -24,12 +52,14 @@ pub fn parse_vcd(file : File) -> Result<VCD, String> {
|
||||||
|
|
||||||
let mut vcd = VCD{
|
let mut vcd = VCD{
|
||||||
metadata : header,
|
metadata : header,
|
||||||
|
cursor : 0.to_bigint().unwrap(),
|
||||||
all_signals: vec![],
|
all_signals: vec![],
|
||||||
all_scopes : vec![],
|
all_scopes : vec![],
|
||||||
scope_roots: vec![],
|
scope_roots: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
parse_scopes(&mut word_gen, None, &mut vcd, &mut signal_map)?;
|
parse_scopes(&mut word_gen, None, &mut vcd, &mut signal_map)?;
|
||||||
|
// parse_events(&mut word_gen, &mut vcd, &mut signal_map)?;
|
||||||
|
|
||||||
Ok(vcd)
|
Ok(vcd)
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub(super) fn parse_var<'a>(
|
||||||
sig_type: var_type,
|
sig_type: var_type,
|
||||||
num_bits: no_bits,
|
num_bits: no_bits,
|
||||||
self_idx: signal_idx,
|
self_idx: signal_idx,
|
||||||
timeline: BTreeMap::new(),
|
timeline: vec![],
|
||||||
scope_parent: parent_scope_idx };
|
scope_parent: parent_scope_idx };
|
||||||
(signal, signal_idx)
|
(signal, signal_idx)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@ pub(super) struct Signal_Idx(pub(super) usize);
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) enum Sig_Type {Integer, Parameter, Real, Reg, Str, Wire, Tri1, Time}
|
pub(super) enum Sig_Type {Integer, Parameter, Real, Reg, Str, Wire, Tri1, Time}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub(super) struct TimeStamp(BigInt);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) enum Sig_Value {
|
pub(super) enum Sig_Value {
|
||||||
Numeric(BigInt),
|
Numeric(BigInt),
|
||||||
|
@ -36,7 +39,7 @@ pub(super) enum Signal{
|
||||||
num_bits : Option<usize>,
|
num_bits : Option<usize>,
|
||||||
// TODO : may be able to remove self_idx
|
// TODO : may be able to remove self_idx
|
||||||
self_idx : Signal_Idx,
|
self_idx : Signal_Idx,
|
||||||
timeline : BTreeMap<BigInt, Sig_Value>,
|
timeline : Vec<(TimeStamp, Sig_Value)>,
|
||||||
scope_parent : Scope_Idx},
|
scope_parent : Scope_Idx},
|
||||||
Alias{
|
Alias{
|
||||||
name : String,
|
name : String,
|
||||||
|
@ -58,6 +61,7 @@ pub(super) struct Scope {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct VCD {
|
pub struct VCD {
|
||||||
pub(super) metadata : Metadata,
|
pub(super) metadata : Metadata,
|
||||||
|
pub(super) cursor : BigInt,
|
||||||
pub(super) all_signals : Vec<Signal>,
|
pub(super) all_signals : Vec<Signal>,
|
||||||
pub(super) all_scopes : Vec<Scope>,
|
pub(super) all_scopes : Vec<Scope>,
|
||||||
pub(super) scope_roots : Vec<Scope_Idx>}
|
pub(super) scope_roots : Vec<Scope_Idx>}
|
||||||
|
|
Loading…
Reference in a new issue