From: whitequark Date: Sun, 18 Jul 2021 06:07:27 +0000 (+0000) Subject: cxxrtl: add debug_item::{get,set}. X-Git-Tag: yosys-0.10~95^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=948fc10d7b7629803352e758fae9bc12a01074fb;p=yosys.git cxxrtl: add debug_item::{get,set}. Fixes #2877. --- 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");