Skip to content

Commit

Permalink
wip: difftest signal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Nov 9, 2023
1 parent e6a2095 commit 7303235
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ impl Waveform {
&self.hierarchy
}

pub fn time_table(&self) -> &[Time] {
&self.time_table
}

pub fn load_signals(&mut self, ids: &[SignalRef]) {
let ids_with_len = ids
.iter()
Expand Down
21 changes: 21 additions & 0 deletions tests/diff_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,27 @@ fn diff_signals<R: BufRead>(ref_reader: &mut vcd::Parser<R>, our: &mut Waveform)
.map(|v| v.signal_idx())
.collect();
our.load_signals(&all_signals);
let time_table = our.time_table();

// iterate over reference VCD and compare with signals in our waveform
let mut current_time = 0;
let mut time_table_idx = 0;
for cmd_res in ref_reader {
match cmd_res.unwrap() {
vcd::Command::Timestamp(new_time) => {
current_time = new_time;
time_table_idx += 1;
assert_eq!(current_time, time_table[time_table_idx]);
}
vcd::Command::ChangeScalar(_, _) => {}
vcd::Command::ChangeVector(_, _) => {}
vcd::Command::ChangeReal(_, _) => {}
vcd::Command::ChangeString(_, _) => {}
vcd::Command::Begin(_) => {} // ignore
vcd::Command::End(_) => {} // ignore
other => panic!("Unhandled command: {:?}", other),
}
}

println!("TODO")
}
Expand Down

0 comments on commit 7303235

Please sign in to comment.