ekiwi / wellen

wellen: waveform datastructures in Rust. Fast VCD, FST and GHW parsing for waveform viewers.
BSD 3-Clause "New" or "Revised" License
41 stars 8 forks source link

Invalid digit found in string when parsing an FST file #10

Closed augustofg closed 7 months ago

augustofg commented 7 months ago

It is me again, I don't know if this is related to #8, but when loading the attached file (generated with NVC, running with the --dump-arrays flag), surfer crashes with the following output:

./surfer ~/gca-jobs/repos/fofb-ctrl-gw/hdl/testbench/xwb_fofb_shaper_filt/nvc/xwb_fofb_shaper_filt_tb.fst
[INFO] Wave source is file
[INFO] Returning from perform work
[TRACE] Parsing startup commands []
[INFO] Starting async task
[INFO] spade-top and spade-state not set, not loading spade translator
[INFO] Applying startup command: LoadWaveformFile("/home/augusto/gca-jobs/repos/fofb-ctrl-gw/hdl/testbench/xwb_fofb_shaper_filt/nvc/xwb_fofb_shaper_filt_tb.fst", LoadOptions { keep_variables: false, keep_unavailable: false })
[INFO] Loading a waveform file: /home/augusto/gca-jobs/repos/fofb-ctrl-gw/hdl/testbench/xwb_fofb_shaper_filt/nvc/xwb_fofb_shaper_filt_tb.fst
[INFO] Returning from perform work
[INFO] Starting async task
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
Location: wellen/src/vcd.rs:357

https://github.com/ekiwi/wellen/blob/9fd07871db8d1f7d88c49d8091286bb579d648fb/src/vcd.rs#L357 I've modified the string to integer conversion unwrap to print more information:

let msb = match i32::from_str_radix(msb_str, 10) {
    Ok(d) => d,
    Err(e) => panic!("msb_str: {}, error: {}", msb_str, e),
};

And it prints:

msb_str: 0][15, error: invalid digit found in string

It seems that the parser is getting lost somewhere.

You have my permission to include the attached fst file in this repository. xwb_fofb_shaper_filt_tb.zip

ekiwi commented 7 months ago

Thanks! I will try to look into this soon. Keep those awesome bug reports coming!

ekiwi commented 7 months ago

This might actually be related to: https://github.com/ekiwi/wellen/issues/8

ekiwi commented 7 months ago

Thanks for this great bug report! Wellen v0.9.4 should fix this bug. Please try out surfer once this PR is merged: https://gitlab.com/surfer-project/surfer/-/merge_requests/332

augustofg commented 7 months ago

Thanks again for the quick fix!