Skip to content

Commit 1a691ca

Browse files
committed
Implement Zcmop Compressed MOP Instructions
This commit adds support for the Zcmop extension by defining the 16-bit compressed C.MOP.n instructions. These instructions use a fixed encoding pattern with a variable field (mop_n_field) to select one of eight instructions (for odd n values from 1 to 15). By default, they do not write to any registers, which allows them to safely act as no-ops when the extension is not active. This change lays the foundation for future extensions that may redefine these instructions.
1 parent 58a94be commit 1a691ca

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

arch/inst/Zcmop/c.mop.n.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
$schema: inst_schema.json#
4+
kind: instruction
5+
name: c.mop.n
6+
long_name: Compressed May-Be-Operation Instruction
7+
description: C.MOP.n is encoded in the reserved encoding space corresponding to C.LUI xn, 0. Unlike the MOPs defined in the Zimop extension, the C.MOP.n instructions are defined to not write any register. Their encoding allows future extensions to define them to read register x[n].
8+
definedBy: Zcmop
9+
assembly: "|"
10+
encoding:
11+
match: 01100---10000001
12+
variables:
13+
- name: mop_n_field
14+
location: 10-8
15+
left_shift: 1
16+
access:
17+
s: always
18+
u: always
19+
vs: always
20+
vu: always
21+
data_independent_timing: false
22+
pseudoinstructions:
23+
- when: (mop_n_field == 0x1)
24+
to: c.mop.1
25+
- when: (mop_n_field == 0x3)
26+
to: c.mop.3
27+
- when: (mop_n_field == 0x5)
28+
to: c.mop.5
29+
- when: (mop_n_field == 0x7)
30+
to: c.mop.7
31+
- when: (mop_n_field == 0x9)
32+
to: c.mop.9
33+
- when: (mop_n_field == 0xB)
34+
to: c.mop.11
35+
- when: (mop_n_field == 0xD)
36+
to: c.mop.13
37+
- when: (mop_n_field == 0xF)
38+
to: c.mop.15
39+
operation(): |

0 commit comments

Comments
 (0)