diff options
Diffstat (limited to 'backends/cxxrtl')
-rw-r--r-- | backends/cxxrtl/cxxrtl.h | 16 |
1 files changed, 16 insertions, 0 deletions
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<size_t Bits, class IntegerT> + IntegerT get() const { + assert(width == Bits && depth == 1); + value<Bits> item; + std::copy(curr, curr + value<Bits>::chunks, item.data); + return item.template get<IntegerT>(); + } + + template<size_t Bits, class IntegerT> + void set(IntegerT other) const { + assert(width == Bits && depth == 1); + value<Bits> item; + item.template set<IntegerT>(other); + std::copy(item.data, item.data + value<Bits>::chunks, next); + } }; static_assert(std::is_standard_layout<debug_item>::value, "debug_item is not compatible with C layout"); |