Skip to content

Commit d369bdf

Browse files
fix: add writable property to register entry and update file name pattern
Changes: - Add 'writable' boolean property to register schema to indicate if a register is writable. - Update gpr.yaml to X.yaml, register directory to register_file. - Restrict regex for register_file_name to a single character. - Update README.adoc. Signed-off-by: Animesh Agarwal <[email protected]>
1 parent 2d79d0c commit d369bdf

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

spec/schemas/register_file_schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
]
6464
},
6565
"uniqueItems": true
66+
},
67+
"writable": {
68+
"type": "boolean",
69+
"default": true,
70+
"description": "Whether the register is writable. If false, no sw_write() method is needed."
6671
}
6772
}
6873
},

spec/schemas/schema_defs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"register_file_name": {
6666
"type": "string",
67-
"pattern": "^[A-Za-z][A-Za-z0-9_.-]*$",
67+
"pattern": "^[A-Za-z]$",
6868
"description": "Register file name"
6969
},
7070
"register_alias": {

spec/std/isa/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ registers:
170170
roles: [callee_saved, frame_pointer]
171171
----
172172

173-
<1> Registers can have either a fixed architecture width or take their width from a parameter (e.g., MXLEN, VLEN).
173+
<1> The registers in a register file have identical fixed widths, either an explicit width or from a parameter (e.g. MXLEN or VLEN).
174174
<2> Each register has a unique name (e.g., x0, x1, x2, etc.). The register's index is inferred from its position in the array (starting from 0).
175175
<3> Registers can optionally have ABI mnemonics (e.g., ra, sp, fp, etc.).
176176
<4> Individual registers can define `sw_read()` and `sw_write()` for special behavior (e.g., x0 hardwired to zero).

spec/std/isa/register/gpr.yaml renamed to spec/std/isa/register_file/X.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
# Copyright (c) Animesh Agarwal
22
# SPDX-License-Identifier: BSD-3-Clause-Clear
33

4-
# yaml-language-server: $schema=../../../schemas/register_file_schema.json
4+
# yaml-language-server: $schema=../../../../schemas/register_file_schema.json
55

66
$schema: register_file_schema.json#
77
kind: register_file
88
name: X
99
long_name: General Purpose Registers
1010
description: |
1111
The 'X' register file contains the general-purpose integer registers. Each register
12-
is architecturally XLEN bits wide, unless XLEN<MXLEN. Register 'x0' is hardwired to
13-
zero, while the remaining registers hold architecturally visible integer state used
14-
by the calling convention and execution environment.
12+
is MXLEN bits wide, unless XLEN<MXLEN. Register 'x0' is hardwired to zero, while
13+
the remaining registers hold architecturally visible integer state used by the
14+
calling convention and execution environment.
1515
definedBy: I
1616
register_class: general_purpose
1717
register_length: MXLEN
1818
registers:
1919
- name: x0
2020
abi_mnemonics: [zero]
2121
roles: [zero]
22+
writable: false
2223
description: |
2324
Register x0 is hardwired with all bits equal to 0.
2425
sw_read(): |
2526
return 0;
26-
sw_write(value): |
27-
# x0 ignores all writes
2827
- name: x1
2928
abi_mnemonics: [ra]
3029
caller_saved: true

0 commit comments

Comments
 (0)