Skip to content

Commit 12fc1cc

Browse files
Fix issue #306: wrong identifier codes for VCD file export
1 parent dbc943d commit 12fc1cc

File tree

1 file changed

+4
-2
lines changed
  • libsigrok4DSL/output

1 file changed

+4
-2
lines changed

libsigrok4DSL/output/vcd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static GString *gen_header(const struct sr_output *o)
8888
GString *header;
8989
GSList *l;
9090
time_t t;
91-
int num_channels, i;
91+
int num_channels, i, p;
9292
char *samplerate_s, *frequency_s, *timestamp;
9393

9494
ctx = o->priv;
@@ -140,14 +140,16 @@ static GString *gen_header(const struct sr_output *o)
140140
g_string_append_printf(header, "$scope module %s $end\n", PACKAGE);
141141

142142
/* Wires / channels */
143+
p = 0;
143144
for (i = 0, l = o->sdi->channels; l; l = l->next, i++) {
144145
ch = l->data;
145146
if (ch->type != SR_CHANNEL_LOGIC)
146147
continue;
147148
if (!ch->enabled)
148149
continue;
149150
g_string_append_printf(header, "$var wire 1 %c %s $end\n",
150-
(char)('!' + i), ch->name);
151+
(char)('!' + p), ch->name);
152+
p++;
151153
}
152154

153155
g_string_append(header, "$upscope $end\n$enddefinitions $end\n");

0 commit comments

Comments
 (0)