Arithmetic shift acts as a logical shift, regardless of the signed variable

前端 未结 1 841
借酒劲吻你
借酒劲吻你 2020-12-19 09:03

I\'ve got a register declared as so:

logic signed [15:0][2:0][15:0] registers;

When I place a 2\'s compliment number into the array and ari

1条回答
  •  攒了一身酷
    2020-12-19 09:29

    With Verilog, once you take a part-select, the result is unsigned. Use the $signed system task on the part select to make it signed.

    res = $signed(registers[0][0]) >>> 2;
    

    0 讨论(0)
提交回复
热议问题