-
Notifications
You must be signed in to change notification settings - Fork 597
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
Add ifElseFatal intrinsics; use it for chisel3.assert emission #3825
Conversation
6e08b11
to
736d23e
Compare
circt_chisel_ifelsefatal
intrinsics1c7698f
to
afb4e3f
Compare
@@ -75,14 +75,12 @@ class NamePluginSpec extends ChiselFlatSpec with Utils { | |||
val foo, bar = IO(Input(UInt(8.W))) | |||
|
|||
{ | |||
val x1 = chisel3.assert(1.U === 1.U) |
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.
Deleted because a label doesn't make sense for chisel3.assert
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.
Does that change match the firrtl spec (not sure whether asserts having labels ever was in the spec)
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.
The problem is that chisel3.assert never use plain FIRRTL assert. IfElseFatal style assertion doesn't have a label and we have ignored labels. I think it's fair to add a new API for emitting a plain FIRRTL assert and use that API here though.
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.
You're saying it never had a label, but if it didn't, how did this test pass previously?
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.
chisel3.assert emitted an assert op along with print op. The assert op is actually a dummy op deleted by a parser and this test passed because the dummy assert had a label.
core/src/main/scala/chisel3/experimental/VerificationIntrinsics.scala
Outdated
Show resolved
Hide resolved
@@ -75,14 +75,12 @@ class NamePluginSpec extends ChiselFlatSpec with Utils { | |||
val foo, bar = IO(Input(UInt(8.W))) | |||
|
|||
{ | |||
val x1 = chisel3.assert(1.U === 1.U) |
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.
Does that change match the firrtl spec (not sure whether asserts having labels ever was in the spec)
e45c7af
to
ddc39b0
Compare
This replaces printf-encoded assertion with ifElseFatal intrinsics. The intrinsic is a private object of core since we don't want to expose it other than chisel3.assert.
ddc39b0
to
d69c470
Compare
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.
A few last nits but looks good
Co-authored-by: Jack Koenig <jack.koenig3@gmail.com>
@jackkoenig Thank you for reviews! Could you merge this? |
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 is a follow-up to chipsalliance#3825. MFC has attached a laebl "chisel3_builtin" to every ifElseFatal assertion. Usually a label on ifElseFatal is just ignored but the label is emitted when compiled with `-emit-chisel-asserts-as-sva`. So labels on assertions converted from ifElseFatal disappear due to chipsalliance#3825. This PR restores labels to preserve the old behavior.
This is a follow-up to #3825. MFC has attached a laebl "chisel3_builtin" to every ifElseFatal assertion. Usually a label on ifElseFatal is just ignored but the label is emitted when compiled with `-emit-chisel-asserts-as-sva`. So labels on assertions converted from ifElseFatal disappear due to #3825. This PR restores labels to preserve the old behavior.
Restore chipsalliance#3912 and chipsalliance#3825. Use intrinsic expression instead of intrinsic module. This reverts commit 347d82b.
Restore chipsalliance#3912 and chipsalliance#3825. Use intrinsic expression instead of intrinsic module. This reverts commit 347d82b.
PrintableParam
for lazily constructing a string parameter for format string.[0] https://github.com/llvm/circt/blob/main/docs/Dialects/FIRRTL/FIRRTLIntrinsics.md#circtchisel_ifelsefatal
Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
Support
circt_chisel_ifelsefatal
intrinsics and use it for chisel3.assert emission.Reviewer Checklist (only modified by reviewer)
3.6.x
,5.x
, or6.x
depending on impact, API modification or big change:7.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.