-
Notifications
You must be signed in to change notification settings - Fork 78
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 2 commits
c386c70
2d79d0c
d369bdf
2c99a47
f1b0a8d
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 | ||
ThinkOpenly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| }, | ||
| "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" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,35 @@ | |||||
| ], | ||||||
| "description": "Location of a field in a register" | ||||||
| }, | ||||||
| "bit_length_value": { | ||||||
| "description": "Bit width value for a register or field", | ||||||
| "oneOf": [ | ||||||
| { | ||||||
| "type": "integer", | ||||||
| "minimum": 1 | ||||||
| }, | ||||||
| { | ||||||
| "type": "string", | ||||||
| "minLength": 1, | ||||||
| "enum": ["MXLEN"] | ||||||
| } | ||||||
| ] | ||||||
| }, | ||||||
| "register_name": { | ||||||
| "type": "string", | ||||||
| "pattern": "^[A-Za-z][A-Za-z0-9_.-]*$", | ||||||
| "description": "Register name" | ||||||
| }, | ||||||
| "register_file_name": { | ||||||
| "type": "string", | ||||||
| "pattern": "^[A-Za-z][A-Za-z0-9_.-]*$", | ||||||
|
||||||
| "pattern": "^[A-Za-z][A-Za-z0-9_.-]*$", | |
| "pattern": "^[A-Za-z]$", |
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.
Agree. And perhaps to take it a step further: make them all single letter uppercase? Right now, we have the unfortunate situation that X is uppercase but f and v are lowercase. That's out of necessity since we declare f and v as generic globals right now, and uppercase variable names are const by definition in IDL. X is special since it's builtin.
By having dedicated register file definitions, we can avoid the discrepancy.
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.
So, further constrain this pattern to single-character upper case, and we'll need to change the current f and v register files to F and V in the YAML and in the Ruby code?
Uh oh!
There was an error while loading. Please reload this page.