From 12fc1cc6cdac1ce9142c1d463c503188eb18a0ff Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Mon, 11 May 2020 18:16:07 +0800 Subject: [PATCH] Fix issue #306: wrong identifier codes for VCD file export --- libsigrok4DSL/output/vcd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsigrok4DSL/output/vcd.c b/libsigrok4DSL/output/vcd.c index e5bc6022..ce923350 100755 --- a/libsigrok4DSL/output/vcd.c +++ b/libsigrok4DSL/output/vcd.c @@ -88,7 +88,7 @@ static GString *gen_header(const struct sr_output *o) GString *header; GSList *l; time_t t; - int num_channels, i; + int num_channels, i, p; char *samplerate_s, *frequency_s, *timestamp; ctx = o->priv; @@ -140,6 +140,7 @@ static GString *gen_header(const struct sr_output *o) g_string_append_printf(header, "$scope module %s $end\n", PACKAGE); /* Wires / channels */ + p = 0; for (i = 0, l = o->sdi->channels; l; l = l->next, i++) { ch = l->data; if (ch->type != SR_CHANNEL_LOGIC) @@ -147,7 +148,8 @@ static GString *gen_header(const struct sr_output *o) if (!ch->enabled) continue; g_string_append_printf(header, "$var wire 1 %c %s $end\n", - (char)('!' + i), ch->name); + (char)('!' + p), ch->name); + p++; } g_string_append(header, "$upscope $end\n$enddefinitions $end\n");