In some instruction descriptions there are calls to SignedSatQ (directly or indirectly).
The pseudocode for SignedSatQ:
(bits(N), boolean) SignedSatQ(integer i, integer N) if i > 2^(N-1) - 1 then result = 2^(N-1) - 1; saturated = TRUE; elsif i < -(2^(N-1)) then result = -(2^(N-1)); saturated = TRUE; else result = i; saturated = FALSE; return (result<N-1:0>, saturated);
(bits(N), boolean) SignedSatQ(integer i, integer N)
if i > 2^(N-1) - 1 then
result = 2^(N-1) - 1; saturated = TRUE;
elsif i < -(2^(N-1)) then
result = -(2^(N-1)); saturated = TRUE;
else
result = i; saturated = FALSE;
return (result<N-1:0>, saturated);
What's the idea with 'result<N-1:0>' in the return (shifting the result one bit left)?
Thanks. Only now I notice the difference - funny.
I was confusing this: "(-, shift_n) = DecodeImmShift(‘10’, imm3:imm2);"
and this (in angle brackets): "result<N-1:0>"
Range versus catenation.