-
Notifications
You must be signed in to change notification settings - Fork 17
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
Verilog logical (in)equality expression #593
Conversation
d2bd5da
to
2c6ff3c
Compare
2c6ff3c
to
4120b21
Compare
|
||
tc_binary_expr(expr); | ||
|
||
// This returns 'x' if either of the operands contains x or z. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to admit that I don't understand how this comment relates to or explains what follows?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe by example:
'b0 == 'b0 is 0
'b1x == 'b10 is x
'b1z == 'b1z is x
Hence, if both operands are two-valued, the result is two-valued. If either operand is four-valued, the result is four-valued.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the example and was assuming as much, but the code that follows just deals with types, it doesn't actually change the expression id or the likes. To me, the comment suggested that the code that follows actually evaluates the expression (or, rather, constructs some code to produce a value for the given operands).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does change the ID when it's two-valued -- lines 2431 and 2433.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but not in the four-valued case. So I was just a bit confused - but really only by the comment, not the actual implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in the four-valued case, the ID stays D_verilog_logical_equality/D_verilog_logical_inequality. I'll add a comment for that.
The Verilog logical equality and inequality now have their own ID as they return a four-valued result when applied to four-valued logic. When applied to two-valued logic, the typechecker maps these to mathematical equality.
4120b21
to
56778dd
Compare
No description provided.