|
| 1 | += Encoding prose in UDB architecture files |
| 2 | + |
| 3 | +[WARNING] |
| 4 | +---- |
| 5 | +The UDB project is transitioning to a more structured encoding of prose described in this document. |
| 6 | +
|
| 7 | +Legacy prose that is encoded as a simple Asciidoc string will continue to be supported until |
| 8 | +all files can be transitioned, but the legacy style is considered _DEPRECATED_. |
| 9 | +---- |
| 10 | + |
| 11 | +Many UDB database objects have associated prose included under the `description` tag. |
| 12 | +Prose is treated as an ordered sequence of tagged statements. |
| 13 | + |
| 14 | +Every statement *MUST* include: |
| 15 | + |
| 16 | +|=== |
| 17 | +| Tag | Type | Note |
| 18 | + |
| 19 | +| `id` | String | A globally unique, immutable identifier for the statement. |
| 20 | +| `normative` | Boolean | Whether or not the statement is considered normative. |
| 21 | +| `text` | String | Asciidoc-encoded contents of the statement |
| 22 | +|=== |
| 23 | + |
| 24 | +Additionally, statements *MAY* include: |
| 25 | + |
| 26 | +|=== |
| 27 | +| Tag | Type | Note |
| 28 | + |
| 29 | +| `when()` | IDL | An IDL function body that returns a boolean. |
| 30 | + If present, represents the condition when the statement is effective. |
| 31 | +|=== |
| 32 | + |
| 33 | +== Examples |
| 34 | + |
| 35 | +```yaml |
| 36 | +description: |
| 37 | + - id: csr-hstatus-vgein-behavior |
| 38 | + normative: false |
| 39 | + text: | |
| 40 | + Controls the endianness of data VS-mode (0 = little, 1 = big). |
| 41 | + Instructions are always little endian, regardless of the data setting. |
| 42 | + |
| 43 | + - id: csr-hstatus-vgein-little-endian |
| 44 | + normative: false |
| 45 | + text: | |
| 46 | + Since the CPU does not support big endian in VS-mode, this is hardwired to 0. |
| 47 | + when(): return VS_MODE_ENDIANESS == "little"; |
| 48 | + |
| 49 | + - id: csr-hstatus-vgein-big-endian |
| 50 | + normative: false |
| 51 | + text: | |
| 52 | + Since the CPU does not support little endian in VS-mode, this is hardwired to 1. |
| 53 | + when(): return VS_MODE_ENDIANESS == "big"; |
| 54 | +``` |
| 55 | + |
| 56 | +== ID conventions |
| 57 | + |
| 58 | +IDs should be all lowercase, have no spaces, and follow the conventions below. |
| 59 | +In all cases, `WHAT` should be a short descriptor for the statement contents. |
| 60 | + |
| 61 | + |
| 62 | +=== Statements about an extension |
| 63 | + |
| 64 | +``` |
| 65 | +ext-<EXTENSION NAME>-<WHAT> |
| 66 | + |
| 67 | +# examples |
| 68 | +ext-zammo-memory-order |
| 69 | +ext-zkt-latency-requirement |
| 70 | +``` |
| 71 | + |
| 72 | +=== Statements about an instruction |
| 73 | + |
| 74 | +``` |
| 75 | +inst-<INSTRUCTION MNEMONIC>-<WHAT> |
| 76 | + |
| 77 | +# examples |
| 78 | +inst-add-behavior |
| 79 | +inst-fence.tso-behavior |
| 80 | +``` |
| 81 | + |
| 82 | +=== Statements about a CSR register |
| 83 | + |
| 84 | +``` |
| 85 | +csr-<CSR NAME>-<WHAT> |
| 86 | + |
| 87 | +# examples |
| 88 | +csr-hstatus-purpose |
| 89 | +csr-misa-purpose |
| 90 | +``` |
| 91 | + |
| 92 | +=== Statements about a CSR field |
| 93 | + |
| 94 | +``` |
| 95 | +csr-<CSR NAME>-<FIELD NAME>-<WHAT> |
| 96 | + |
| 97 | +# examples |
| 98 | +csr-hstatus-vgein-little-endian |
| 99 | +csr-misa-c-mutable |
| 100 | +``` |
0 commit comments