From: Gerhard Sittig Date: Sat, 17 Oct 2020 08:42:56 +0000 (+0200) Subject: input/vcd: unbreak U and - values for single bit input data X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=358105152aaceb9065e4a18b2b0e0a1fc118eecb input/vcd: unbreak U and - values for single bit input data The previous implementation already mapped L/H/U/- literals for input data values to the 0/1/0/0 logic levels which sigrok can handle. But missed these literals in the condition which dispatches real/integer, bit vector, and single bit data types. Which made VCD import fail for some of the files in the SpinalWorkshop repo. Extend the test condition for single bit values. This unbreaks the import of the Apb3TimerTester.vcd and ApbPwmTester.vcd files, which contained phrases like these: ... $var reg 1 % io_apb_pwrite $end ... #0 bUUUUUUUU ! b0 " 0# 1$ U% and ... $var reg 8 # io_apb_paddr[7:0] $end $var reg 1 $ io_apb_pwrite $end ... #0 b0 ! 0" b-------- # -$ b-------------------------------- % b00000000000000000000000000000000 & 1' --- diff --git a/src/input/vcd.c b/src/input/vcd.c index e1224be0..59015055 100644 --- a/src/input/vcd.c +++ b/src/input/vcd.c @@ -1235,6 +1235,8 @@ static uint8_t vcd_char_to_value(char bit_char, int *warn) return 0; if (bit_char == 'u') return 0; + if (bit_char == '-') + return 0; /* Unhandled input text. */ return ~0; @@ -1449,7 +1451,9 @@ static int parse_textline(const struct sr_input *in, char *lines) is_real = curr_first == 'r' && curr_word[1]; is_multibit = curr_first == 'b' && curr_word[1]; is_singlebit = curr_first == '0' || curr_first == '1'; + is_singlebit |= curr_first == 'l' || curr_first == 'h'; is_singlebit |= curr_first == 'x' || curr_first == 'z'; + is_singlebit |= curr_first == 'u' || curr_first == '-'; if (is_real) { char *real_text; float real_val;