Skip to content

[rdlexporter] Fix register export on systemrdl-compiler 1.32.2 - #19

Merged
engdoreis merged 2 commits into
lowRISC:mainfrom
hcallahan-lowrisc:fix-reg-array-is-array-1.32.2
Sep 8, 2026
Merged

[rdlexporter] Fix register export on systemrdl-compiler 1.32.2#19
engdoreis merged 2 commits into
lowRISC:mainfrom
hcallahan-lowrisc:fix-reg-array-is-array-1.32.2

Conversation

@hcallahan-lowrisc

@hcallahan-lowrisc hcallahan-lowrisc commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

rdlexporter fails to export any block containing registers when resolved against systemrdl-compiler 1.32.2:

AttributeError: 'Reg' object has no attribute 'is_array'
  rdlexporter/exporter.py  RdlExporter._arrays

RdlExporter._arrays tested component.is_array, but that attribute was removed from the raw Component layer in systemrdl-compiler 1.32.2 by 25748b96c227 ("Remove .is_array from internal Component layer as it can be trivially derived"). The change is not mentioned in the 1.32.2 release notes, but its own docstring defined is_array as simply meaning "array_dimensions and array_stride are valid". Up to 1.32.1 the exporter relied on is_array being present on the Component objects it walks (rdlc.root.comp_defs).

Because the dependency is declared systemrdl-compiler~=1.32.1, a fresh resolve already picks up the broken 1.32.2 — e.g. the OpenTitan reggen integration that consumes this package.

Changes

  • Fix: derive array-ness from component.array_dimensions (present with identical semantics in every supported systemrdl version; None for non-array components), exactly as upstream intends.
  • Test: add test_cli_arrays_from_file — a round-trip snapshot covering both branches of _arrays (a plain register CTRL and a register array DATA[4]).

The dependency floor is intentionally left at systemrdl-compiler~=1.32.1: the fix works identically on 1.32.1 and 1.32.2, and raising the floor would break other consumers in the workspace that must stay on the older release. No pyproject.toml or uv.lock changes are included.

Verification

Against systemrdl-compiler 1.32.2:

  • Without the fix, all three existing tests fail with the is_array AttributeError.
  • With the fix: rdlexporter 4 passed, rdl2ot 5 passed, ruff clean, reuse lint compliant.
  • Fix confirmed version-agnostic (also 4/4 on 1.32.1).

This PR includes AI-assisted content generated with Claude Code. All changes have been reviewed and are the responsibility of the listed author(s).

`RdlExporter._arrays` tested `component.is_array`, but that attribute was
removed from the raw *Component* layer in systemrdl-compiler 1.32.2 by
commit 25748b96c227 ("Remove .is_array from internal Component layer as it
can be trivially derived"). The change is not called out in the 1.32.2
release notes, but its docstring documented `is_array` as simply meaning
"``array_dimensions`` and ``array_stride`` are valid".

Up to 1.32.1 the exporter relied on `is_array` being present on the
Component objects it walks (`rdlc.root.comp_defs`); on 1.32.2, exporting any
block with registers raises:

    AttributeError: 'Reg' object has no attribute 'is_array'

The dependency is declared as `systemrdl-compiler~=1.32.1`, so a fresh
resolve already picks up the broken 1.32.2.

Derive array-ness from `array_dimensions` instead, exactly as upstream
intends: it is None for non-array components.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
Add `test_cli_arrays_from_file`, a focused round-trip snapshot covering
both branches of `RdlExporter._arrays`: a plain register (`CTRL`) and a
register array (`DATA[4]`). This guards the `is_array` regression fixed in
the previous commit, which is functional across old and new versions of
systemrdl-compiler.

Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
@hcallahan-lowrisc
hcallahan-lowrisc force-pushed the fix-reg-array-is-array-1.32.2 branch from 1c5314b to 2041398 Compare September 8, 2026 10:59
@engdoreis
engdoreis added this pull request to the merge queue Sep 8, 2026
Merged via the queue into lowRISC:main with commit 625c264 Sep 8, 2026
1 check passed
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