Skip to content

Commit 78567fd

Browse files
Merge pull request #238 from riscv/add_func_of
Added optional func-of to WARL/WLRL schema.
2 parents 80abf55 + 79e20df commit 78567fd

19 files changed

Lines changed: 149 additions & 17 deletions

File tree

schemas/param-common-schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,17 @@
136136
"$ref": "#/csrNamePattern"
137137
},
138138
"minItems": 1
139+
},
140+
"funcOfRegName": {
141+
"allOf": [
142+
{ "$ref": "#/csrName" },
143+
{ "description": "CSR name associated with function-of relationship" }
144+
]
145+
},
146+
"funcOfFieldName": {
147+
"allOf": [
148+
{ "$ref": "#/csrName" },
149+
{ "description": "CSR field name associated with function-of relationship" }
150+
]
139151
}
140152
}

schemas/param-defs-schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@
144144
"$ref": "param-common-schema.json#/csrName",
145145
"description": "Single CSR field name"
146146
},
147+
"func-of-reg-name": {
148+
"$ref": "param-common-schema.json#/funcOfRegName"
149+
},
150+
"func-of-field-name": {
151+
"$ref": "param-common-schema.json#/funcOfFieldName"
152+
},
147153
"field-names": {
148154
"$ref": "param-common-schema.json#/csrNameArray",
149155
"description": "Multiple CSR field names"

schemas/params-schema.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
"type": "string",
115115
"description": "CSR field name"
116116
},
117+
"func-of-reg-name": {
118+
"$ref": "param-common-schema.json#/funcOfRegName"
119+
},
120+
"func-of-field-name": {
121+
"$ref": "param-common-schema.json#/funcOfFieldName"
122+
},
117123
"def_filename": {
118124
"type": "string",
119125
"description": "Parameter definition file that defines this CSR"
@@ -176,6 +182,14 @@
176182
"required": ["width-parameter"]
177183
}
178184
}
185+
},
186+
{
187+
"if": {
188+
"required": ["func-of-field-name"]
189+
},
190+
"then": {
191+
"required": ["func-of-reg-name"]
192+
}
179193
}
180194
],
181195
"additionalProperties": false

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
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:foo_abc_warl_enum": "An implementation may support any or all of the following values for the 4-bit foo.ABC field: 0, 4, 15.",
20+
"norm:foo_abc_warl_enum": "An implementation may support any or all of the following values for the 4-bit foo.ABC field: When foo.GHI is 0, legal values are 0, 4, 15. When foo.GHI is non-zero, legal values are 1, 2, 3.",
2121
"norm:foo_ghi_warl_var_width": "The foo.GHI CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.",
2222
"norm:zort_xyz_wlrl_ro_mask": "An implementation may treat each bit of the zort.XYZ\nCSR as read-only or read-write",
2323
"norm:qux_qqq_wlrl_other": "The qux.QQQ CSR field has implementation-defined behavior\nthat doesn't match any of the defined WARL/WLRL types."

tests/norm-rule/expected/test-norm-rules.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
10651065
<td>Implementation-defined behavior category</td>
10661066
</tr>
10671067
<tr>
1068-
<td>An implementation may support any or all of the following values for the 4-bit foo.ABC field: 0, 4, 15.</td>
1068+
<td>An implementation may support any or all of the following values for the 4-bit foo.ABC field: When foo.GHI is 0, legal values are 0, 4, 15. When foo.GHI is non-zero, legal values are 1, 2, 3.</td>
10691069
<td><a href="test-ch2.html#norm:foo_abc_warl_enum">norm:foo_abc_warl_enum</a></td>
10701070
</tr>
10711071
<tr>
@@ -1499,7 +1499,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
14991499
<td>Instance</td>
15001500
</tr>
15011501
<tr>
1502-
<td>An implementation may support any or all of the following values for the 4-bit foo.ABC field: 0, 4, 15.</td>
1502+
<td>An implementation may support any or all of the following values for the 4-bit foo.ABC field: When foo.GHI is 0, legal values are 0, 4, 15. When foo.GHI is non-zero, legal values are 1, 2, 3.</td>
15031503
<td><a href="test-ch2.html#norm:foo_abc_warl_enum">norm:foo_abc_warl_enum</a></td>
15041504
</tr>
15051505
<tr>
@@ -1959,7 +1959,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
19591959
<td>Implementation-defined behavior category</td>
19601960
</tr>
19611961
<tr>
1962-
<td>An implementation may support any or all of the following values for the 4-bit foo.ABC field: 0, 4, 15.</td>
1962+
<td>An implementation may support any or all of the following values for the 4-bit foo.ABC field: When foo.GHI is 0, legal values are 0, 4, 15. When foo.GHI is non-zero, legal values are 1, 2, 3.</td>
19631963
<td><a href="test-ch2.html#norm:foo_abc_warl_enum">norm:foo_abc_warl_enum</a></td>
19641964
</tr>
19651965
<tr>

tests/norm-rule/expected/test-norm-rules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@
15411541
{
15421542
"name": "norm:foo_abc_warl_enum",
15431543
"context": false,
1544-
"text": "An implementation may support any or all of the following values for the 4-bit foo.ABC field: 0, 4, 15.",
1544+
"text": "An implementation may support any or all of the following values for the 4-bit foo.ABC field: When foo.GHI is 0, legal values are 0, 4, 15. When foo.GHI is non-zero, legal values are 1, 2, 3.",
15451545
"tag_filename": "/build/test-ch2-norm-tags.json",
15461546
"stds_doc_url": "test-ch2.html"
15471547
}

tests/norm-rule/test-ch2.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Here's a normative rule for mock extension dependency of extension A on extensio
8282

8383
=== Chapter 2.3 - CSR Field Types
8484

85-
[#norm:foo_abc_warl_enum]#An implementation may support any or all of the following values for the 4-bit `foo.ABC` field: 0, 4, 15.#
85+
[#norm:foo_abc_warl_enum]#An implementation may support any or all of the following values for the 4-bit `foo.ABC` field: When `foo.GHI` is 0, legal values are 0, 4, 15. When `foo.GHI` is non-zero, legal values are 1, 2, 3.#
8686

8787
[#norm:foo_ghi_warl_var_width]#The `foo.GHI` CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.#
8888

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| foo.ABC
2-
| LegalEnum
2+
a| LegalEnum +
3+
func-of: foo.GHI
34
| FLD:foo.ABC
45
a|
56
* https://riscv.github.io/riscv-isa-manual/snapshot/norm-rules/norm-rules.html#FOO_ABC_WARL_ENUM[FOO_ABC_WARL_ENUM]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| qux.QQQ
2-
| Other
2+
a| Other +
3+
func-of: foo.GHI
34
| FLD:qux.QQQ
45
a|
56
* https://riscv.github.io/riscv-isa-manual/snapshot/norm-rules/norm-rules.html#QUX_QQQ_WLRL_OTHER[QUX_QQQ_WLRL_OTHER]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| foo.ABC
2-
| LegalEnum
2+
a| LegalEnum +
3+
func-of: foo.GHI
34
| FLD:foo.ABC
45
a|
56
* https://riscv.github.io/riscv-isa-manual/snapshot/norm-rules/norm-rules.html#FOO_ABC_WARL_ENUM[FOO_ABC_WARL_ENUM]

0 commit comments

Comments
 (0)