mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-04 05:11:22 +00:00
Improved sig.remove2() performance
This commit is contained in:
parent
d491fd8c19
commit
f3326a6421
1 changed files with 11 additions and 2 deletions
|
@ -2182,14 +2182,23 @@ void RTLIL::SigSpec::remove2(const std::set<RTLIL::SigBit> &pattern, RTLIL::SigS
|
||||||
|
|
||||||
std::vector<RTLIL::SigBit> new_bits, new_other_bits;
|
std::vector<RTLIL::SigBit> new_bits, new_other_bits;
|
||||||
|
|
||||||
|
new_bits.resize(SIZE(bits_));
|
||||||
|
if (other != NULL)
|
||||||
|
new_other_bits.resize(SIZE(bits_));
|
||||||
|
|
||||||
|
int k = 0;
|
||||||
for (int i = 0; i < SIZE(bits_); i++) {
|
for (int i = 0; i < SIZE(bits_); i++) {
|
||||||
if (bits_[i].wire != NULL && pattern.count(bits_[i]))
|
if (bits_[i].wire != NULL && pattern.count(bits_[i]))
|
||||||
continue;
|
continue;
|
||||||
if (other != NULL)
|
if (other != NULL)
|
||||||
new_other_bits.push_back(other->bits_[i]);
|
new_other_bits[k] = other->bits_[i];
|
||||||
new_bits.push_back(bits_[i]);
|
new_bits[k++] = bits_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_bits.resize(k);
|
||||||
|
if (other != NULL)
|
||||||
|
new_other_bits.resize(k);
|
||||||
|
|
||||||
bits_.swap(new_bits);
|
bits_.swap(new_bits);
|
||||||
width_ = SIZE(bits_);
|
width_ = SIZE(bits_);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue