diff options
author | whitequark <whitequark@whitequark.org> | 2021-07-18 07:35:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-18 07:35:23 +0000 |
commit | 9af88951bca3de799b9af121a45ad8c8d41dab2e (patch) | |
tree | 5d017f75ed6f5947e690828a3033e0a0c12f49c9 /backends/cxxrtl/cxxrtl.h | |
parent | 101d72ccb35715908ea6814f3c6b177789a79ccf (diff) | |
parent | 948fc10d7b7629803352e758fae9bc12a01074fb (diff) | |
download | yosys-9af88951bca3de799b9af121a45ad8c8d41dab2e.tar.gz yosys-9af88951bca3de799b9af121a45ad8c8d41dab2e.tar.bz2 yosys-9af88951bca3de799b9af121a45ad8c8d41dab2e.zip |
Merge pull request #2880 from whitequark/cxxrtl-fix-2877
cxxrtl: add debug_item::{get,set}
Diffstat (limited to 'backends/cxxrtl/cxxrtl.h')
-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"); |