-
Notifications
You must be signed in to change notification settings - Fork 76
feat: add GPR Information to UDB #1150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
|
|
||
| "title": "Register File Schema", | ||
| "description": "Schema for describing a register file", | ||
|
|
||
| "$defs": { | ||
| "register_entry": { | ||
| "type": "object", | ||
| "required": ["name"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "name": { | ||
| "$ref": "schema_defs.json#/$defs/register_name" | ||
| }, | ||
| "abi_mnemonics": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "schema_defs.json#/$defs/register_alias" | ||
| }, | ||
| "minItems": 1, | ||
| "uniqueItems": true, | ||
| "description": "ABI mnemonic names for the register" | ||
| }, | ||
| "description": { | ||
| "$ref": "schema_defs.json#/$defs/spec_text" | ||
| }, | ||
| "when": { | ||
| "$ref": "schema_defs.json#/$defs/requires_entry" | ||
| }, | ||
| "sw_read()": { | ||
| "type": "string", | ||
| "description": "Function that returns the value of the register when read by software. Use this to define special behavior for registers (e.g., x0 always reads as zero)." | ||
| }, | ||
| "sw_write(value)": { | ||
| "type": "string", | ||
| "description": "Function implementing custom write behavior for the register. Given a 'value', return either the value to be written or a modified value. Use this to define special behavior for registers (e.g., x0 ignores writes)." | ||
| }, | ||
| "caller_saved": { | ||
| "type": "boolean", | ||
| "default": false, | ||
| "description": "Whether the register is caller-saved" | ||
| }, | ||
| "callee_saved": { | ||
| "type": "boolean", | ||
| "default": false, | ||
| "description": "Whether the register is callee-saved" | ||
| }, | ||
| "roles": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "enum": [ | ||
| "zero", | ||
| "return_address", | ||
| "stack_pointer", | ||
| "global_pointer", | ||
| "thread_pointer", | ||
| "frame_pointer", | ||
| "return_value", | ||
| "argument", | ||
| "temporary" | ||
| ] | ||
| }, | ||
| "uniqueItems": true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't hurt. I don't think it will reject multiple register definitions with the same index if they have different names (or same name and different ABI mnemonics), right? We may want to validate that externally, OR, do we even need to have an index attribute, given that this is an (ordered) array? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. Duplicate indices would need to be validated outside JSON schema, especially since it might be valid to have entries with the same index before conditions are applied. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now when I think of it, index is not needed even if it is not an "ordered" array because we always have the register name as the "unique key". |
||
| } | ||
| } | ||
| }, | ||
| "register_file": { | ||
| "type": "object", | ||
| "required": [ | ||
| "$schema", | ||
| "kind", | ||
| "name", | ||
| "long_name", | ||
| "description", | ||
| "register_length", | ||
| "registers" | ||
| ], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "$schema": { | ||
| "type": "string", | ||
| "format": "uri-reference", | ||
| "const": "register_file_schema.json#", | ||
| "description": "Path to schema, relative to <UDB ROOT>/schemas" | ||
| }, | ||
| "kind": { | ||
| "type": "string", | ||
| "const": "register_file" | ||
| }, | ||
| "name": { | ||
| "$ref": "schema_defs.json#/$defs/register_file_name" | ||
| }, | ||
| "long_name": { | ||
| "type": "string" | ||
| }, | ||
| "description": { | ||
| "$ref": "schema_defs.json#/$defs/spec_text" | ||
| }, | ||
| "definedBy": { | ||
| "$ref": "schema_defs.json#/$defs/requires_entry" | ||
| }, | ||
| "register_class": { | ||
| "type": "string", | ||
| "enum": ["general_purpose", "floating_point", "vector"] | ||
| }, | ||
| "register_length": { | ||
| "$ref": "schema_defs.json#/$defs/bit_length_value" | ||
| }, | ||
| "registers": { | ||
| "type": "array", | ||
| "minItems": 1, | ||
| "items": { | ||
| "$ref": "#/$defs/register_entry" | ||
| } | ||
| }, | ||
| "$source": { | ||
| "type": "string", | ||
| "format": "uri-reference" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since CSRs are also "registers", maybe we use a slightly more specific file name, like "register_file_schema.json" or "regfile_schema.json"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.