fixed some reference errors

This commit is contained in:
Yehowshua Immanuel 2022-08-19 21:13:29 -04:00
parent 15a2564f13
commit e2c02316af
4 changed files with 26 additions and 91 deletions

View file

@ -191,7 +191,7 @@ pub(super) fn parse_events<'a>(
// so that we end up storing all values
// of a particular signal in a consistent
// amount of bytes
let bytes_required = signal.bytes_required()?;
let bytes_required = Signal::bytes_required(num_bits, name)?;
while curr_num_bytes < bytes_required {
// TODO: remove once library is known to be stable

View file

@ -58,6 +58,14 @@ pub(super) fn parse_var<'a>(
| SigType::Tri1
| SigType::Time => {
let no_bits = word.parse::<usize>().expect(parse_err.as_str());
let no_bits = u16::try_from(no_bits).map_err(|_| {
format!(
"Error near {}:{} while parsing vcd file at {cursor:?}. \
This signal has {no_bits} > 2^16 - 1 bits.",
file!(),
line!()
)
})?;
Some(no_bits)
}
// for strings, we don't really care what the number of bits is
@ -100,7 +108,7 @@ pub(super) fn parse_var<'a>(
name: full_signal_name,
sig_type: var_type,
signal_error: None,
num_bits: None,
num_bits: no_bits,
self_idx: signal_idx,
nums_encoded_as_fixed_width_le_u8: vec![],
string_vals: vec![],