Skip to content

merge queue: merged #2654: fix(testbench): keep unknown bits in TB writes and conditions - #2680

Closed
mergify[bot] wants to merge 4 commits into
masterfrom
mergify/merge-queue/b152314fcb
Closed

mergify[bot] wants to merge 4 commits into
masterfrom
mergify/merge-queue/b152314fcb

Conversation

@mergify

@mergify mergify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Note

This is a merge queue draft opened by Mergify. Its pull request has merged, and nobody needs to act on it.
Mergify opened it for batch supposed-beurrenoisette-1dr20t of the changes queue, to test #2654 before it merged into master.

🎉 What landed

Mergify merged its pull request into master, then closed this draft:

  • #2654 fix(testbench): keep unknown bits in TB writes and conditions (tignear), as 89e2819

This draft's code was built in this order:

  1. master at bd12187
  2. the pull request queued ahead of this batch, listed below, which brought the tip to cd8d31f
  3. #2654, the pull request of this batch

Queued ahead of this batch

This pull request entered the queue before this batch and is not part of it.

Metadata for CI tooling, read by mergify ci
---
all_scopes: false
checking_base_sha: cd8d31f6da648160f4440ad9c2ac62fec500486e
previous_check_retries: []
previous_failed_batches: []
pull_requests:
  - number: 2654
    scopes:
      - core
scopes:
  - core
...
1 scope
  • core
Required conditions of queue rule changes for merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • check-success = Verify workflow lockfile
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Queue validation
    • check-neutral = @github-actions/Queue validation
    • check-skipped = @github-actions/Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Verify workflow lockfile
    • check-neutral = @github-actions/Verify workflow lockfile
    • check-skipped = @github-actions/Verify workflow lockfile
Required conditions to stay in the queue

tignear and others added 4 commits October 31, 2026 03:24
The symbols a scope imports and the package being analyzed were installed
into the shared analysis state behind RefCells, swapped by guards on the
way in and out of each scope, with a revision that told memoized
elaborations the state had changed. They are now values of the analysis
context: entering a scope or a package derives a context for it, a
generate item keeps the imports of the scope that elaborated it, and the
elaboration memo keys entries by the context's imports and package.
Functions that read the imports take the context instead of the state.

Change-Id: I082a6f20410bbcaea1391f510c56832fae20f57a
In a four-state build a Veryl testbench lost every unknown bit it wrote:
`r = 'x` stored 0 and `s = 'z` stored 1, in both schedulers. The frontend
dropped the mask of constants, and TB expressions ran in bit registers with
two-state result slots.

TB expressions now keep unknown bits as the HDL does:

- Constants with x/z digits are emitted with their mask, in Celox's
  encoding. Unsized fill literals (`'0`, `'1`, `'x`, `'z`) fill their
  context (IEEE 1800-2023 5.7.1).
- In a four-state build, loads of four-state storage, masked constants and
  every result computed from one use logic registers, so the shared SIR
  operators propagate X. Result slots and saved values that hold one keep a
  mask plane.
- A condition with no known one bit is false: `if`, and immediate
  assertions (12.4, 16.3).
- A conditional operator with an unknown condition combines both arms
  bit by bit (11.4.11). Arms that write state, make strings or load an
  unchecked dynamic address still run only as the condition's known bits
  select, so that a known condition never runs the other arm; an unknown
  condition then runs the second one.
- A selected write at an unknown index writes nothing, and a read there is
  x, or 0 from two-state storage (11.5.1). An unknown index never addresses
  memory.
- A wildcard pattern's unknown bits match anything (11.4.6).
- A cast to a two-state type, a two-state destination (a variable or a
  function argument), loop bounds, counts and other numeric uses read
  unknown bits as 0 (6.11.2).
- Narrow loads and selections drop their other bits by moving bits, so z
  bits stay z.

Message arguments now get their mask from the expression result, which
replaces the plain-load special case that #2625 added.

A two-state build creates no logic registers, so its generated code does
not change. A constant's unknown bits read as 0 there, which turns a `'z`
into 0 instead of 1 (6.11.2); a wildcard pattern's unknown bits read as 0
too, as they did before.

`four_state_tb_edges` now really moves its reset to and from x and z: those
moves take 5 host edge batches instead of 2, and its count differs from the
reference scheduler by the missed negedge of #2650.

Fixes #2645

Change-Id: Id06ef4acf030dff9789a05cb375d1144dc99f280
@mergify mergify Bot changed the title merge queue: checking #2654 on master (bd12187), stacked on #2673 merge queue: merged #2654: fix(testbench): keep unknown bits in TB writes and conditions Oct 31, 2026
@mergify mergify Bot closed this Oct 31, 2026
@mergify
mergify Bot deleted the mergify/merge-queue/b152314fcb branch October 31, 2026 05:02
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