Incorrect result of signed shift #828
Labels
area: wrong runtime result
Issue involves an incorrect runtine result from Verilated model
resolution: fixed
Closed; fixed
Author Name: Geoff Barrett
Original Redmine Issue: 828 from https://www.veripool.org
Original Date: 2014-10-09
Original Assignee: Wilson Snyder (@wsnyder)
The following code gets the wrong values.
Verilator output is as follows:
Output from a couple of other simulators is this:
I would expect this code to create a logic[8:0], cast it to logic signed[8:0], shift it left into a logic signed[11:0] and then sign extend to a logic signed[31:0]. It looks like the result of the shift is the same width as its input, hence the sign bit is getting set and the 32-bit extension is incorrect. I suspect any values in the top 3 bits will be lost as a result of the shift as well.
The text was updated successfully, but these errors were encountered: