aboutsummaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2021-07-18 06:07:27 +0000
committerwhitequark <whitequark@whitequark.org>2021-07-18 06:20:45 +0000
commit948fc10d7b7629803352e758fae9bc12a01074fb (patch)
tree5d017f75ed6f5947e690828a3033e0a0c12f49c9 /backends
parent101d72ccb35715908ea6814f3c6b177789a79ccf (diff)
downloadyosys-948fc10d7b7629803352e758fae9bc12a01074fb.tar.gz
yosys-948fc10d7b7629803352e758fae9bc12a01074fb.tar.bz2
yosys-948fc10d7b7629803352e758fae9bc12a01074fb.zip
cxxrtl: add debug_item::{get,set}.
Fixes #2877.
Diffstat (limited to 'backends')
-rw-r--r--backends/cxxrtl/cxxrtl.h16
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");