Repository navigation
[codegen] Sample $isunknown(condition) in disable iff under async reset - #5380
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
… reset When `ModuleBuilder::EmitAssert` emits a concurrent SystemVerilog `assert property` for a block with an asynchronous reset, it previously skipped wrapping `disable_iff` in `$sampled(...)` so that the asynchronous reset signal itself would remain unsampled. However, leaving `$isunknown(condition)` unsampled caused simulators that re-evaluate `disable iff` expressions after nonblocking register updates to observe the post-edge value of `$isunknown(condition)` while evaluating the assertion body against the preponed `$sampled(condition)`. If `condition` was `1'bx` in the preponed region on the first active clock edge after reset deassertion and resolved to `1'b0` after register NBA updates on that same edge, `disable iff` evaluated to false while the assertion body failed on the preponed `1'bx`. - Wrap the `$isunknown(condition)` term in `$sampled(...)` before OR-ing it with the unsampled asynchronous reset condition (`rst !== 1'h0 || $sampled($isunknown(cond))`). - Add `VerilogConversionTest.BlockWithAssertAsyncReset` covering active-high and active-low asynchronous resets. PiperOrigin-RevId: 1020212024
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[codegen] Sample
$isunknown(condition)indisable iffunder async resetWhen
ModuleBuilder::EmitAssertemits a concurrent SystemVerilogassert propertyfor a block with an asynchronous reset, it previously skipped wrappingdisable_iffin$sampled(...)so that the asynchronous reset signal itself would remain unsampled. However, leaving$isunknown(condition)unsampled caused simulators that re-evaluatedisable iffexpressions after nonblocking register updates to observe the post-edge value of$isunknown(condition)while evaluating the assertion body against the preponed$sampled(condition). Ifconditionwas1'bxin the preponed region on the first active clock edge after reset deassertion and resolved to1'b0after register NBA updates on that same edge,disable iffevaluated to false while the assertion body failed on the preponed1'bx.$isunknown(condition)term in$sampled(...)before OR-ing it with the unsampled asynchronous reset condition (rst !== 1'h0 || $sampled($isunknown(cond))).VerilogConversionTest.BlockWithAssertAsyncResetcovering active-high and active-low asynchronous resets.