Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect simulation relating to operator NOT #959

Closed
veripoolbot opened this issue Aug 19, 2015 · 2 comments
Closed

incorrect simulation relating to operator NOT #959

veripoolbot opened this issue Aug 19, 2015 · 2 comments

Comments

@veripoolbot
Copy link
Contributor

@veripoolbot veripoolbot commented Aug 19, 2015


Author Name: Jie Xu (@jiexu)
Original Redmine Issue: 959 from https://www.veripool.org
Original Date: 2015-08-19


For the following code

module test(sig, res);

input logic sig;
output [15:0] res;

assign res = (~sig << 3);

endmodule

Verilator generates C++ code for the assignment as

 vlTOPp->res = (0xffffU & ((~ (IData)(vlTOPp->sig)) << 3U));

where @vlTOPp->sig@ is a byte. So if @sig@ equals to @1'b1@, then @res@ will be @(0xffffU & ((0xFE) << 3U))@ instead of @(0xffffU & ((1'b0) << 3U))@.

Is this expected?

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Aug 19, 2015


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-08-19T13:33:13Z


Can you please make this a self checking test in test_regress format? Assuming it passes on another simulator I'll take a look tonight, thanks.

@veripoolbot
Copy link
Contributor Author

@veripoolbot veripoolbot commented Aug 24, 2015


Original Redmine Comment
Author Name: Jie Xu (@jiexu)
Original Date: 2015-08-24T14:16:13Z


Have tested the same thing using VCS and it reports the same result as Verilator. Also the verilog standard says that the rigth side is extended to be the same width as the left side before the operation is done.

So the issue reported here is invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.