diff --git a/ci/test.sh b/ci/test.sh index 366bcc3..082ff58 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -18,6 +18,7 @@ fi ! ./vcddiff tests/counter.vcd tests/counter.var_reorder.no_diff.vcd | grep -q . ! ./vcddiff tests/counter.vcd tests/counter.identifier.no_diff.vcd | grep -q . ! ./vcddiff tests/counter.vcd tests/counter.scope_move.no_diff.vcd | grep -q . +! ./vcddiff tests/counter_with_strings.vcd tests/counter_with_strings.identifier.no_diff.vcd | grep -q . if [ "$FIFO_SUPPORTED" = "1" ]; then ! ./vcddiff <(cat tests/counter.vcd) <(cat tests/counter.vcd) | grep -q . fi @@ -30,6 +31,8 @@ fi grep "not defined in both files" ./vcddiff tests/counter.vcd tests/counter.new_sig.diff.vcd | grep "Ignoring signal t.the_sub.new_sig .* - not defined in both files" +! ./vcddiff tests/counter_with_strings.vcd tests/counter_with_strings.value_change.diff.vcd | + grep "t.cyc_string (') differs at time 10" if [ "$FIFO_SUPPORTED" = "1" ]; then ./vcddiff <(cat tests/counter.vcd) <(cat tests/counter.end_time.diff.vcd) | grep "Files have different end times" diff --git a/tests/counter.change_reorder.vcd b/tests/counter.change_reorder.no_diff.vcd similarity index 100% rename from tests/counter.change_reorder.vcd rename to tests/counter.change_reorder.no_diff.vcd diff --git a/tests/counter.identifier.vcd b/tests/counter.identifier.no_diff.vcd similarity index 100% rename from tests/counter.identifier.vcd rename to tests/counter.identifier.no_diff.vcd diff --git a/tests/counter.var_reorder.vcd b/tests/counter.var_reorder.no_diff.vcd similarity index 100% rename from tests/counter.var_reorder.vcd rename to tests/counter.var_reorder.no_diff.vcd diff --git a/tests/counter_with_strings.identifier.no_diff.vcd b/tests/counter_with_strings.identifier.no_diff.vcd new file mode 100644 index 0000000..a853587 --- /dev/null +++ b/tests/counter_with_strings.identifier.no_diff.vcd @@ -0,0 +1,50 @@ +$date + Fri Nov 21 13:40:50 2025 +$end +$version + Some Simulator +$end +$timescale + 1ns +$end + +$scope module t $end +$var reg 1 ! clk $end +$var integer 32 " cyc $end +$var string 0 a cyc_string $end + +$scope module the_sub $end +$var integer 32 # cyc $end +$var integer 32 $ cyc_plus_one $end +$upscope $end +$upscope $end + +$scope begin std $end +$upscope $end +$enddefinitions $end +#0 +$dumpvars +0! +b0 " +b0 # +b1 $ +szero a +$end +#10 +1! +b1 " +b1 # +b10 $ +sone a +#20 +0! +#30 +1! +b10 " +b10 # +b11 $ +stwo a +#40 +0! +#50 +1! diff --git a/tests/counter_with_strings.value_change.diff.vcd b/tests/counter_with_strings.value_change.diff.vcd new file mode 100644 index 0000000..4612e84 --- /dev/null +++ b/tests/counter_with_strings.value_change.diff.vcd @@ -0,0 +1,50 @@ +$date + Fri Nov 21 13:40:50 2025 +$end +$version + Some Simulator +$end +$timescale + 1ns +$end + +$scope module t $end +$var reg 1 ! clk $end +$var integer 32 " cyc $end +$var string 0 ' cyc_string $end + +$scope module the_sub $end +$var integer 32 # cyc $end +$var integer 32 $ cyc_plus_one $end +$upscope $end +$upscope $end + +$scope begin std $end +$upscope $end +$enddefinitions $end +#0 +$dumpvars +0! +b0 " +b0 # +b1 $ +szero ' +$end +#10 +1! +b1 " +b1 # +b10 $ +sones ' +#20 +0! +#30 +1! +b10 " +b10 # +b11 $ +stwo ' +#40 +0! +#50 +1! diff --git a/tests/counter_with_strings.vcd b/tests/counter_with_strings.vcd new file mode 100644 index 0000000..d419904 --- /dev/null +++ b/tests/counter_with_strings.vcd @@ -0,0 +1,50 @@ +$date + Fri Nov 21 13:40:50 2025 +$end +$version + Some Simulator +$end +$timescale + 1ns +$end + +$scope module t $end +$var reg 1 ! clk $end +$var integer 32 " cyc $end +$var string 0 ' cyc_string $end + +$scope module the_sub $end +$var integer 32 # cyc $end +$var integer 32 $ cyc_plus_one $end +$upscope $end +$upscope $end + +$scope begin std $end +$upscope $end +$enddefinitions $end +#0 +$dumpvars +0! +b0 " +b0 # +b1 $ +szero ' +$end +#10 +1! +b1 " +b1 # +b10 $ +sone ' +#20 +0! +#30 +1! +b10 " +b10 # +b11 $ +stwo ' +#40 +0! +#50 +1! diff --git a/vcddiff.c b/vcddiff.c index 6880d88..9f25451 100644 --- a/vcddiff.c +++ b/vcddiff.c @@ -279,6 +279,7 @@ static struct variable_types_t var_types[] {"realtime", REALTIME}, // GTKWave's fst2vcd {"reg", REG}, {"shortint", SHORTINT}, // GTKWave's fst2vcd + {"string", STRING}, // GTKWave's fst2vcd {"supply0", SUPPLY0}, {"supply1", SUPPLY1}, {"time", TIME}, @@ -892,9 +893,10 @@ static int get_nxt_chg(FILE* fp, char* fname, int* sigcode, int* bit, char* valu } return (SCALAR); break; - /* vector or real cases */ + /* vector, real, or string cases */ case 'b': case 'r': + case 's': strncpy(value, line, MAXTOKSIZE); get_token(fp, token); *sigcode = VERILOG_ID_TO_POS(token); diff --git a/vcddiff.h b/vcddiff.h index 143451e..6df8bfa 100755 --- a/vcddiff.h +++ b/vcddiff.h @@ -45,20 +45,21 @@ #define REALTIME 11 #define REG 12 #define SHORTINT 13 -#define SUPPLY0 14 -#define SUPPLY1 15 -#define TIME 16 -#define TRI 17 -#define TRI0 18 -#define TRI1 19 -#define TRIAND 20 -#define TRIOR 21 -#define TRIREG 22 -#define WAND 23 -#define WIRE 24 -#define WOR 25 +#define STRING 14 +#define SUPPLY0 15 +#define SUPPLY1 16 +#define TIME 17 +#define TRI 18 +#define TRI0 19 +#define TRI1 20 +#define TRIAND 21 +#define TRIOR 22 +#define TRIREG 23 +#define WAND 24 +#define WIRE 25 +#define WOR 26 -#define UNDEFINED 26 +#define UNDEFINED 27 /*dumpfile key words*/ #define V_ATTRBEGIN 1