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": {
"const": true,
"description": "Must be true; indicates 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": {
"const": true,
"description": "Must be true; indicates 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
18 changes: 10 additions & 8 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 definition specifying legal write values and associated behavior (including handling of illegal writes)"
},
"width": {
"$ref": "param-common-schema.json#/paramName",
Expand Down Expand Up @@ -186,11 +186,13 @@
}
},
{
"oneOf": [
{ "required": ["type"] },
{ "required": ["width"] },
{ "required": ["ro-mask"] }
]
"not": {
"anyOf": [
{ "required": ["enum", "width"] },
{ "required": ["enum", "ro-mask"] },
{ "required": ["width", "ro-mask"] }
]
}
},
{
"if": {
Expand Down
41 changes: 10 additions & 31 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 @@ -173,35 +174,13 @@
}
},
{
"oneOf": [
{
"required": ["type"],
"not": {
"anyOf": [
{ "required": ["width"] },
{ "required": ["ro-mask"] }
]
}
},
{
"required": ["width"],
"not": {
"anyOf": [
{ "required": ["type"] },
{ "required": ["ro-mask"] }
]
}
},
{
"required": ["ro-mask"],
"not": {
"anyOf": [
{ "required": ["type"] },
{ "required": ["width"] }
]
}
}
]
"not": {
"anyOf": [
{ "required": ["enum", "width"] },
{ "required": ["enum", "ro-mask"] },
{ "required": ["width", "ro-mask"] }
]
}
}
],
"additionalProperties": false
Expand Down
16 changes: 10 additions & 6 deletions tests/norm-rule/expected/test-ch2-norm-tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
"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."
"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.",
"norm:qux_qqq_wlrl_no_selector": "The qux.QQQ CSR field has implementation-defined behavior\nwithout an enum, width, or read-only mask selector."
},
"sections": {
"title": "",
Expand Down Expand Up @@ -66,10 +68,12 @@
"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"
"norm:bar_warl_readonly_value",
"norm:qux_qqq_wlrl_no_selector"
]
}
],
Expand Down
Loading
Loading