Skip to content

Commit 4597f25

Browse files
authored
Csr tests and accessiblity changes (#29)
* Changing implemented to accessible. "Closes #14" * Fixed definitions for wlrl nodes and fields dependent on NSU extensions. * Doc update.
1 parent 316c004 commit 4597f25

File tree

9 files changed

+1917
-2147
lines changed

9 files changed

+1917
-2147
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ deploy:
2020
api_key: $github_access_token
2121
file_glob: true
2222
file: docs/build/latex/*.pdf
23-
cleanup: true
23+
cleanup: false
2424
on:
2525
repo: riscv/riscv-config
2626
branch: master

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## 2.2.0 - 2020-04-07
6+
### Changed
7+
- Renamed the 'implemented' field in rv32 and rv64 nodes to 'accessible'.
8+
- Modified appropriate definitions for fields dependent on specific extensions like NSU.
9+
510
## 2.1.1 - 2020-03-29
611
## Fixed
712
- doc issue for mtimecmp

docs/source/yaml-specs.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ISA YAML Spec
1111

1212
**NOTE**:
1313

14-
1. All fields accept values as integers or hexadecimals(can be used interchangeably) unless specified otherwise.
14+
1. All integer fields accept values as integers or hexadecimals(can be used interchangeably) unless specified otherwise.
1515
2. An elaborate example of the full-fledge ISA-YAML file can be found here: `ISA-YAML <https://github.com/riscv/riscv_config/blob/master/examples/template_isa.yaml>`_
1616

1717
.. include:: schema_isa.rst
@@ -34,16 +34,16 @@ CSRs with sub-fields
3434
# of the all reset values of the sub-fields
3535
rv32: # this node and its subsequent fields can exist
3636
# if [M/S/U]XL value can be 1
37-
implemented: <boolean> # indicates if the csr exists in rv32 mode or not.
37+
accessible: <boolean> # indicates if the csr is accessible in rv32 mode or not.
3838
# When False, all fields below will be trimmed off
3939
# in the checked yaml. False also indicates that
40-
# access-exception should be generated
40+
# access-exception should be generated.
4141
fields: # a quick summary of the list of all fields of the
4242
# csr including a list of WPRI fields of the csr.
4343
- <field_name1>
4444
- <field_name2>
45-
- - [30,23] # A list which contains a squashed pair
46-
- 6 # (of form [msb,lsb]) of all WPRI bits within the
45+
- - [23,30] # A list which contains a squashed pair
46+
- 6 # (of form [lsb,msb]) of all WPRI bits within the
4747
# csr. Does not exist if there are no WPRI bits
4848
4949
<field_name1>: # name of the field
@@ -56,7 +56,7 @@ CSRs with sub-fields
5656
# or not. When False, all
5757
# fields below this will be trimmed.
5858
type: # type of field. Can be only one of the following
59-
wlrl: [list of ranges] # field is wlrl and the list of legal values.
59+
wlrl: [list of value-descriptors] # field is wlrl and the set of legal values.
6060
ro_constant: <hex> # field is readonly and will return the same value.
6161
ro_variable: True # field is readonly but the value returned depends
6262
# on other arch-states
@@ -66,11 +66,11 @@ CSRs with sub-fields
6666
wr_illegal: [list of warl-string]
6767
rv64: # this node and its subsequent fields can exist
6868
# if [M/S/U]XL value can be 2
69-
implemented: <boolean> # indicates if this register exists in rv64 mode
69+
accessible: <boolean> # indicates if this register exists in rv64 mode
7070
# or not. Same definition as for rv32 node.
7171
rv128: # this node and its subsequent fields can exist if
7272
# [M/S/U]XL value can be 3
73-
implemented: <boolean> # indicates if this register exists in rv128 mode
73+
accessible: <boolean> # indicates if this register exists in rv128 mode
7474
# or not. Same definition as for rv32 node.
7575
7676
CSRs without sub-fields
@@ -86,17 +86,17 @@ CSRs without sub-fields
8686
# of the all reset values of the sub-fields
8787
rv32: # this node and its subsequent fields can exist
8888
# if [M/S/U]XL value can be 1
89-
implemented: <boolean> # indicates if the csr exists in rv32 mode or not.
89+
accessible: <boolean> # indicates if the csr is accessible in rv32 mode or not.
9090
# When False, all fields below will be trimmed off
9191
# in the checked yaml. False also indicates that
9292
# access-exception should be generated
93-
fields: # This should be empty always.
93+
fields: [] # This should be empty always.
9494
shadow: <csr-name>::<register> # which this register shadows,'none' indicates that
9595
# this register does not shadow anything.
9696
msb: <int> # msb index of the csr. max: 31, min:31
9797
lsb: <int> # lsb index of the csr. max: 0, min:0
9898
type: # type of field. Can be only one of the following
99-
wlrl: [list of ranges] # field is wlrl and the list of legal values.
99+
wlrl: [list of value-descriptors] # field is wlrl and the set of legal values.
100100
ro_constant: <hex> # field is readonly and will return the same value.
101101
ro_variable: True # field is readonly but the value returned depends
102102
# on other arch-states
@@ -106,11 +106,11 @@ CSRs without sub-fields
106106
wr_illegal: [list of warl-string]
107107
rv64: # this node and its subsequent fields can exist
108108
# if [M/S/U]XL value can be 2
109-
implemented: <boolean> # indicates if this register exists in rv64 mode
109+
accessible: <boolean> # indicates if this register exists in rv64 mode
110110
# or not. Same definition as for rv32 node.
111111
rv128: # this node and its subsequent fields can exist if
112112
# [M/S/U]XL value can be 3
113-
implemented: <boolean> # indicates if this register exists in rv128 mode
113+
accessible: <boolean> # indicates if this register exists in rv128 mode
114114
115115
Constraints
116116
-----------
@@ -120,7 +120,7 @@ Each CSR undergoes the following checks:
120120
1. All implemented fields at the csr-level, if set to True, are checked if
121121
they comply with the supported_xlen field of the ISA yaml.
122122
2. The reset-val is checked against compliance with the type field specified
123-
by the user.
123+
by the user. All unimplemented fields are considered to be hardwired to 0.
124124

125125
For each of the above templates the following fields for all standard CSRs
126126
defined by the spec are frozen and **CANNOT** be modified by the user.
@@ -152,7 +152,7 @@ Following is an example of how a user can define the mtvec csr in the input ISA
152152
mtvec:
153153
reset-val: 0x80010000
154154
rv32:
155-
implemented: true
155+
accessible: true
156156
base:
157157
implemented: true
158158
type:
@@ -186,7 +186,7 @@ above user-input:
186186
priv_mode: M
187187
reset-val: 0x80010000
188188
rv32:
189-
implemented: true
189+
accessible: true
190190
base:
191191
implemented: true
192192
type:
@@ -221,7 +221,7 @@ above user-input:
221221
- mode
222222
- base
223223
rv64:
224-
implemented: false
224+
accessible: false
225225
226226
WARL field Definition
227227
=====================

examples/rv32i_isa.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,29 @@ ISA: RV32IMAFCZicsr_Zifencei
22
User_Spec_Version: '2.3'
33
supported_xlen: [32]
44
misa:
5-
reset-val: 0x40001125
6-
rv32:
7-
implemented: true
8-
mxl:
9-
implemented: true
10-
type:
11-
ro_constant: [0x01]
12-
extensions:
13-
implemented: true
14-
type:
15-
ro_constant: [0x1125]
16-
rv64:
17-
implemented: false
5+
reset-val: 0x40001125
6+
rv32:
7+
accessible: true
8+
mxl:
9+
implemented: true
10+
type:
11+
ro_constant: [0x01]
12+
extensions:
13+
implemented: true
14+
type:
15+
ro_constant: [0x1125]
1816
mvendorid:
1917
reset-val: 0xdeadbeef
2018
rv32:
21-
implemented: true
19+
accessible: true
2220
type:
2321
ro_constant: [0xdeadbeef]
2422
rv64:
25-
implemented: false
23+
accessible: false
2624
mtvec:
2725
reset-val: 0x80010000
2826
rv32:
29-
implemented: true
27+
accessible: true
3028
base:
3129
implemented: true
3230
type:

examples/rv64i_isa.yaml

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ supported_xlen: [64]
33
misa:
44
reset-val: 0x8000000000000100
55
rv32:
6-
implemented: false
6+
accessible: false
77
rv64:
8-
implemented: true
8+
accessible: true
99
mxl:
1010
implemented: true
1111
type:
@@ -17,17 +17,15 @@ misa:
1717
mvendorid:
1818
reset-val: 0xdeadbeef
1919
rv32:
20-
implemented: false
21-
type:
22-
ro_constant: [0xdeadbeef]
20+
accessible: false
2321
rv64:
24-
implemented: true
22+
accessible: true
2523
type:
2624
ro_constant: [0xdeadbeef]
2725
mtvec:
2826
reset-val: 0x0000000080000000
2927
rv64:
30-
implemented: true
28+
accessible: true
3129
base:
3230
implemented: true
3331
type:
@@ -49,30 +47,4 @@ mtvec:
4947
legal:
5048
- "mode[1:0] in [0x0:0x1] # Range of 0 to 1 (inclusive)"
5149
wr_illegal:
52-
- "Unchanged"
53-
medeleg:
54-
reset-val: 0x800
55-
rv32:
56-
implemented: false
57-
rv64:
58-
implemented: false
59-
60-
mideleg:
61-
rv32:
62-
implemented: false
63-
64-
rv64:
65-
implemented: false
66-
67-
sedeleg:
68-
reset-val: 0x800
69-
rv32:
70-
implemented: false
71-
rv64:
72-
implemented: false
73-
74-
sideleg:
75-
rv32:
76-
implemented: false
77-
rv64:
78-
implemented: false
50+
- "Unchanged"

riscv_config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from pkgutil import extend_path
22
__path__ = extend_path(__path__, __name__)
3-
__version__ = "2.1.1"
3+
__version__ = "2.2.0"

0 commit comments

Comments
 (0)