mirror of
https://github.com/YosysHQ/yosys
synced 2026-02-07 01:32:15 +00:00
Make compare_signals produce a total order.
Currently when `s1` and `s2` are different bits of the same wire, it is possible for both `compare_signals(s1, s2)` and `compare_signals(s2, s1)` to return false. This means the calling code will call `assign_map.add()` for both `s1` and `s2`, which doesn't make much sense --- one of `s1` or `s2` should be consistently preferred. So fix that by preferring the `SigBit` with the smaller bit offset.
This commit is contained in:
parent
125609105d
commit
2468b391bf
1 changed files with 3 additions and 0 deletions
|
|
@ -271,6 +271,9 @@ bool compare_signals(RTLIL::SigBit &s1, RTLIL::SigBit &s2, SigPool ®s, SigPoo
|
|||
return conns.check_any(s2);
|
||||
}
|
||||
|
||||
if (w1 == w2)
|
||||
return s2.offset < s1.offset;
|
||||
|
||||
if (w1->port_output != w2->port_output)
|
||||
return w2->port_output;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue