Skip to content

Commit c624d65

Browse files
committed
Merge remote-tracking branch 'origin/copilot/sub-pr-230' into copilot/sub-pr-230
2 parents e4055cc + 5cb1c46 commit c624d65

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

tools/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ CSR selector properties:
212212
- Both accept decimal integer, hex string (`0x...`), or binary string (`0b...`).
213213

214214
Notes on output behavior:
215-
- JSON output copies the authored `enum` object into the generated `csrs` entry.
215+
- JSON output preserves the structure of the authored `enum` object in the generated `csrs` entry, but normalizes any multibase numeric values (for example hex `0x...` or binary `0b...`) to plain integers.
216216
- JSON output stores `ro-mask`/`ro-value` as integers.
217-
- HTML output preserves the original authored literal text for `ro-mask`/`ro-value` when available (for example `0xF0F0` or `0b1100`).
217+
- HTML output uses internal underscore-prefixed fields to preserve the original authored literal text for `enum` values and `ro-mask`/`ro-value` when available (for example `0xF0F0` or `0b1100`).
218218

219219
Examples:
220220
```yaml

tools/create_params.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ def parse_multibase_int(value: Any, label: str, csr_name: str) -> int:
630630

631631
representative_name = names[0]
632632

633-
csr_enum_input: Optional[List[int]] = None
634633
csr_width_input: Optional[str] = None
635634
csr_read_only_mask: Optional[int] = None
636635
csr_read_only_value: Optional[int] = None
@@ -672,12 +671,24 @@ def parse_multibase_int(value: Any, label: str, csr_name: str) -> int:
672671
if raw_illegal_ignore is not None:
673672
if not isinstance(raw_illegal_ignore, bool):
674673
fatal(f"CSR {representative_name} in {def_filename} has non-boolean illegal-write-ignore: {raw_illegal_ignore!r}")
675-
csr_illegal_write_ignore = raw_illegal_ignore
674+
if raw_illegal_ignore is not True:
675+
fatal(
676+
f"CSR {representative_name} in {def_filename} must set 'illegal-write-ignore' to true "
677+
f"when present (got {raw_illegal_ignore!r})"
678+
)
679+
csr_illegal_write_ignore = True
676680

677681
if raw_illegal_return is not None:
678-
if not isinstance(raw_illegal_return, (int, str)) or isinstance(raw_illegal_return, bool):
679-
fatal(f"CSR {representative_name} in {def_filename} has invalid illegal-write-return: {raw_illegal_return!r}; expected integer, hex string, or binary string")
680-
csr_illegal_write_return = parse_multibase_int(raw_illegal_return, "illegal-write-return", representative_name)
682+
if not isinstance(raw_illegal_return, (str, int)) or isinstance(raw_illegal_return, bool):
683+
fatal(
684+
f"CSR {representative_name} in {def_filename} has invalid illegal-write-return "
685+
f"{raw_illegal_return!r}; expected integer, hex string, or binary string"
686+
)
687+
csr_illegal_write_return = parse_multibase_int(
688+
raw_illegal_return,
689+
"illegal-write-return",
690+
representative_name,
691+
)
681692

682693
if has_width:
683694
raw_width = entry.get("width")

0 commit comments

Comments
 (0)