**Signed Arithmetic Shift** What is the value of out in binary? reg signe…
**Signed Arithmetic Shift** What is the value of out in binary? reg signed [3:0] a; reg signed [3:0] out; initial begin a = 4'sb1000; out = a >>> 2; end
- 4'b0010
- 4'b1110
- 4'b1100
- 4'b1010
Correct answer
B. 4'b1110
Explanation
Here a is explicitly signed with an MSB of 1 . The >>> operator performs sign-extension, preserving the sign bit by prepending 1 s. 4'b1000 shifted right arithmetically by two positions becomes 4'b1110 (-2 in two's complement).