aboutsummaryrefslogtreecommitdiffstats
path: root/backends/cxxrtl/cxxrtl.h
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-04-16 21:28:13 +0000
committerGitHub <noreply@github.com>2020-04-16 21:28:13 +0000
commitb4b2345a10babf055e01db0a3d91b51c3f79e3bf (patch)
treea9e491030d5cc8404a53ac76be3fc501eeac881d /backends/cxxrtl/cxxrtl.h
parent8d3f6d0d792a1cd688ce4d9c05bef8ec601f9334 (diff)
parent06c0338f2c19ca50675f3928de7fa19b05d304c4 (diff)
downloadyosys-b4b2345a10babf055e01db0a3d91b51c3f79e3bf.tar.gz
yosys-b4b2345a10babf055e01db0a3d91b51c3f79e3bf.tar.bz2
yosys-b4b2345a10babf055e01db0a3d91b51c3f79e3bf.zip
Merge pull request #1947 from whitequark/cxxrtl-usability
cxxrtl: minor documentation and usability improvements
Diffstat (limited to 'backends/cxxrtl/cxxrtl.h')
-rw-r--r--backends/cxxrtl/cxxrtl.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/backends/cxxrtl/cxxrtl.h b/backends/cxxrtl/cxxrtl.h
index 593c31c28..fd390db79 100644
--- a/backends/cxxrtl/cxxrtl.h
+++ b/backends/cxxrtl/cxxrtl.h
@@ -604,12 +604,15 @@ struct memory {
auto _ = {std::move(std::begin(init.data), std::end(init.data), data.begin() + init.offset)...};
}
- value<Width> &operator [](size_t index) {
+ // An operator for direct memory reads. May be used at any time during the simulation.
+ const value<Width> &operator [](size_t index) const {
assert(index < data.size());
return data[index];
}
- const value<Width> &operator [](size_t index) const {
+ // An operator for direct memory writes. May only be used before the simulation is started. If used
+ // after the simulation is started, the design may malfunction.
+ value<Width> &operator [](size_t index) {
assert(index < data.size());
return data[index];
}