From f953a516d083054202f9ada0191f02f99abed725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Nguyen?= Date: Fri, 11 Oct 2024 23:24:13 +0200 Subject: [PATCH] cxxrtl: fix handling of 0-bit variables in `vcd_writer.sample()`. --- backends/cxxrtl/runtime/cxxrtl/cxxrtl_vcd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends/cxxrtl/runtime/cxxrtl/cxxrtl_vcd.h b/backends/cxxrtl/runtime/cxxrtl/cxxrtl_vcd.h index e4c9a67702c..e8be7002814 100644 --- a/backends/cxxrtl/runtime/cxxrtl/cxxrtl_vcd.h +++ b/backends/cxxrtl/runtime/cxxrtl/cxxrtl_vcd.h @@ -127,6 +127,8 @@ class vcd_writer { bool bit_curr = var.curr[bit / (8 * sizeof(chunk_t))] & (1 << (bit % (8 * sizeof(chunk_t)))); buffer += (bit_curr ? '1' : '0'); } + if (var.width == 0) + buffer += '0'; buffer += ' '; emit_ident(var.ident); buffer += '\n';