Skip to content

[codegen] Sample $isunknown(condition) in disable iff under async reset - #5380

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1020212024
Draft

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1020212024

Conversation

@copybara-service

Copy link
Copy Markdown

[codegen] Sample $isunknown(condition) in disable iff under async 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.

… 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant