-
Notifications
You must be signed in to change notification settings - Fork 299
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
[LowerToHW] Lower i0 operand in printf-encoded assertions to i1 #4311
Conversation
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.
Great! This nicely unifies the behavior of firrtl.printf
and the verification statements. 👍
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.
LGTM.
This seems reasonable for %d
format specifier in particular, and for many others not sure we should worry about what "right semantics" are here. Aligning with printf is nice!
// CHECK-NEXT: [[TRUE:%.+]] = hw.constant true | ||
// CHECK-NEXT: [[TMP1:%.+]] = comb.xor %enable, [[TRUE]] | ||
// CHECK-NEXT: [[TMP2:%.+]] = comb.or bin [[TMP1]], %cond | ||
// CHECK-NEXT: sv.assert.concurrent posedge %clock, [[TMP2]] message "assert0" | ||
// CHECK-NEXT: sv.ifdef "USE_PROPERTY_AS_CONSTRAINT" { | ||
// CHECK-NEXT: sv.assume.concurrent posedge %clock, [[TMP2]] | ||
// CHECK-NEXT: } | ||
firrtl.assert %clock, %cond, %enable, "assert1"(%value) : !firrtl.uint<42> {isConcurrent = true, format = "ifElseFatal"} | ||
firrtl.assert %clock, %cond, %enable, "assert1"(%value, %i0) : !firrtl.uint<42>, !firrtl.uint<0> {isConcurrent = true, format = "ifElseFatal"} |
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.
Nit: Can this string be changed so "substitutions" are used? I know we don't inspect it presently, but as-is it doesn't seem entirely unreasonable to elide the substitutions as trivially unused.
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.
Nice, thanks!
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.
Seems reasonable.
This supports i0 value operand of verification statements. Following the implementation of printf, we use i1 value as a result.