|
| 1 | +--- |
1 | 2 | # yaml-language-server: $schema=../../../schemas/inst_schema.json
|
2 | 3 |
|
3 | 4 | $schema: "inst_schema.json#"
|
4 | 5 | kind: instruction
|
5 | 6 | name: amocas.d
|
6 |
| -long_name: No synopsis available. |
| 7 | +long_name: Atomic Compare-and-Swap Doubleword |
7 | 8 | description: |
|
8 |
| - No description available. |
| 9 | + For RV32, AMOCAS.D atomically loads 64-bits of a data value from address in |
| 10 | + rs1, compares the loaded value to a 64-bit value held in a register pair |
| 11 | + consisting of rd and rd+1, and if the comparison is bitwise equal, then |
| 12 | + stores the 64-bit value held in the register pair rs2 and rs2+1 to the |
| 13 | + original address in rs1. The value loaded from memory is placed into the |
| 14 | + register pair rd and rd+1. The instruction requires the first register in |
| 15 | + the pair to be even numbered; encodings with odd-numbered registers |
| 16 | + specified in rs2 and rd are reserved. When the first register of a source |
| 17 | + register pair is x0, then both halves of the pair read as zero. When the |
| 18 | + first register of a destination register pair is x0, then the entire |
| 19 | + register result is discarded and neither destination register is written. |
| 20 | +
|
| 21 | + For RV64, AMOCAS.D atomically loads 64-bits of a data value from address in |
| 22 | + rs1, compares the loaded value to a 64-bit value held in rd, and if the |
| 23 | + comparison is bitwise equal, then stores the 64-bit value held in rs2 to the |
| 24 | + original address in rs1. The value loaded from memory is placed into |
| 25 | + register rd. |
| 26 | +
|
| 27 | + Just as for AMOs in the A extension, AMOCAS.D requires that the address held |
| 28 | + in rs1 be naturally aligned to the size of the operand (i.e., eight-byte |
| 29 | + aligned for doublewords). And the same exception options apply if the |
| 30 | + address is not naturally aligned. |
| 31 | +
|
| 32 | + Just as for AMOs in the A extension, the AMOCAS.D optionally provides release |
| 33 | + consistency semantics, using the aq and rl bits, to help implement |
| 34 | + multiprocessor synchronization. The memory operation performed by an |
| 35 | + AMOCAS.D, when successful, has acquire semantics if aq bit is 1 and has |
| 36 | + release semantics if rl bit is 1. The memory operation performed by an |
| 37 | + AMOCAS.W/D/Q, when not successful, has acquire semantics if aq bit is 1 but |
| 38 | + does not have release semantics, regardless of rl. |
| 39 | +
|
| 40 | + A FENCE instruction may be used to order the memory read access and, if |
| 41 | + produced, the memory write access by an AMOCAS.D instruction. |
| 42 | +
|
| 43 | + [Note] An unsuccessful AMOCAS.D may either not perform a memory write or may |
| 44 | + write back the old value loaded from memory. The memory write, if produced, |
| 45 | + does not have release semantics, regardless of rl. |
| 46 | +
|
| 47 | + An AMOCAS.D instruction always requires write permissions. |
| 48 | +
|
9 | 49 | definedBy: Zacas
|
10 | 50 | assembly: xd, xs1, xs2, aq, rl
|
11 | 51 | encoding:
|
12 |
| - match: 00101------------011-----0101111 |
13 |
| - variables: |
14 |
| - - name: aq |
15 |
| - location: 26-26 |
16 |
| - - name: rl |
17 |
| - location: 25-25 |
18 |
| - - name: rs2 |
19 |
| - location: 24-20 |
20 |
| - - name: rs1 |
21 |
| - location: 19-15 |
22 |
| - - name: rd |
23 |
| - location: 11-7 |
| 52 | + RV32: |
| 53 | + match: 00101------------011-----0101111 |
| 54 | + variables: |
| 55 | + - name: aq |
| 56 | + location: 26-26 |
| 57 | + - name: rl |
| 58 | + location: 25-25 |
| 59 | + - name: rs2 |
| 60 | + location: 24-20 |
| 61 | + not: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31] |
| 62 | + - name: rs1 |
| 63 | + location: 19-15 |
| 64 | + - name: rd |
| 65 | + location: 11-7 |
| 66 | + not: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31] |
| 67 | + RV64: |
| 68 | + match: 00101------------011-----0101111 |
| 69 | + variables: |
| 70 | + - name: aq |
| 71 | + location: 26-26 |
| 72 | + - name: rl |
| 73 | + location: 25-25 |
| 74 | + - name: rs2 |
| 75 | + location: 24-20 |
| 76 | + - name: rs1 |
| 77 | + location: 19-15 |
| 78 | + - name: rd |
| 79 | + location: 11-7 |
24 | 80 | access:
|
25 | 81 | s: always
|
26 | 82 | u: always
|
|
0 commit comments