Fix bytefield accessibility generation: detect attributed macros, filter XLEN bit-position labels#249
Merged
Bill Traynor (wmat) merged 1 commit intoJul 17, 2026
Conversation
…bit-position labels Signed-off-by: Maanvi212006 <maanvichetwani21@gmail.com>
Collaborator
|
Much appreciatd. |
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.
Contributes to riscv/riscv-isa-manual#1129
Problem
Two bugs in
tools/wavedrom_a11y.pysurfaced while re-verifying auto-generated alt text on bytefield diagrams:detect_diagram_typeused an exact match on[bytefield]. Once a file had already been processed and gained analt="..."attribute (e.g.[bytefield, ,svg, alt="..."]), the literal[bytefield]no longer appeared in the file, so re-running the tool on an already-processed file caused it to fall through todiagram_type = 'unknown'and lose all bytefield-specific title/desc generation.The auto-generated field-name list included XLEN-relative bit-position labels (e.g.
MXLEN-1,HSXLEN,VSXLEN-2) as if they were real field names, alongside genuine fields likeInterruptorException Code. These are bit-width markers analogous to plain numeric labels (which were already filtered), just written symbolically instead of as literal digits.Fix
detect_diagram_type: match on the[bytefieldprefix (consistent with how[wavedromis already matched) instead of the exact string[bytefield], so the check is robust to attributes being appended.build_accessibility_text: extend the field-label filter to also drop labels matching[A-Z]*XLEN[+-]?\d*(coversXLEN,MXLEN-1,SXLEN-1,HSXLEN,VSXLEN-2, etc.), while still preserving legitimate bracketed field names likeBASE[MXLEN-1:2].Testing
Verified via direct calls to
extract_content/build_accessibility_textacross representative files:sv39pte,pmpcfg,mvendorid) now correctly detect asbytefieldand produce"{NAME} register field layout"titles with cleanFields: ...descriptions..ednfiles for strayXLEN-pattern or empty descriptions; confirmed the only remainingXLENoccurrences are legitimate bracketed field names (BASE[MXLEN-1:2],BASE[SXLEN-1:2],BASE[VSXLEN-1:2]) that should be kept.