Repository navigation
fix(testbench): keep unknown bits in TB writes and conditions - #2654
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fc4a3d5ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Queued — the merge queue status continues in this comment ↓. |
Revision history
|
7fc4a3d to
bc63862
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc638620d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bc63862 to
ae870d6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae870d6816
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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
ae870d6 to
b9c2177
Compare
✅ Merged into
|
In a four-state build a Veryl testbench lost every unknown bit it wrote:
r = 'xstored 0 ands = 'zstored 1, in both schedulers. The frontenddropped 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:
encoding. Unsized fill literals (
'0,'1,'x,'z) fill theircontext (IEEE 1800-2023 5.7.1).
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.
if, and immediateassertions (12.4, 16.3).
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.
x, or 0 from two-state storage (11.5.1). An unknown index never addresses
memory.
function argument), loop bounds, counts and other numeric uses read
unknown bits as 0 (6.11.2).
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
'zinto 0 instead of 1 (6.11.2); a wildcard pattern's unknown bits read as 0
too, as they did before.
four_state_tb_edgesnow really moves its reset to and from x and z: thosemoves take 5 host edge batches instead of 2, and its count differs from the
reference scheduler by the missed negedge of #2650.
Fixes #2645