Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#558 Signed Shift Bug

v0.8
closed-wont-fix
nobody
5
2008-11-14
2008-11-06
No

Hi,

Details of the bug follows:

<code>
module bug03_signedShift;

parameter N=32;
parameter M=32;
parameter LOG2N=5;
reg signed[N-1:0] in_0;
reg signed[N-1:0] in_1;

wire [LOG2N-1:0] sa0= in_1[LOG2N-1:0];
wire signed[31:0] sa1= {{(N-LOG2N){1'b0}},in_1[LOG2N-1:0]};
wire signed[31:0] sa2= in_1;
wire signed[M-1:0] out_0=(in_0>>>sa0);
wire signed[M-1:0] out_1=(in_0>>>sa1);
wire signed[M-1:0] out_2=(in_0>>>sa2);

initial begin
in_0=32'h80000000;
in_1=32'h0000001f;
//BUG HERE: result should be 32'hffffffff not 32'h00000001
#3 $display ("in_0=%h in_1=%h sa0=%h (in_0>>>sa0)=%h expected output=ffffffff", in_0,in_1,sa0,out_0);
//BUG HERE: result should be 32'hffffffff not 32'h00000001
$display ("in_0=%h in_1=%h sa1=%h (in_0>>>sa1)=%h expected output=ffffffff", in_0,in_1,sa1,out_1);
//BUG HERE: result should be 32'hffffffff not 32'h00000001
$display ("in_0=%h in_1=%h sa2=%h (in_0>>>sa2)=%h expected output=ffffffff", in_0,in_1,sa2,out_2);
//The following is correct
$display ("in_0=%h in_1=%h (in_0>>>in_1)=%h expected output=ffffffff", in_0,in_1,(in_0>>>in_1));
end

endmodule

</code>

Best Regards,

Sadi.

Discussion

  • Cary R.
    Cary R.
    2008-11-06

    This also works correctly in the development version. You may want to look at using it if possible since it is a much more capable simulator. I'll level this open until we decide if we are going to fix this in V0.8 or not. Thanks for the reports.

     
  • Ok. Thanks to you too. I will take a look at the dev version.

     
  • Cary R.
    Cary R.
    2008-11-14

    V0.8 has very limited support for signed and adding this is a major undertaking so we have decided that we will not fix this in V0.8. Use 0.9.devel if you need this functionality.

     
  • Cary R.
    Cary R.
    2008-11-14

    • status: open --> closed-wont-fix