peepopt: fix sign check in shiftadd

This commit is contained in:
Philippe Sauter 2024-06-14 13:01:18 +02:00
parent 34b5c6d062
commit 74e504330a
1 changed files with 2 additions and 1 deletions

View File

@ -63,7 +63,8 @@ match add
define <bool> constport_signed param(add, !varport_A ? \A_SIGNED : \B_SIGNED).as_bool()
define <bool> varport_signed param(add, varport_A ? \A_SIGNED : \B_SIGNED).as_bool();
define <bool> offset_negative ((port(add, constport).bits().back() == State::S1) ^ (is_sub && varport_A))
define <bool> const_negative (constport_signed && (port(add, constport).bits().back() == State::S1))
define <bool> offset_negative ((is_sub && varport_A) ^ const_negative)
// checking some value boundaries as well:
// data[...-c +:W1] is fine for any signed var (pad at LSB, all data still accessible)