From f2d7a18756088f4167b91c5ec4735bb694f36567 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 8 Jun 2020 17:29:08 +0000 Subject: cxxrtl: emit debug information for constant wires. Constant wires can represent a significant chunk of the design in generic designs or after optimization. Emitting them in VCD files significantly improves usability because gtkwave removes all traces that are not present in the VCD file after reload, and iterative development suffers if switching a varying signal to a constant disrupts the workflow. --- backends/cxxrtl/cxxrtl.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'backends/cxxrtl/cxxrtl.h') diff --git a/backends/cxxrtl/cxxrtl.h b/backends/cxxrtl/cxxrtl.h index 5f74899fd..30f4667c5 100644 --- a/backends/cxxrtl/cxxrtl.h +++ b/backends/cxxrtl/cxxrtl.h @@ -741,6 +741,17 @@ struct debug_item : ::cxxrtl_object { next = item.data; } + template + debug_item(const value &item) { + static_assert(sizeof(item) == value::chunks * sizeof(chunk_t), + "value is not compatible with C layout"); + type = VALUE; + width = Bits; + depth = 1; + curr = const_cast(item.data); + next = nullptr; + } + template debug_item(wire &item) { static_assert(sizeof(item.curr) == value::chunks * sizeof(chunk_t) && -- cgit v1.2.3