Added std::set<RTLIL::SigBit> to RTLIL::SigSpec conversion

This commit is contained in:
Clifford Wolf 2014-07-20 11:00:09 +02:00
parent efa7884026
commit e57db5e9b2
2 changed files with 11 additions and 3 deletions

View File

@ -1451,10 +1451,17 @@ RTLIL::SigSpec::SigSpec(RTLIL::SigBit bit, int width)
RTLIL::SigSpec::SigSpec(std::vector<RTLIL::SigBit> bits)
{
chunks.reserve(bits.size());
this->width = 0;
for (auto &bit : bits)
chunks.push_back(bit);
this->width = bits.size();
append_bit(bit);
check();
}
RTLIL::SigSpec::SigSpec(std::set<RTLIL::SigBit> bits)
{
this->width = 0;
for (auto &bit : bits)
append_bit(bit);
check();
}

View File

@ -505,6 +505,7 @@ struct RTLIL::SigSpec {
SigSpec(RTLIL::State bit, int width = 1);
SigSpec(RTLIL::SigBit bit, int width = 1);
SigSpec(std::vector<RTLIL::SigBit> bits);
SigSpec(std::set<RTLIL::SigBit> bits);
void expand();
void optimize();
RTLIL::SigSpec optimized() const;