From 948fc10d7b7629803352e758fae9bc12a01074fb Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 18 Jul 2021 06:07:27 +0000 Subject: cxxrtl: add debug_item::{get,set}. Fixes #2877. --- backends/cxxrtl/cxxrtl.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'backends') diff --git a/backends/cxxrtl/cxxrtl.h b/backends/cxxrtl/cxxrtl.h index 0e55c46c2..4552a0125 100644 --- a/backends/cxxrtl/cxxrtl.h +++ b/backends/cxxrtl/cxxrtl.h @@ -999,6 +999,22 @@ struct debug_item : ::cxxrtl_object { next = nullptr; outline = &group; } + + template + IntegerT get() const { + assert(width == Bits && depth == 1); + value item; + std::copy(curr, curr + value::chunks, item.data); + return item.template get(); + } + + template + void set(IntegerT other) const { + assert(width == Bits && depth == 1); + value item; + item.template set(other); + std::copy(item.data, item.data + value::chunks, next); + } }; static_assert(std::is_standard_layout::value, "debug_item is not compatible with C layout"); -- cgit v1.2.3