summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-04-06 17:06:15 +0200
committerClifford Wolf <clifford@clifford.at>2015-04-06 17:06:15 +0200
commit169d1c471165f77612d049478ca25720071272c4 (patch)
tree79938b99d98ed67562edde8a7634a53015538cc6 /kernel
parentd19866615b5cb1ad24d28df544071dd65f6df78a (diff)
Added support for initialized brams
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rtlil.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 702addd7..9b9afcee 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -474,7 +474,16 @@ struct RTLIL::Const
std::string decode_string() const;
inline int size() const { return bits.size(); }
- inline RTLIL::State operator[](int index) { return bits.at(index); }
+ inline RTLIL::State &operator[](int index) { return bits.at(index); }
+ inline const RTLIL::State &operator[](int index) const { return bits.at(index); };
+
+ inline RTLIL::Const extract(int offset, int len = 1, RTLIL::State padding = RTLIL::State::S0) const {
+ RTLIL::Const ret;
+ ret.bits.reserve(len);
+ for (int i = offset; i < offset + len; i++)
+ ret.bits.push_back(i < GetSize(bits) ? bits[i] : padding);
+ return ret;
+ }
inline unsigned int hash() const {
unsigned int h = mkhash_init;