|
| 1 | +# Instructions Repository |
| 2 | + |
| 3 | +This repository contains definitions for instructions following the standardized JSON schema provided by UDB (Universal Design Base). Each instruction is specified within its own YAML file. |
| 4 | + |
| 5 | +## Structure |
| 6 | + |
| 7 | +Instructions are organized under the following path: |
| 8 | + |
| 9 | +``` |
| 10 | +arch/ |
| 11 | + inst/ |
| 12 | + <extension_name>/ # Typically alphabetical order of extensions defining instructions; however, this is not mandatory. |
| 13 | + <instruction_name>.yaml |
| 14 | +``` |
| 15 | + |
| 16 | +## Creating an Instruction Definition |
| 17 | + |
| 18 | +Each instruction definition should conform to the provided schema (`inst_schema.json`). Below is a detailed template and explanation for creating a new instruction YAML file. |
| 19 | + |
| 20 | +### YAML Template |
| 21 | + |
| 22 | +```yaml |
| 23 | +$schema: "inst_schema.json#" |
| 24 | +kind: instruction |
| 25 | +name: <instruction_mnemonic> |
| 26 | +long_name: <Brief description of the instruction> |
| 27 | +description: | |
| 28 | + Detailed explanation of what the instruction does. |
| 29 | + Use clear and precise asciidoc-formatted text. |
| 30 | +definedBy: <Extension defining this instruction> |
| 31 | +assembly: <assembly_format> |
| 32 | +encoding: |
| 33 | + match: <binary encoding using 0, 1, and -> |
| 34 | + variables: |
| 35 | + - name: <variable_name> |
| 36 | + location: <bit range, e.g., 24-20> |
| 37 | +access: |
| 38 | + s: always | sometimes | never |
| 39 | + u: always | sometimes | never |
| 40 | + vs: always | sometimes | never |
| 41 | + vu: always | sometimes | never |
| 42 | +data_independent_timing: true | false |
| 43 | +operation(): | |
| 44 | + # Optional IDL operation |
| 45 | + leave empty if not provided |
| 46 | +
|
| 47 | +sail(): | |
| 48 | + # Optional Sail operation |
| 49 | + leave empty if not provided |
| 50 | +``` |
| 51 | +
|
| 52 | +### Explanation of Fields |
| 53 | +
|
| 54 | +- **`name`**: The mnemonic of the instruction (lowercase, alphanumeric and periods only). |
| 55 | +- **`long_name`**: Short, human-readable description. |
| 56 | +- **`description`**: Full, detailed description of the instruction behavior (asciidoc format). |
| 57 | +- **`definedBy`**: Specifies the extension defining this instruction. |
| 58 | +- **`assembly`**: Instruction format in assembly language, including operands. |
| 59 | +- **`encoding.match`**: Binary encoding of the instruction with fixed bits defined by `0` or `1` and variable bits indicated by `-`. |
| 60 | +- **`encoding.variables`**: Defines fields in the instruction encoding, including their location. |
| 61 | + - **`name`**: Name of the field (e.g., `rs1`, `rs2`). |
| 62 | + - **`location`**: Bit positions of the field in the instruction encoding. |
| 63 | +- **`access`**: Specifies the privilege mode access for the instruction (`always`, `sometimes`, or `never`). |
| 64 | +- **`data_independent_timing`**: Indicates whether the execution timing is data-independent. |
| 65 | +- **`operation()` & `sail()`**: Optional fields for IDL or Sail descriptions. Leave empty if unused. |
| 66 | + |
| 67 | +## JSON Schema |
| 68 | + |
| 69 | +All instruction definitions must adhere strictly to the provided JSON schema: |
| 70 | + |
| 71 | +[`inst_schema.json`](schemas/inst_schema.json) |
| 72 | + |
| 73 | +Ensure compliance with schema validation to facilitate integration and usage within UDB. |
0 commit comments