Skip to content

fix(Fence): upper two bits of VMID must be zero in hardware#5788

Open
good-circle wants to merge 1 commit intokunminghu-v2from
20260408-fence
Open

fix(Fence): upper two bits of VMID must be zero in hardware#5788
good-circle wants to merge 1 commit intokunminghu-v2from
20260408-fence

Conversation

@good-circle
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions bot added the module: backend Decode, Rename, Issue, Dispatch, Rob, Alu, Csr, fudian, yunsuan label Apr 8, 2026
@good-circle good-circle requested a review from Copilot April 8, 2026 10:55

This comment was marked as outdated.

@good-circle good-circle force-pushed the 20260408-fence branch 2 times, most recently from a2daf19 to f54ea04 Compare April 8, 2026 11:07
@good-circle good-circle requested a review from Copilot April 8, 2026 11:14

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown

@fuhuakai fuhuakai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direction of this fix is correct, but it introduces new timing issues. sfence.bits.id is sampled in the same cycle as io.in.fire via RegEnable, but useVmid comes from the registered func, which is the type of the previous uop rather than the type of the current input instruction, causing a timing misalignment.
Let's assume that at cycle t-1, io.in.bits is a hfence_g instruction, while at cycle t, io.in.bits is not a hfence_g instruction. In this case, useVmid will be incorrectly set to 1 at cycle t, causing sfence.bits.id to erroneously use fenceVmid (when it should actually be fenceAsid).
A very simple fix is to change:
val useVmid = func === FenceOpType.hfence_g
to
val useVmid = io.in.bits.ctrl.fuOpType === FenceOpType.hfence_g

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

Labels

module: backend Decode, Rename, Issue, Dispatch, Rob, Alu, Csr, fudian, yunsuan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants