Skip to content

Commit 7d8a94b

Browse files
Merge pull request #227 from riscv/add_warl_wlrl
Add warl wlrl
2 parents b387152 + 2635fe7 commit 7d8a94b

43 files changed

Lines changed: 1427 additions & 250 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

schemas/param-common-schema.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,26 @@
7373
}
7474
]
7575
},
76-
"csrType": {
76+
"csrCategory": {
7777
"type": "string",
7878
"enum": ["WARL", "WLRL"]
7979
},
80+
"csrType": {
81+
"type": "array",
82+
"items": { "type": "integer" },
83+
"minItems": 1
84+
},
85+
"multiBaseValue": {
86+
"oneOf": [
87+
{
88+
"type": "string",
89+
"pattern": "^(0x[0-9a-fA-F_]+|0b[01_]+)$"
90+
},
91+
{
92+
"type": "integer"
93+
}
94+
]
95+
},
8096
"stringArray": {
8197
"type": "array",
8298
"items": { "type": "string" },
@@ -88,6 +104,9 @@
88104
"paramNamePattern" : {
89105
"$ref": "#/implDefNamePattern"
90106
},
107+
"csrNamePattern" : {
108+
"pattern": "^[a-zA-Z][a-zA-Z0-9_]+$"
109+
},
91110
"implDefName": {
92111
"type": "string",
93112
"$ref": "#/implDefNamePattern"
@@ -111,5 +130,17 @@
111130
"$ref": "#/paramNamePattern"
112131
},
113132
"minItems": 1
133+
},
134+
"csrName": {
135+
"type": "string",
136+
"$ref": "#/csrNamePattern"
137+
},
138+
"csrNameArray": {
139+
"type": "array",
140+
"items": {
141+
"type": "string",
142+
"$ref": "#/csrNamePattern"
143+
},
144+
"minItems": 1
114145
}
115146
}

schemas/param-defs-schema.json

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@
124124
"items": {
125125
"type": "object",
126126
"properties": {
127-
"name": {
128-
"$ref": "param-common-schema.json#/paramName",
127+
"reg-name": {
128+
"$ref": "param-common-schema.json#/csrName",
129129
"description": "Single CSR name"
130130
},
131-
"names": {
132-
"$ref": "param-common-schema.json#/paramNameArray",
131+
"reg-names": {
132+
"$ref": "param-common-schema.json#/csrNameArray",
133133
"description": "Multiple CSR names"
134134
},
135135
"note": {
@@ -140,6 +140,30 @@
140140
"type": "string",
141141
"$ref": "param-common-schema.json#/descriptionDesc"
142142
},
143+
"field-name": {
144+
"$ref": "param-common-schema.json#/csrName",
145+
"description": "Single CSR field name"
146+
},
147+
"field-names": {
148+
"$ref": "param-common-schema.json#/csrNameArray",
149+
"description": "Multiple CSR field names"
150+
},
151+
"type": {
152+
"$ref": "param-common-schema.json#/csrType",
153+
"description": "List of possible legal values"
154+
},
155+
"width": {
156+
"$ref": "param-common-schema.json#/paramName",
157+
"description": "Name of a parameter that provides the bit width"
158+
},
159+
"ro-mask": {
160+
"$ref": "param-common-schema.json#/multiBaseValue",
161+
"description": "Mask specifying read-only bits (1 = read-only, 0 = read-write). Supports decimal, hex (0x...), or binary (0b...)."
162+
},
163+
"ro-value": {
164+
"$ref": "param-common-schema.json#/multiBaseValue",
165+
"description": "Mask providing value of read-only bits. Supports decimal, hex (0x...), or binary (0b...)."
166+
},
143167
"impl-def": {
144168
"$ref": "param-common-schema.json#/implDefName",
145169
"description": "Name of implementation-defined behavior"
@@ -152,10 +176,30 @@
152176
"allOf": [
153177
{
154178
"oneOf": [
155-
{ "required": ["name"] },
156-
{ "required": ["names"] }
179+
{ "required": ["reg-name"] },
180+
{ "required": ["reg-names"] }
157181
]
158182
},
183+
{
184+
"not": {
185+
"required": ["field-name", "field-names"]
186+
}
187+
},
188+
{
189+
"oneOf": [
190+
{ "required": ["type"] },
191+
{ "required": ["width"] },
192+
{ "required": ["ro-mask"] }
193+
]
194+
},
195+
{
196+
"if": {
197+
"required": ["ro-value"]
198+
},
199+
"then": {
200+
"required": ["ro-mask"]
201+
}
202+
},
159203
{
160204
"not": {
161205
"required": ["impl-def", "impl-defs"]

schemas/params-schema.json

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,14 @@
106106
"items": {
107107
"type": "object",
108108
"properties": {
109-
"name": {
109+
"reg-name": {
110110
"type": "string",
111111
"description": "CSR name"
112112
},
113+
"field-name": {
114+
"type": "string",
115+
"description": "CSR field name"
116+
},
113117
"def_filename": {
114118
"type": "string",
115119
"description": "Parameter definition file that defines this CSR"
@@ -126,9 +130,25 @@
126130
"type": "string",
127131
"$ref": "param-common-schema.json#/descriptionDesc"
128132
},
133+
"category": {
134+
"$ref": "param-common-schema.json#/csrCategory",
135+
"description": "CSR category"
136+
},
129137
"type": {
130138
"$ref": "param-common-schema.json#/csrType"
131139
},
140+
"width": {
141+
"$ref": "param-common-schema.json#/paramName",
142+
"description": "Name of a parameter that provides the bit width"
143+
},
144+
"ro-mask": {
145+
"type": "integer",
146+
"description": "Decimal integer mask specifying read-only bits"
147+
},
148+
"ro-value": {
149+
"type": "integer",
150+
"description": "Decimal integer value of read-only bits"
151+
},
132152
"impl-defs": {
133153
"allOf": [
134154
{
@@ -142,7 +162,48 @@
142162
]
143163
}
144164
},
145-
"required": ["name", "def_filename", "chapter_name", "type"],
165+
"required": ["reg-name", "def_filename", "chapter_name", "category"],
166+
"allOf": [
167+
{
168+
"if": {
169+
"required": ["ro-value"]
170+
},
171+
"then": {
172+
"required": ["ro-mask"]
173+
}
174+
},
175+
{
176+
"oneOf": [
177+
{
178+
"required": ["type"],
179+
"not": {
180+
"anyOf": [
181+
{ "required": ["width"] },
182+
{ "required": ["ro-mask"] }
183+
]
184+
}
185+
},
186+
{
187+
"required": ["width"],
188+
"not": {
189+
"anyOf": [
190+
{ "required": ["type"] },
191+
{ "required": ["ro-mask"] }
192+
]
193+
}
194+
},
195+
{
196+
"required": ["ro-mask"],
197+
"not": {
198+
"anyOf": [
199+
{ "required": ["type"] },
200+
{ "required": ["width"] }
201+
]
202+
}
203+
}
204+
]
205+
}
206+
],
146207
"additionalProperties": false
147208
}
148209
}

tests/norm-rule/expected/test-ch1-norm-tags.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@
6363
"norm:uint32": "This is a 32-bit unsigned integer. Should be 0 to < 2^32^-1. Need to use inline anchor to see superscript.",
6464
"norm:int64": "This is a 64-bit signed integer.",
6565
"norm:uint-1to100": "This is an unsigned integer in the range of 1 to 100.",
66+
"norm:uint-4to8": "This is an unsigned integer in the range of 4 to 8.",
6667
"norm:list-str": "Name|Description\n===\nABC|Letters \"ABC\"¶DEF|Letters \"DEF\"¶GHI|Letters \"GHI\"\n===",
6768
"norm:list-int": "This is a list with values 1, 2 and 4.",
6869
"norm:foobar-ch1": "This is the Ch1 part of the foobar normative rule.",
69-
"norm:array": "Can have up to 29 performance counters. Reading an unimplemented performance counter either returns a value or raises an illegal instruction exception, depending on the implementation."
70+
"norm:array": "Can have up to 29 performance counters. Reading an unimplemented performance counter either returns a value or raises an illegal instruction exception, depending on the implementation.",
71+
"norm:satp_asid_warl_asidlen": "The satp.ASID CSR field width is specified by the ASIDLEN parameter value."
7072
},
7173
"sections": {
7274
"title": "",
@@ -183,7 +185,16 @@
183185
{
184186
"title": "Chapter 2 - Implementation-Defined Behaviors",
185187
"id": "_chapter_2_implementation_defined_behaviors",
186-
"children": [],
188+
"children": [
189+
{
190+
"title": "Chapter 2.1 - WARL",
191+
"id": "_chapter_2_1_warl",
192+
"children": [],
193+
"tags": [
194+
"norm:satp_asid_warl_asidlen"
195+
]
196+
}
197+
],
187198
"tags": [
188199
"norm:boolean",
189200
"norm:bit",
@@ -196,6 +207,7 @@
196207
"norm:uint32",
197208
"norm:int64",
198209
"norm:uint-1to100",
210+
"norm:uint-4to8",
199211
"norm:list-str",
200212
"norm:list-int",
201213
"norm:foobar-ch1",

tests/norm-rule/expected/test-ch2-norm-tags.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
"norm:mock-csr-x": "Here’s a normative rule for mock CSR \"X\".",
1818
"norm:mock-csr-field-y": "Here’s a normative rule for mock CSR field \"Y\".",
1919
"norm:mock-ext-dep-A-on-B": "Here’s a normative rule for mock extension dependency of extension A on extension B.",
20-
"norm:csr_field_warl1": "This field is write-any-read-legal.",
21-
"norm:csr_field_wlrl": "This field is write-legal-read-legal.",
22-
"norm:csr_field_warl2": "This field is also write-any-read-legal."
20+
"norm:foo_abc_warl_legal_list": "The architecturally-defined values for the 4-bit foo.ABC CSR field are 0, 3, or 10.\nAn implementation can support any subset of these values.",
21+
"norm:foo_def_warl_width_uint4to8": "The foo.DEF CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.",
22+
"norm:zort_xyz_wlrl_readonly_zero": "An implementation may treat each bit of the zort.XYZ CSR as\nread-only or read-write. Read-only bits can be 0 or 1.",
23+
"norm:bar_warl_readonly_value": "An implementation may treat each bit of the bar CSR as\nread-only or read-write. Read-only bits are 0."
2324
},
2425
"sections": {
2526
"title": "",
@@ -65,9 +66,10 @@
6566
"id": "_chapter_2_3_csr_field_types",
6667
"children": [],
6768
"tags": [
68-
"norm:csr_field_warl1",
69-
"norm:csr_field_wlrl",
70-
"norm:csr_field_warl2"
69+
"norm:foo_abc_warl_legal_list",
70+
"norm:foo_def_warl_width_uint4to8",
71+
"norm:zort_xyz_wlrl_readonly_zero",
72+
"norm:bar_warl_readonly_value"
7173
]
7274
}
7375
],

0 commit comments

Comments
 (0)