Skip to content

Commit 6572f1d

Browse files
Make enum/width/ro-mask optional for CSRs since not all will work with one of these pre-fab schemes.
Signed-off-by: James Ball <jameball@qti.qualcomm.com>
1 parent daf52c1 commit 6572f1d

File tree

12 files changed

+148
-46
lines changed

12 files changed

+148
-46
lines changed

schemas/param-defs-schema.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,13 @@
186186
}
187187
},
188188
{
189-
"oneOf": [
190-
{ "required": ["enum"] },
191-
{ "required": ["width"] },
192-
{ "required": ["ro-mask"] }
193-
]
189+
"not": {
190+
"anyOf": [
191+
{ "required": ["enum", "width"] },
192+
{ "required": ["enum", "ro-mask"] },
193+
{ "required": ["width", "ro-mask"] }
194+
]
195+
}
194196
},
195197
{
196198
"if": {

schemas/params-schema.json

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -174,35 +174,13 @@
174174
}
175175
},
176176
{
177-
"oneOf": [
178-
{
179-
"required": ["enum"],
180-
"not": {
181-
"anyOf": [
182-
{ "required": ["width"] },
183-
{ "required": ["ro-mask"] }
184-
]
185-
}
186-
},
187-
{
188-
"required": ["width"],
189-
"not": {
190-
"anyOf": [
191-
{ "required": ["enum"] },
192-
{ "required": ["ro-mask"] }
193-
]
194-
}
195-
},
196-
{
197-
"required": ["ro-mask"],
198-
"not": {
199-
"anyOf": [
200-
{ "required": ["enum"] },
201-
{ "required": ["width"] }
202-
]
203-
}
204-
}
205-
]
177+
"not": {
178+
"anyOf": [
179+
{ "required": ["enum", "width"] },
180+
{ "required": ["enum", "ro-mask"] },
181+
{ "required": ["width", "ro-mask"] }
182+
]
183+
}
206184
}
207185
],
208186
"additionalProperties": false

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"norm:foo_def_warl_enum": "The architecturally-defined values for the 8-bit foo.DEF\nCSR field are -1 or 0xf0. Ignores writes with an illegal value.",
2222
"norm:foo_ghi_warl_width_uint4to8": "The foo.GHI CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.",
2323
"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.",
24-
"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."
24+
"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.",
25+
"norm:qux_qqq_wlrl_no_selector": "The qux.QQQ CSR field has implementation-defined behavior\nwithout an enum, width, or read-only mask selector."
2526
},
2627
"sections": {
2728
"title": "",
@@ -71,7 +72,8 @@
7172
"norm:foo_def_warl_enum",
7273
"norm:foo_ghi_warl_width_uint4to8",
7374
"norm:zort_xyz_wlrl_readonly_zero",
74-
"norm:bar_warl_readonly_value"
75+
"norm:bar_warl_readonly_value",
76+
"norm:qux_qqq_wlrl_no_selector"
7577
]
7678
}
7779
],

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

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ <h2>Implementation-Defined Behaviors</h2>
155155
</aside>
156156
<main>
157157
<style>.grand-total-heading { font-size: 24px; font-weight: bold; }</style>
158-
<h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-Defined Behaviors (26 No Category, 5 WARL, 1 WLRL)</h1>
158+
<h1 class="grand-total-heading">96 Normative Rules: Includes 33 Implementation-Defined Behaviors (26 No Category, 5 WARL, 2 WLRL)</h1>
159159

160160
<section id="table-norm-rules-ch-1" class="section">
161161
<table>
@@ -821,7 +821,7 @@ <h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-D
821821

822822
<section id="table-norm-rules-ch-2" class="section">
823823
<table>
824-
<caption class="sticky-caption">Chapter Two: 21 Normative Rules: Includes 16 Implementation-Defined Behaviors (11 No Category, 4 WARL, 1 WLRL)</caption>
824+
<caption class="sticky-caption">Chapter Two: 22 Normative Rules: Includes 17 Implementation-Defined Behaviors (11 No Category, 4 WARL, 2 WLRL)</caption>
825825
<colgroup>
826826
<col class="col-name">
827827
<col class="col-description">
@@ -1144,6 +1144,27 @@ <h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-D
11441144
<td>An implementation may treat each bit of the zort.XYZ CSR as<br>read-only or read-write. Read-only bits can be 0 or 1.</td>
11451145
<td><a href="test-ch2.html#norm:zort_xyz_wlrl_readonly_zero">norm:zort_xyz_wlrl_readonly_zero</a></td>
11461146
</tr>
1147+
<tr>
1148+
<td rowspan=5 id="QUX_QQQ_WLRL_NO_SELECTOR">QUX_QQQ_WLRL_NO_SELECTOR</td>
1149+
<td>csr_field</td>
1150+
<td>Kind</td>
1151+
</tr>
1152+
<tr>
1153+
<td>qux.QQQ</td>
1154+
<td>Instance</td>
1155+
</tr>
1156+
<tr>
1157+
<td>Implementation-defined behavior</td>
1158+
<td>Implementation-defined behavior</td>
1159+
</tr>
1160+
<tr>
1161+
<td>WLRL</td>
1162+
<td>Implementation-defined behavior category</td>
1163+
</tr>
1164+
<tr>
1165+
<td>The qux.QQQ CSR field has implementation-defined behavior<br>without an enum, width, or read-only mask selector.</td>
1166+
<td><a href="test-ch2.html#norm:qux_qqq_wlrl_no_selector">norm:qux_qqq_wlrl_no_selector</a></td>
1167+
</tr>
11471168
</tbody>
11481169
</table>
11491170
</section>
@@ -1573,7 +1594,7 @@ <h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-D
15731594

15741595
<section id="table-impldefs-impl-cat-WLRL" class="section">
15751596
<table>
1576-
<caption class="sticky-caption">WLRL Category (A-Z): All 1 Implementation-Defined Behaviors</caption>
1597+
<caption class="sticky-caption">WLRL Category (A-Z): All 2 Implementation-Defined Behaviors</caption>
15771598
<colgroup>
15781599
<col class="col-name">
15791600
<col class="col-description">
@@ -1583,6 +1604,19 @@ <h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-D
15831604
<tr><th>Name</th><th>Information</th><th>Information Source</th></tr>
15841605
</thead>
15851606
<tbody>
1607+
<tr>
1608+
<td rowspan=3><a href="#QUX_QQQ_WLRL_NO_SELECTOR">QUX_QQQ_WLRL_NO_SELECTOR</a></td>
1609+
<td>csr_field</td>
1610+
<td>Kind</td>
1611+
</tr>
1612+
<tr>
1613+
<td>qux.QQQ</td>
1614+
<td>Instance</td>
1615+
</tr>
1616+
<tr>
1617+
<td>The qux.QQQ CSR field has implementation-defined behavior<br>without an enum, width, or read-only mask selector.</td>
1618+
<td><a href="test-ch2.html#norm:qux_qqq_wlrl_no_selector">norm:qux_qqq_wlrl_no_selector</a></td>
1619+
</tr>
15861620
<tr>
15871621
<td rowspan=3><a href="#ZORT_XYZ_WLRL_READONLY_ZERO">ZORT_XYZ_WLRL_READONLY_ZERO</a></td>
15881622
<td>csr_field</td>
@@ -1834,7 +1868,7 @@ <h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-D
18341868

