mirror of https://github.com/YosysHQ/yosys.git
Initialize RTLIL::Const from std::vector<bool>
This commit is contained in:
parent
309623ff17
commit
00964f2f61
|
@ -65,6 +65,13 @@ RTLIL::Const::Const(RTLIL::State bit, int width)
|
||||||
bits.push_back(bit);
|
bits.push_back(bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RTLIL::Const::Const(const std::vector<bool> &bits)
|
||||||
|
{
|
||||||
|
flags = RTLIL::CONST_FLAG_NONE;
|
||||||
|
for (auto b : bits)
|
||||||
|
this->bits.push_back(b ? RTLIL::S1 : RTLIL::S0);
|
||||||
|
}
|
||||||
|
|
||||||
bool RTLIL::Const::operator <(const RTLIL::Const &other) const
|
bool RTLIL::Const::operator <(const RTLIL::Const &other) const
|
||||||
{
|
{
|
||||||
if (bits.size() != other.bits.size())
|
if (bits.size() != other.bits.size())
|
||||||
|
|
|
@ -428,7 +428,8 @@ struct RTLIL::Const
|
||||||
Const(std::string str);
|
Const(std::string str);
|
||||||
Const(int val, int width = 32);
|
Const(int val, int width = 32);
|
||||||
Const(RTLIL::State bit, int width = 1);
|
Const(RTLIL::State bit, int width = 1);
|
||||||
Const(std::vector<RTLIL::State> bits) : bits(bits) { flags = CONST_FLAG_NONE; };
|
Const(const std::vector<RTLIL::State> &bits) : bits(bits) { flags = CONST_FLAG_NONE; };
|
||||||
|
Const(const std::vector<bool> &bits);
|
||||||
|
|
||||||
bool operator <(const RTLIL::Const &other) const;
|
bool operator <(const RTLIL::Const &other) const;
|
||||||
bool operator ==(const RTLIL::Const &other) const;
|
bool operator ==(const RTLIL::Const &other) const;
|
||||||
|
|
Loading…
Reference in New Issue