Skip to content

[rtl,pre_dv,doc] Fix access handling with byte 0 disabled or error - #21

Open
martin-velay wants to merge 1 commit into
mainfrom
fix-zero-mask-write
Open

martin-velay wants to merge 1 commit into
mainfrom
fix-zero-mask-write

Conversation

@martin-velay

Copy link
Copy Markdown

Every register sits in byte 0 of its word, so a write with a_mask[0] clear now gets an AccessAck and changes nothing. TL-UL leaves the data of a disabled byte undefined, and the translator used to write the register from it.

Mocha's mem_downsizer turns each 64-bit beat into two 32-bit accesses, so every 32-bit store also writes the other word of its 8-byte pair with a_mask 0. Each THR write cleared IER and each IER write sent a stray character, which breaks the PLIC interrupt test in lowRISC/mocha#853.

The pre_dv bench now writes IER and SCR with byte 0 disabled and checks that they keep their value. Both checks fail without the RTL change. With the change vendored into Mocha, the UART and PLIC chip tests pass on Xcelium and Verilator.

@martin-velay
martin-velay requested a review from raylau1 December 4, 2026 13:59
@raylau1 raylau1 self-assigned this Dec 4, 2026
@raylau1
raylau1 force-pushed the fix-zero-mask-write branch from f249d3f to 70f8e5e Compare December 4, 2026 15:35
@raylau1

raylau1 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

@martin-velay Please let me know if the changes look good.

@raylau1
raylau1 force-pushed the fix-zero-mask-write branch 3 times, most recently from 8e3d6ad to 117db16 Compare December 4, 2026 16:58
@raylau1 raylau1 changed the title [rtl] Ignore writes with byte 0 disabled [rtl,pre_dv,doc] Fix access handling with byte 0 disabled or error Dec 4, 2026
Every register sits in byte 0 and a TL-UL request with a_mask[0]
clear should have no effect.

This change is needed for Mocha because mem_downsizer can generate
requests with a_mask clear, which are intended to be ignored.

This commit also fixes d_opcode from request errors.

Co-authored-by: Martin Velay <mvelay@lowrisc.org>
Signed-off-by: Ray Lau <ray.lau@lowrisc.org>
@raylau1
raylau1 force-pushed the fix-zero-mask-write branch from 117db16 to 4f2183a Compare December 4, 2026 17:32
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.

2 participants