18351869
<section id="table-impldefs-ch-2" class="section">
18361870
<table>
1837-
<caption class="sticky-caption">Chapter Two: All 16 Implementation-Defined Behaviors</caption>
1871+
<caption class="sticky-caption">Chapter Two: All 17 Implementation-Defined Behaviors</caption>
18381872
<colgroup>
18391873
<col class="col-name">
18401874
<col class="col-description">
@@ -2056,6 +2090,23 @@ <h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-D
20562090
<td>An implementation may treat each bit of the zort.XYZ CSR as<br>read-only or read-write. Read-only bits can be 0 or 1.</td>
20572091
<td><a href="test-ch2.html#norm:zort_xyz_wlrl_readonly_zero">norm:zort_xyz_wlrl_readonly_zero</a></td>
20582092
</tr>
2093+
<tr>
2094+
<td rowspan=4><a href="#QUX_QQQ_WLRL_NO_SELECTOR">QUX_QQQ_WLRL_NO_SELECTOR</a></td>
2095+
<td>csr_field</td>
2096+
<td>Kind</td>
2097+
</tr>
2098+
<tr>
2099+
<td>qux.QQQ</td>
2100+
<td>Instance</td>
2101+
</tr>
2102+
<tr>
2103+
<td>WLRL</td>
2104+
<td>Implementation-defined behavior category</td>
2105+
</tr>
2106+
<tr>
2107+
<td>The qux.QQQ CSR field has implementation-defined behavior<br>without an enum, width, or read-only mask selector.</td>
2108+
<td><a href="test-ch2.html#norm:qux_qqq_wlrl_no_selector">norm:qux_qqq_wlrl_no_selector</a></td>
2109+
</tr>
20592110
</tbody>
20602111
</table>
20612112
</section>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,26 @@
16221622
"stds_doc_url": "test-ch2.html"
16231623
}
16241624
]
1625+
},
1626+
{
1627+
"name": "QUX_QQQ_WLRL_NO_SELECTOR",
1628+
"def_filename": "tests/norm-rule/test-ch2.yaml",
1629+
"chapter_name": "Two",
1630+
"kind": "csr_field",
1631+
"impl-def-behavior": true,
1632+
"instances": [
1633+
"qux.QQQ"
1634+
],
1635+
"impl-def-category": "WLRL",
1636+
"tags": [
1637+
{
1638+
"name": "norm:qux_qqq_wlrl_no_selector",
1639+
"context": false,
1640+
"text": "The qux.QQQ CSR field has implementation-defined behavior\nwithout an enum, width, or read-only mask selector.",
1641+
"tag_filename": "/build/test-ch2-norm-tags.json",
1642+
"stds_doc_url": "test-ch2.html"
1643+
}
1644+
]
16251645
}
16261646
]
16271647
}

tests/norm-rule/test-ch2.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,6 @@ read-only or read-write. Read-only bits can be 0 or 1.#
9595

9696
[#norm:bar_warl_readonly_value]#An implementation may treat each bit of the `bar` CSR as
9797
read-only or read-write. Read-only bits are 0.#
98+
99+
[#norm:qux_qqq_wlrl_no_selector]#The `qux.QQQ` CSR field has implementation-defined behavior
100+
without an enum, width, or read-only mask selector.#

tests/norm-rule/test-ch2.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ normative_rule_definitions:
9999
impl-def-category: WLRL
100100
kind: csr_field
101101
instance: zort.XYZ
102+
- name: QUX_QQQ_WLRL_NO_SELECTOR
103+
tag: "norm:qux_qqq_wlrl_no_selector"
104+
impl-def-behavior: true
105+
impl-def-category: WLRL
106+
kind: csr_field
107+
instance: qux.QQQ

tests/params/expected/test-params.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ <h2 style="margin-top:24px">WARL/WLRL by Chapter</h2>
5454
<nav class="nav">
5555
<a href="#table-csrs-ch-1-warl" data-target="table-csrs-ch-1-warl">One WARL<span class="subtitle">1 entry</span></a>
5656
<a href="#table-csrs-ch-2-warl" data-target="table-csrs-ch-2-warl">Two WARL<span class="subtitle">4 entries</span></a>
57-
<a href="#table-csrs-ch-2-wlrl" data-target="table-csrs-ch-2-wlrl">Two WLRL<span class="subtitle">1 entry</span></a>
57+
<a href="#table-csrs-ch-2-wlrl" data-target="table-csrs-ch-2-wlrl">Two WLRL<span class="subtitle">2 entries</span></a>
5858
</nav>
5959
</aside>
6060
<main>
6161
<style>.grand-total-heading { font-size: 24px; font-weight: bold; }</style>
62-
<h1 class="grand-total-heading">42 Parameters, 6 WARL/WLRL CSRs</h1>
62+
<h1 class="grand-total-heading">42 Parameters, 7 WARL/WLRL CSRs</h1>
6363

6464
<section id="table-params-ch-1" class="section">
6565
<table>
@@ -449,7 +449,7 @@ <h1 class="grand-total-heading">42 Parameters, 6 WARL/WLRL CSRs</h1>
449449

450450
<section id="table-csrs-ch-2-wlrl" class="section">
451451
<table>
452-
<caption class="sticky-caption">Chapter Two WLRL: 1 CSR</caption>
452+
<caption class="sticky-caption">Chapter Two WLRL: 2 CSRs</caption>
453453
<colgroup>
454454
<col class="col-name">
455455
<col class="col-type">
@@ -466,6 +466,12 @@ <h1 class="grand-total-heading">42 Parameters, 6 WARL/WLRL CSRs</h1>
466466
<td rowspan=1>FLD:zort.XYZ</td>
467467
<td><a href="test-ch2.html#norm:zort_xyz_wlrl_readonly_zero">An implementation may treat each bit of the zort.XYZ CSR as<br>read-only or read-write. Read-only bits can be 0 or 1.</a></td>
468468
</tr>
469+
<tr>
470+
<td rowspan=1 id="qux.QQQ">qux.QQQ</td>
471+
<td rowspan=1>WLRL</td>
472+
<td rowspan=1>FLD:qux.QQQ</td>
473+
<td><a href="test-ch2.html#norm:qux_qqq_wlrl_no_selector">The qux.QQQ CSR field has implementation-defined behavior<br>without an enum, width, or read-only mask selector.</a></td>
474+
</tr>
469475
</tbody>
470476
</table>
471477
</section>

tests/params/expected/test-params.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,35 @@
16851685
]
16861686
}
16871687
]
1688+
},
1689+
{
1690+
"reg-name": "qux",
1691+
"field-name": "QQQ",
1692+
"def_filename": "test-ch2.yaml",
1693+
"chapter_name": "Two",
1694+
"category": "WLRL",
1695+
"impl-defs": [
1696+
{
1697+
"name": "QUX_QQQ_WLRL_NO_SELECTOR",
1698+
"def_filename": "tests/norm-rule/test-ch2.yaml",
1699+
"chapter_name": "Two",
1700+
"kind": "csr_field",
1701+
"impl-def-behavior": true,
1702+
"instances": [
1703+
"qux.QQQ"
1704+
],
1705+
"impl-def-category": "WLRL",
1706+
"tags": [
1707+
{
1708+
"name": "norm:qux_qqq_wlrl_no_selector",
1709+
"context": false,
1710+
"text": "The qux.QQQ CSR field has implementation-defined behavior\nwithout an enum, width, or read-only mask selector.",
1711+
"tag_filename": "/build/test-ch2-norm-tags.json",
1712+
"stds_doc_url": "test-ch2.html"
1713+
}
1714+
]
1715+
}
1716+
]
16881717
}
16891718
]
16901719
}

tests/params/test-ch2.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,8 @@ csr_definitions:
9090
field-name: XYZ
9191
impl-def: ZORT_XYZ_WLRL_READONLY_ZERO
9292
ro-mask: 0b1111
93+
94+
# Case 4: CSR field with no selector property (enum/width/ro-mask all omitted).
95+
- reg-name: qux
96+
field-name: QQQ
97+
impl-def: QUX_QQQ_WLRL_NO_SELECTOR

0 commit comments

Comments
 (0)