// No longer initializes the IRQs here, they can be initialized on the
// fly when traces are added
-
+
return 0;
}
l->value = value;
}
+
+static char * _avr_vcd_get_float_signal_text(avr_vcd_signal_t * s, char * out)
+{
+ char * dst = out;
+
+ if (s->size > 1)
+ *dst++ = 'b';
+
+ for (int i = s->size; i > 0; i--)
+ *dst++ = 'x';
+ if (s->size > 1)
+ *dst++ = ' ';
+ *dst++ = s->alias;
+ *dst = 0;
+ return out;
+}
+
static char * _avr_vcd_get_signal_text(avr_vcd_signal_t * s, char * out, uint32_t value)
{
char * dst = out;
-
+
if (s->size > 1)
*dst++ = 'b';
-
+
for (int i = s->size; i > 0; i--)
*dst++ = value & (1 << (i-1)) ? '1' : '0';
if (s->size > 1)
// if that trace was seen in this nsec already, we fudge the base time
// to make sure the new value is offset by one nsec, to make sure we get
// at least a small pulse on the waveform
- // This is a bit of a fudge, but it is the only way to represent very
+ // This is a bit of a fudge, but it is the only way to represent very
// short"pulses" that are still visible on the waveform.
if (base == oldbase && seen & (1 << l->signal->irq.irq))
base++; // this forces a new timestamp
-
+
if (base > oldbase || li == 0) {
seen = 0;
fprintf(vcd->output, "#%" PRIu64 "\n", base);
return when + vcd->period;
}
-int avr_vcd_add_signal(avr_vcd_t * vcd,
+int avr_vcd_add_signal(avr_vcd_t * vcd,
avr_irq_t * signal_irq,
int signal_bit_size,
const char * name )
fprintf(vcd->output, "$upscope $end\n");
fprintf(vcd->output, "$enddefinitions $end\n");
-
+
fprintf(vcd->output, "$dumpvars\n");
for (int i = 0; i < vcd->signal_count; i++) {
avr_vcd_signal_t * s = &vcd->signal[i];
char out[48];
- fprintf(vcd->output, "%s\n", _avr_vcd_get_signal_text(s, out, s->irq.value));
+ fprintf(vcd->output, "%s\n", _avr_vcd_get_float_signal_text(s, out));
}
fprintf(vcd->output, "$end\n");
vcd->start = vcd->avr->cycle;
- avr_cycle_timer_register(vcd->avr, vcd->period, _avr_vcd_timer, vcd);
+ avr_cycle_timer_register(vcd->avr, vcd->period, _avr_vcd_timer, vcd);
return 0;
}
avr_cycle_timer_cancel(vcd->avr, _avr_vcd_timer, vcd);
avr_vcd_flush_log(vcd);
-
+
if (vcd->output)
fclose(vcd->output);
vcd->output = NULL;