✨ Add write-only semantics#141
Merged
Merged
Conversation
elbeno
force-pushed
the
write-only
branch
6 times, most recently
from
February 8, 2026 16:41
7fda7b0 to
f6051d1
Compare
Problem:
- Some hardware registers are write-only. This typically occurs when the
hardware doesn't store the values but uses writes for edge-trigger effects.
Solution:
- Add `write_only` semantic that can be applied to write functions.
Notes:
- These write-only semantics do not take account of byte enables (which might
alter written bits for a given bus). But at some level we have to assume
hardware isn't doing intentionally weird things.
- Reading is not necessarily an error (as in, it will not produce a hardware
fault).
- Field write functions take precedence over the containing register write
function. So there are two straightforward possibilities where errors occur:
- read from a register with write-only fields: a plain semantic error.
- write to a write-only field where other fields in the same register are also
marked write-only, but are not written: this would mean a RMW to preserve
those fields, which is an error.
- And there are two less straightforward error possibilities:
- read a (readable) field in a register marked as write-only where not all
bits are defined in fields (therefore reading other bits is an error). This
would be strange, but it is possible to mark a register write-only and yet
fill it with readable fields.
- write to field(s) where the register is marked as write-only and not all
bits are covered by identity values: this would also mean a RMW to preserve
the unwritten bits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Solution:
write_onlysemantic that can be applied to write functions.Notes: