cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Contributor
Contributor
5,609 Views
Registered: ‎12-29-2013

XSim fails to recognize signed expression with shift in localparam

Jump to solution

The following module should return 4'b1110 but instead returns 4'b0110 with xsim 2013.4:

 

module issue_020(y);
  output [3:0] y;
  localparam [3:0] p = 3'sb100 >>> 2'b01;
  assign y = p;
  initial #10 $display("%b", y);
endmodule

XSim 2013.4 seems to think that the expression for p is unsigned because the 2nd operand to the shift operator is unsigned. But sec. 5.1.12 of IEEE Std 1364-2005 states that the right hand side of the right operand of a shift operation has no effect on the signedness of the result.

 

In my tests I have run this module with:

 

xvlog issue_020.v
xelab -R work.issue_020

Crosscheck: Vivado 2013.4, XST 14.7, Quartus 13.1 and Modelsim 10.1d implement this correctly.

 

Isim 14.7 incorrectly returns 4'b0010 for the same test case.

1 Solution

Accepted Solutions
Contributor
Contributor
8,788 Views
Registered: ‎12-29-2013

Note: This issue has been fixed in Xsim 2014.1.

View solution in original post

0 Kudos
Reply
2 Replies
Contributor
Contributor
8,789 Views
Registered: ‎12-29-2013

Note: This issue has been fixed in Xsim 2014.1.

View solution in original post

0 Kudos
Reply
Moderator
Moderator
5,458 Views
Registered: ‎07-16-2008

Thanks for sharing the updated information.

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply