Hardware interview practice
Make Mixed Signed Arithmetic Explicit
`s` is signed 8-bit value -2 and `u` is unsigned 8-bit value 130. A 9-bit signed result must be the mathematical sum +128, not the wrapped 8-bit value -128. Which expression explicitly extends both operands into the intended signed 9-bit domain?
Choose one
Answer choices
- A. `s + u` with no casts or extension because the signed operand always controls the expression.
- B. `{1'b0,s} + {1'b0,u}` because zero-extension is correct for every signed operand.
- C. `$signed(s + u)` because casting the final possibly narrow mixed-sign result repairs its width and value.
- D. `$signed({s[7],s}) + $signed({1'b0,u})`
