summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-07-20 11:00:09 +0200
committerClifford Wolf <clifford@clifford.at>2014-07-20 11:01:04 +0200
commite57db5e9b256d801c1d4337e44e1a7173a115d07 (patch)
tree9b4dfae20d2b1fce65fa320354c5d626a0678963
parentefa78840261871616f9af15e5ad9a5bc89f95857 (diff)
Added std::set<RTLIL::SigBit> to RTLIL::SigSpec conversion
-rw-r--r--kernel/rtlil.cc13
-rw-r--r--kernel/rtlil.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index dea0e105..748deae3 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -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();
}
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 6290db21..64136de0 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -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;