mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 01:54:10 +00:00
rtlil: duplicate remove2() for std::set<>
This commit is contained in:
parent
9e26147ccd
commit
12ebdef17c
|
@ -2718,6 +2718,45 @@ void RTLIL::SigSpec::remove2(const pool<RTLIL::SigBit> &pattern, RTLIL::SigSpec
|
||||||
check();
|
check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RTLIL::SigSpec::remove2(const std::set<RTLIL::SigBit> &pattern, RTLIL::SigSpec *other)
|
||||||
|
{
|
||||||
|
if (other)
|
||||||
|
cover("kernel.rtlil.sigspec.remove_other");
|
||||||
|
else
|
||||||
|
cover("kernel.rtlil.sigspec.remove");
|
||||||
|
|
||||||
|
unpack();
|
||||||
|
|
||||||
|
if (other != NULL) {
|
||||||
|
log_assert(width_ == other->width_);
|
||||||
|
other->unpack();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<RTLIL::SigBit> new_bits, new_other_bits;
|
||||||
|
|
||||||
|
new_bits.reserve(GetSize(bits_));
|
||||||
|
if (other != NULL)
|
||||||
|
new_other_bits.reserve(GetSize(bits_));
|
||||||
|
|
||||||
|
for (int i = 0; i < GetSize(bits_); i++) {
|
||||||
|
if (bits_[i].wire != NULL && pattern.count(bits_[i]))
|
||||||
|
continue;
|
||||||
|
if (other != NULL)
|
||||||
|
new_other_bits.push_back(other->bits_[i]);
|
||||||
|
new_bits.push_back(bits_[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bits_.swap(new_bits);
|
||||||
|
width_ = GetSize(bits_);
|
||||||
|
|
||||||
|
if (other != NULL) {
|
||||||
|
other->bits_.swap(new_other_bits);
|
||||||
|
other->width_ = GetSize(other->bits_);
|
||||||
|
}
|
||||||
|
|
||||||
|
check();
|
||||||
|
}
|
||||||
|
|
||||||
RTLIL::SigSpec RTLIL::SigSpec::extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other) const
|
RTLIL::SigSpec RTLIL::SigSpec::extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other) const
|
||||||
{
|
{
|
||||||
pool<RTLIL::SigBit> pattern_bits = pattern.to_sigbit_pool();
|
pool<RTLIL::SigBit> pattern_bits = pattern.to_sigbit_pool();
|
||||||
|
|
|
@ -670,6 +670,8 @@ public:
|
||||||
void remove(const pool<RTLIL::SigBit> &pattern, RTLIL::SigSpec *other) const;
|
void remove(const pool<RTLIL::SigBit> &pattern, RTLIL::SigSpec *other) const;
|
||||||
void remove2(const pool<RTLIL::SigBit> &pattern, RTLIL::SigSpec *other);
|
void remove2(const pool<RTLIL::SigBit> &pattern, RTLIL::SigSpec *other);
|
||||||
|
|
||||||
|
void remove2(const std::set<RTLIL::SigBit> &pattern, RTLIL::SigSpec *other);
|
||||||
|
|
||||||
void remove(int offset, int length = 1);
|
void remove(int offset, int length = 1);
|
||||||
void remove_const();
|
void remove_const();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue