Skip to content

VCD with timestamps and value changes on the same line fails with "ValueError: invalid literal for int() with base 10: '0 0! 0"'" #17

@brainstorm

Description

@brainstorm

Given:

$date Wed Jan 27 21:33:50 2021 $end
$version libsigrok 0.6.0-git-2297a26 $end
$comment
  Acquisition with 2/8 channels at 100 kHz
$end
$timescale 10 us $end
$scope module libsigrok $end
$var wire 1 ! D1 $end
$var wire 1 " D2 $end
$upscope $end
$enddefinitions $end

#0  0! 0"
#96462  1"
#96472  0"
#96482  1"
#96514  0"
#96534 
#96535  1"
#96566  0"
#96576  1"
#96587  0"
#96597  1"
#96607  0"
#96628  1"
#96649  0"
#96659 
#96660  1"
#96680  0"
#96712  1"
#96722  0"
#96732  1"
#96743  0"
(...)

And the following two lines of code code:

from vcdvcd import VCDVCD
VCDVCD('scorbot_motors.vcd')

I'm getting the following backtrace, I guess you've not encountered this VCD corner case before? (from Sigrok):

-------------------------------------------------------
ValueError            Traceback (most recent call last)
<ipython-input-12-62b67f313668> in <module>
----> 1 VCDVCD('scorbot_motors.vcd')

~/.miniconda3/envs/reveng/lib/python3.7/site-packages/vcdvcd/vcdvcd.py in __init__(self, vcd_path, only_sigs, signals, store_tvs, callbacks)
    130                 elif line0 == '#':
    131                     callbacks.time(self, time, cur_sig_vals)
--> 132                     time = int(line[1:])
    133                     if first_time:
    134                         self.begintime = time

ValueError: invalid literal for int() with base 10: '0  0! 0"'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions