Skip to content

Commit

Permalink
rtlil: revert Const ordering to "spreadsheet column order"
Browse files Browse the repository at this point in the history
  • Loading branch information
widlarizer committed Sep 30, 2024
1 parent 8ff3ed8 commit 767da07
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kernel/rtlil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,14 @@ RTLIL::Const::~Const() {

bool RTLIL::Const::operator<(const RTLIL::Const &other) const
{
// Compare common prefix
for (int i = 0; i < size() && i < other.size(); i++)
if (size() < other.size())
return size() < other.size();

for (int i = 0; i < size(); i++)
if ((*this)[i] != other[i])
return (*this)[i] < other[i];

return size() < other.size();
return false;
}

bool RTLIL::Const::operator ==(const RTLIL::Const &other) const
Expand All @@ -340,7 +342,6 @@ bool RTLIL::Const::operator !=(const RTLIL::Const &other) const

std::vector<RTLIL::State>& RTLIL::Const::bits()
{
log_assert(is_bits());
bitvectorize();
return get_bits();
}
Expand Down Expand Up @@ -3913,7 +3914,7 @@ RTLIL::SigChunk::SigChunk(const RTLIL::SigBit &bit)
wire = bit.wire;
offset = 0;
if (wire == NULL)
data = RTLIL::Const(bit.data).to_bits();
data = {bit.data};
else
offset = bit.offset;
width = 1;
Expand Down

0 comments on commit 767da07

Please sign in to comment.