Skip to content

Fix/field set side effect hazards - #30

Open
George-RG wants to merge 2 commits into
masterfrom
fix/field-set-side-effect-hazards
Open

George-RG wants to merge 2 commits into
masterfrom
fix/field-set-side-effect-hazards

Conversation

@George-RG

Copy link
Copy Markdown

Fixes #28

Field set() did a whole-register read-modify-write, echoing the read value back for every other field's bits. That silently corrupts fields with write side effects (woclr, wzc, etc.) and is unsafe on registers with read side effects (rclr, rset), since the RMW's own read destroys them.

  • Onwrite-hazard fields: substitute the safe no-op value for those bits instead of echoing the read value.
  • wclr/wset/wuser fields trigger on any write regardless of data, so no safe value exists — these just get a generation-time warning instead, since nothing in software can protect them.
  • Onread-hazard fields: static_assert on per-field set(), forcing a whole-register write instead.
  • Regenerated examples/generated/* to match.

Tested by compiling generated output against real memory with woclr, wzc, and rclr fields — siblings are no longer disturbed, and the rclr case fails to compile as intended.

@George-RG
George-RG requested review from mksoc and a lite review from Copilot August 28, 2026 11:39
@George-RG
George-RG requested a balanced review from Copilot and removed request for Copilot August 28, 2026 11:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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.

Handle onwrite field SW access properties

3 participants