Skip to content
Merged
51 changes: 47 additions & 4 deletions schemas/param-common-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,53 @@
"type": "string",
"enum": ["WARL", "WLRL"]
},
"csrType": {
"type": "array",
"items": { "type": "integer" },
"minItems": 1
"csrEnum": {
"type": "object",
"properties": {
"legal": {
"type": "array",
"items": { "$ref": "#/multiBaseValue" },
"minItems": 1,
"description": "Array of one or more legal values (decimal integer, 0x hex, or 0b binary)"
},
"illegal-write-ignore": {
"type": "boolean",
"description": "If true, illegal writes are silently ignored"
},
"illegal-write-return": {
"$ref": "#/multiBaseValue",
"description": "If specified, illegal writes return this value (decimal integer, 0x hex, or 0b binary)"
}
},
"required": ["legal"],
"oneOf": [
{ "required": ["legal", "illegal-write-ignore"] },
{ "required": ["legal", "illegal-write-return"] }
]
},
"csrEnumOutput": {
"type": "object",
"properties": {
"legal": {
"type": "array",
"items": { "type": "integer" },
"minItems": 1,
"description": "Array of one or more legal integers (converted to decimal)"
},
"illegal-write-ignore": {
"type": "boolean",
"description": "If true, illegal writes are silently ignored"
},
"illegal-write-return": {
"type": "integer",
"description": "Value returned on illegal writes (converted to decimal)"
}
},
"required": ["legal"],
"oneOf": [
{ "required": ["legal", "illegal-write-ignore"] },
{ "required": ["legal", "illegal-write-return"] }
]
},
"multiBaseValue": {
"oneOf": [
Expand Down
8 changes: 4 additions & 4 deletions schemas/param-defs-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@
"$ref": "param-common-schema.json#/csrNameArray",
"description": "Multiple CSR field names"
},
"type": {
"$ref": "param-common-schema.json#/csrType",
"description": "List of possible legal values"
"enum": {
"$ref": "param-common-schema.json#/csrEnum",
"description": "Enum list of possible legal write values"
},
"width": {
"$ref": "param-common-schema.json#/paramName",
Expand Down Expand Up @@ -187,7 +187,7 @@
},
{
"oneOf": [
{ "required": ["type"] },
{ "required": ["enum"] },
{ "required": ["width"] },
{ "required": ["ro-mask"] }
]
Expand Down
11 changes: 6 additions & 5 deletions schemas/params-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@
"$ref": "param-common-schema.json#/csrCategory",
"description": "CSR category"
},
"type": {
"$ref": "param-common-schema.json#/csrType"
"enum": {
"$ref": "param-common-schema.json#/csrEnumOutput",
"description": "CSR legal values and illegal-write behavior"
},
"width": {
"$ref": "param-common-schema.json#/paramName",
Expand Down Expand Up @@ -175,7 +176,7 @@
{
"oneOf": [
{
"required": ["type"],
"required": ["enum"],
"not": {
"anyOf": [
{ "required": ["width"] },
Expand All @@ -187,7 +188,7 @@
"required": ["width"],
"not": {
"anyOf": [
{ "required": ["type"] },
{ "required": ["enum"] },
{ "required": ["ro-mask"] }
]
}
Expand All @@ -196,7 +197,7 @@
"required": ["ro-mask"],
"not": {
"anyOf": [
{ "required": ["type"] },
{ "required": ["enum"] },
{ "required": ["width"] }
]
}
Expand Down
10 changes: 6 additions & 4 deletions tests/norm-rule/expected/test-ch2-norm-tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"norm:mock-csr-x": "Here’s a normative rule for mock CSR \"X\".",
"norm:mock-csr-field-y": "Here’s a normative rule for mock CSR field \"Y\".",
"norm:mock-ext-dep-A-on-B": "Here’s a normative rule for mock extension dependency of extension A on extension B.",
"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.",
"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.",
"norm:foo_abc_warl_enum": "The architecturally-defined values for the 4-bit foo.ABC\nCSR field are 0, 0b11, or 0xffff_ffff. Returns 0x7fff if written with an illegal value.",
"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.",
"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.",
"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.",
"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."
},
Expand Down Expand Up @@ -66,8 +67,9 @@
"id": "_chapter_2_3_csr_field_types",
"children": [],
"tags": [
"norm:foo_abc_warl_legal_list",
"norm:foo_def_warl_width_uint4to8",
"norm:foo_abc_warl_enum",
"norm:foo_def_warl_enum",
"norm:foo_ghi_warl_width_uint4to8",
"norm:zort_xyz_wlrl_readonly_zero",
"norm:bar_warl_readonly_value"
]
Expand Down
95 changes: 73 additions & 22 deletions tests/norm-rule/expected/test-norm-rules.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ <h2>Implementation-Defined Behaviors</h2>
</aside>
<main>
<style>.grand-total-heading { font-size: 24px; font-weight: bold; }</style>
<h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-Defined Behaviors (26 No Category, 4 WARL, 1 WLRL)</h1>
<h1 class="grand-total-heading">95 Normative Rules: Includes 32 Implementation-Defined Behaviors (26 No Category, 5 WARL, 1 WLRL)</h1>

<section id="table-norm-rules-ch-1" class="section">
<table>
Expand Down Expand Up @@ -821,7 +821,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D

<section id="table-norm-rules-ch-2" class="section">
<table>
<caption class="sticky-caption">Chapter Two: 20 Normative Rules: Includes 15 Implementation-Defined Behaviors (11 No Category, 3 WARL, 1 WLRL)</caption>
<caption class="sticky-caption">Chapter Two: 21 Normative Rules: Includes 16 Implementation-Defined Behaviors (11 No Category, 4 WARL, 1 WLRL)</caption>
<colgroup>
<col class="col-name">
<col class="col-description">
Expand Down Expand Up @@ -1048,7 +1048,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td><a href="test-ch2.html#norm:mock-ext-dep-A-on-B">norm:mock-ext-dep-A-on-B</a></td>
</tr>
<tr>
<td rowspan=5 id="FOO_ABC_WARL_LEGAL_LIST">FOO_ABC_WARL_LEGAL_LIST</td>
<td rowspan=5 id="FOO_ABC_WARL_ENUM">FOO_ABC_WARL_ENUM</td>
<td>csr_field</td>
<td>Kind</td>
</tr>
Expand All @@ -1065,11 +1065,32 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td>Implementation-defined behavior category</td>
</tr>
<tr>
<td>The architecturally-defined values for the 4-bit foo.ABC CSR field are 0, 3, or 10.<br>An implementation can support any subset of these values.</td>
<td><a href="test-ch2.html#norm:foo_abc_warl_legal_list">norm:foo_abc_warl_legal_list</a></td>
<td>The architecturally-defined values for the 4-bit foo.ABC<br>CSR field are 0, 0b11, or 0xffff_ffff. Returns 0x7fff if written with an illegal value.</td>
<td><a href="test-ch2.html#norm:foo_abc_warl_enum">norm:foo_abc_warl_enum</a></td>
</tr>
<tr>
<td rowspan=3 id="FOO_DEF_WARL_WIDTH_UINT4TO8">FOO_DEF_WARL_WIDTH_UINT4TO8</td>
<td rowspan=5 id="FOO_DEF_WARL_ENUM">FOO_DEF_WARL_ENUM</td>
<td>csr_field</td>
<td>Kind</td>
</tr>
<tr>
<td>foo.DEF</td>
<td>Instance</td>
</tr>
<tr>
<td>Implementation-defined behavior</td>
<td>Implementation-defined behavior</td>
</tr>
<tr>
<td>WARL</td>
<td>Implementation-defined behavior category</td>
</tr>
<tr>
<td>The architecturally-defined values for the 8-bit foo.DEF<br>CSR field are -1 or 0xf0. Ignores writes with an illegal value.</td>
<td><a href="test-ch2.html#norm:foo_def_warl_enum">norm:foo_def_warl_enum</a></td>
</tr>
<tr>
<td rowspan=3 id="FOO_GHI_WARL_WIDTH_UINT4TO8">FOO_GHI_WARL_WIDTH_UINT4TO8</td>
<td>Implementation-defined behavior</td>
<td>Implementation-defined behavior</td>
</tr>
Expand All @@ -1078,8 +1099,8 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td>Implementation-defined behavior category</td>
</tr>
<tr>
<td>The foo.DEF CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.</td>
<td><a href="test-ch2.html#norm:foo_def_warl_width_uint4to8">norm:foo_def_warl_width_uint4to8</a></td>
<td>The foo.GHI CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.</td>
<td><a href="test-ch2.html#norm:foo_ghi_warl_width_uint4to8">norm:foo_ghi_warl_width_uint4to8</a></td>
</tr>
<tr>
<td rowspan=5 id="BAR_WARL_READONLY_VALUE">BAR_WARL_READONLY_VALUE</td>
Expand Down Expand Up @@ -1479,7 +1500,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D

<section id="table-impldefs-impl-cat-WARL" class="section">
<table>
<caption class="sticky-caption">WARL Category (A-Z): All 4 Implementation-Defined Behaviors</caption>
<caption class="sticky-caption">WARL Category (A-Z): All 5 Implementation-Defined Behaviors</caption>
<colgroup>
<col class="col-name">
<col class="col-description">
Expand All @@ -1503,7 +1524,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td><a href="test-ch2.html#norm:bar_warl_readonly_value">norm:bar_warl_readonly_value</a></td>
</tr>
<tr>
<td rowspan=3><a href="#FOO_ABC_WARL_LEGAL_LIST">FOO_ABC_WARL_LEGAL_LIST</a></td>
<td rowspan=3><a href="#FOO_ABC_WARL_ENUM">FOO_ABC_WARL_ENUM</a></td>
<td>csr_field</td>
<td>Kind</td>
</tr>
Expand All @@ -1512,13 +1533,26 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td>Instance</td>
</tr>
<tr>
<td>The architecturally-defined values for the 4-bit foo.ABC CSR field are 0, 3, or 10.<br>An implementation can support any subset of these values.</td>
<td><a href="test-ch2.html#norm:foo_abc_warl_legal_list">norm:foo_abc_warl_legal_list</a></td>
<td>The architecturally-defined values for the 4-bit foo.ABC<br>CSR field are 0, 0b11, or 0xffff_ffff. Returns 0x7fff if written with an illegal value.</td>
<td><a href="test-ch2.html#norm:foo_abc_warl_enum">norm:foo_abc_warl_enum</a></td>
</tr>
<tr>
<td rowspan=1><a href="#FOO_DEF_WARL_WIDTH_UINT4TO8">FOO_DEF_WARL_WIDTH_UINT4TO8</a></td>
<td>The foo.DEF CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.</td>
<td><a href="test-ch2.html#norm:foo_def_warl_width_uint4to8">norm:foo_def_warl_width_uint4to8</a></td>
<td rowspan=3><a href="#FOO_DEF_WARL_ENUM">FOO_DEF_WARL_ENUM</a></td>
<td>csr_field</td>
<td>Kind</td>
</tr>
<tr>
<td>foo.DEF</td>
<td>Instance</td>
</tr>
<tr>
<td>The architecturally-defined values for the 8-bit foo.DEF<br>CSR field are -1 or 0xf0. Ignores writes with an illegal value.</td>
<td><a href="test-ch2.html#norm:foo_def_warl_enum">norm:foo_def_warl_enum</a></td>
</tr>
<tr>
<td rowspan=1><a href="#FOO_GHI_WARL_WIDTH_UINT4TO8">FOO_GHI_WARL_WIDTH_UINT4TO8</a></td>
<td>The foo.GHI CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.</td>
<td><a href="test-ch2.html#norm:foo_ghi_warl_width_uint4to8">norm:foo_ghi_warl_width_uint4to8</a></td>
</tr>
<tr>
<td rowspan=3><a href="#SATP_ASID_WARL_ASIDLEN">SATP_ASID_WARL_ASIDLEN</a></td>
Expand Down Expand Up @@ -1800,7 +1834,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D

<section id="table-impldefs-ch-2" class="section">
<table>
<caption class="sticky-caption">Chapter Two: All 15 Implementation-Defined Behaviors</caption>
<caption class="sticky-caption">Chapter Two: All 16 Implementation-Defined Behaviors</caption>
<colgroup>
<col class="col-name">
<col class="col-description">
Expand Down Expand Up @@ -1946,7 +1980,7 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td><a href="test-ch2.html#norm:mock-ext-dep-A-on-B">norm:mock-ext-dep-A-on-B</a></td>
</tr>
<tr>
<td rowspan=4><a href="#FOO_ABC_WARL_LEGAL_LIST">FOO_ABC_WARL_LEGAL_LIST</a></td>
<td rowspan=4><a href="#FOO_ABC_WARL_ENUM">FOO_ABC_WARL_ENUM</a></td>
<td>csr_field</td>
<td>Kind</td>
</tr>
Expand All @@ -1959,17 +1993,34 @@ <h1 class="grand-total-heading">94 Normative Rules: Includes 31 Implementation-D
<td>Implementation-defined behavior category</td>
</tr>
<tr>
<td>The architecturally-defined values for the 4-bit foo.ABC CSR field are 0, 3, or 10.<br>An implementation can support any subset of these values.</td>
<td><a href="test-ch2.html#norm:foo_abc_warl_legal_list">norm:foo_abc_warl_legal_list</a></td>
<td>The architecturally-defined values for the 4-bit foo.ABC<br>CSR field are 0, 0b11, or 0xffff_ffff. Returns 0x7fff if written with an illegal value.</td>
<td><a href="test-ch2.html#norm:foo_abc_warl_enum">norm:foo_abc_warl_enum</a></td>
</tr>
<tr>
<td rowspan=4><a href="#FOO_DEF_WARL_ENUM">FOO_DEF_WARL_ENUM</a></td>
<td>csr_field</td>
<td>Kind</td>
</tr>
<tr>
<td>foo.DEF</td>
<td>Instance</td>
</tr>
<tr>
<td>WARL</td>
<td>Implementation-defined behavior category</td>
</tr>
<tr>
<td>The architecturally-defined values for the 8-bit foo.DEF<br>CSR field are -1 or 0xf0. Ignores writes with an illegal value.</td>
<td><a href="test-ch2.html#norm:foo_def_warl_enum">norm:foo_def_warl_enum</a></td>
</tr>
<tr>
<td rowspan=2><a href="#FOO_DEF_WARL_WIDTH_UINT4TO8">FOO_DEF_WARL_WIDTH_UINT4TO8</a></td>
<td rowspan=2><a href="#FOO_GHI_WARL_WIDTH_UINT4TO8">FOO_GHI_WARL_WIDTH_UINT4TO8</a></td>
<td>WARL</td>
<td>Implementation-defined behavior category</td>
</tr>
<tr>
<td>The foo.DEF CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.</td>
<td><a href="test-ch2.html#norm:foo_def_warl_width_uint4to8">norm:foo_def_warl_width_uint4to8</a></td>
<td>The foo.GHI CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.</td>
<td><a href="test-ch2.html#norm:foo_ghi_warl_width_uint4to8">norm:foo_ghi_warl_width_uint4to8</a></td>
</tr>
<tr>
<td rowspan=4><a href="#BAR_WARL_READONLY_VALUE">BAR_WARL_READONLY_VALUE</a></td>
Expand Down
32 changes: 26 additions & 6 deletions tests/norm-rule/expected/test-norm-rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@
]
},
{
"name": "FOO_ABC_WARL_LEGAL_LIST",
"name": "FOO_ABC_WARL_ENUM",
"def_filename": "tests/norm-rule/test-ch2.yaml",
"chapter_name": "Two",
"kind": "csr_field",
Expand All @@ -1539,25 +1539,45 @@
"impl-def-category": "WARL",
"tags": [
{
"name": "norm:foo_abc_warl_legal_list",
"name": "norm:foo_abc_warl_enum",
"context": false,
"text": "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.",
"text": "The architecturally-defined values for the 4-bit foo.ABC\nCSR field are 0, 0b11, or 0xffff_ffff. Returns 0x7fff if written with an illegal value.",
"tag_filename": "/build/test-ch2-norm-tags.json",
"stds_doc_url": "test-ch2.html"
}
]
},
{
"name": "FOO_DEF_WARL_WIDTH_UINT4TO8",
"name": "FOO_DEF_WARL_ENUM",
"def_filename": "tests/norm-rule/test-ch2.yaml",
"chapter_name": "Two",
"kind": "csr_field",
"impl-def-behavior": true,
"instances": [
"foo.DEF"
],
"impl-def-category": "WARL",
"tags": [
{
"name": "norm:foo_def_warl_enum",
"context": false,
"text": "The architecturally-defined values for the 8-bit foo.DEF\nCSR field are -1 or 0xf0. Ignores writes with an illegal value.",
"tag_filename": "/build/test-ch2-norm-tags.json",
"stds_doc_url": "test-ch2.html"
}
]
},
{
"name": "FOO_GHI_WARL_WIDTH_UINT4TO8",
"def_filename": "tests/norm-rule/test-ch2.yaml",
"chapter_name": "Two",
"impl-def-behavior": true,
"impl-def-category": "WARL",
"tags": [
{
"name": "norm:foo_def_warl_width_uint4to8",
"name": "norm:foo_ghi_warl_width_uint4to8",
"context": false,
"text": "The foo.DEF CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.",
"text": "The foo.GHI CSR field width ranges from 4 to 8 bits as specified by the UINT_4TO8 parameter value.",
"tag_filename": "/build/test-ch2-norm-tags.json",
"stds_doc_url": "test-ch2.html"
}
Expand Down
Loading
Loading