aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtlil.h
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-07-19 13:54:57 -0700
committerEddie Hung <eddie@fpgeh.com>2019-07-19 13:54:57 -0700
commit54708dfbd786032e841f48f15af4875c1eabbbfe (patch)
tree023c2962663643d64dd72d9019b0e1024ad0df12 /kernel/rtlil.h
parent3a87dc35242598b6951fb70d4302ede60c2a96b2 (diff)
downloadyosys-54708dfbd786032e841f48f15af4875c1eabbbfe.tar.gz
yosys-54708dfbd786032e841f48f15af4875c1eabbbfe.tar.bz2
yosys-54708dfbd786032e841f48f15af4875c1eabbbfe.zip
Add an SigSpec::at(offset, defval) convenience method
Diffstat (limited to 'kernel/rtlil.h')
-rw-r--r--kernel/rtlil.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 82cbfaf28..f9412e776 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -818,6 +818,7 @@ public:
operator std::vector<RTLIL::SigChunk>() const { return chunks(); }
operator std::vector<RTLIL::SigBit>() const { return bits(); }
+ RTLIL::SigBit at(int offset, const RTLIL::SigBit &defval) { return offset < width_ ? (*this)[offset] : defval; }
unsigned int hash() const { if (!hash_) updhash(); return hash_; };