fix(TLB): vaddr should be extended to PAddrBitsMax (#4913)
EMU Test / Changes Detection (push) Waiting to run Details
EMU Test / Generate Verilog (push) Blocked by required conditions Details
EMU Test / EMU - Basics (push) Blocked by required conditions Details
EMU Test / EMU - CHI (push) Blocked by required conditions Details
EMU Test / Docker Build (push) Blocked by required conditions Details
EMU Test / EMU - Performance (push) Blocked by required conditions Details
EMU Test / EMU - MC (push) Blocked by required conditions Details
EMU Test / SIMV - Basics (push) Blocked by required conditions Details
EMU Test / Upload Artifacts (push) Blocked by required conditions Details
EMU Test / Check Submodules (push) Blocked by required conditions Details
EMU Test / Check Format (push) Blocked by required conditions Details
Release Jobs / build-xsdev-image (push) Waiting to run Details

In the previous design, vaddr was sign-extended to PAddrBits to prevent
cases where the physical address width exceeds the virtual address
width. However, in the SV48x4 mode, the actual width of vaddr is 50
bits, which ended up being truncated to 48 bits.

In the onlyStage2 case, the generated guest physical address (gpaddr)
should match vaddr. But due to the truncation, gpaddr was also limited
to 48 bits, and the upper 2 bits were lost (set to zero).

To fix this bug, and to better support future extensions—vaddr is now
extended to the maximum physical address width (PAddrBitsMax) as defined
by the RISC-V specification.
This commit is contained in:
Haoyuan Feng 2025-07-30 10:16:39 +08:00 committed by GitHub
parent aa71c71fab
commit 0a6e7c0298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -306,7 +306,7 @@ class TLB(Width: Int, nRespDups: Int = 1, Block: Seq[Boolean], q: TLBParameters)
hit.suggestName(s"hit_read_${i}")
miss.suggestName(s"miss_read_${i}")
val vaddr = SignExt(req_out(i).vaddr, PAddrBits)
val vaddr = SignExt(req_out(i).vaddr, PAddrBitsMax)
resp(i).bits.miss := miss
resp(i).bits.ptwBack := ptw.resp.fire
resp(i).bits.memidx := RegEnable(req_in(i).bits.memidx, req_in(i).valid)