Skip to content

Commit

Permalink
rtlil: Add const append helper
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Dec 13, 2024
1 parent 6bd03b8 commit fdc3e4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/rtlil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,12 @@ void RTLIL::Const::bitvectorize() const {
}
}

void RTLIL::Const::append(const RTLIL::Const &other) {
bitvectorize();
bitvectype& bv = get_bits();
bv.insert(bv.end(), other.begin(), other.end());
}

RTLIL::State RTLIL::Const::const_iterator::operator*() const {
if (auto bv = parent.get_if_bits())
return (*bv)[idx];
Expand Down
2 changes: 2 additions & 0 deletions kernel/rtlil.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ struct RTLIL::Const
bool empty() const;
void bitvectorize() const;

void append(const RTLIL::Const &other);

class const_iterator {
private:
const Const& parent;
Expand Down

0 comments on commit fdc3e4b

Please sign in to comment.