blob: a667fbcb05da1e4b3ef986503e98a1641bd26934 [file] [log] [blame]
swissChili1c166812022-07-16 21:57:06 -07001[ADDI]
2name = "Add immediate"
3opcode = "OP-IMM / ADDI"
4encoding = "I"
5extension = "I"
6long_description = """
7ADDI adds the sign-extended 12-bit immediate to register rs1. Arithmetic overflow is ignored and
8the result is simply the low XLEN bits of the result. ADDI rd, rs1, 0 is used to implement the MV
9rd, rs1 assembler pseudoinstruction.
10"""
11
12
13[SLTI]
14name = "Set less than immediate"
15opcode = "OP-IMM / SLTI"
16encoding = "I"
17extension = "I"
18long_description = """
19SLTI (set less than immediate) places the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. SLTIU is
20similar but compares the values as unsigned numbers (i.e., the immediate is first sign-extended to
21XLEN bits then treated as an unsigned number). Note, SLTIU rd, rs1, 1 sets rd to 1 if rs1 equals
22zero, otherwise sets rd to 0 (assembler pseudoinstruction SEQZ rd, rs)
23"""
24
25
26[SLTIU]
27name = "Set less than immediate unsigned"
28opcode = "OP-IMM / SLTIU"
29encoding = "I"
30extension = "I"
31long_description = """
32SLTI (set less than immediate) places the value 1 in register rd if register rs1 is less than the signextended immediate when both are treated as signed numbers, else 0 is written to rd. SLTIU is
33similar but compares the values as unsigned numbers (i.e., the immediate is first sign-extended to
34XLEN bits then treated as an unsigned number). Note, SLTIU rd, rs1, 1 sets rd to 1 if rs1 equals
35zero, otherwise sets rd to 0 (assembler pseudoinstruction SEQZ rd, rs)
36"""
37
38[ANDI]
39name = "AND immediate"
40opcode = "OP-IMM / ANDI"
41encoding = "I"
42extension = "I"
43long_description = """
44ANDI, ORI, XORI are logical operations that perform bitwise AND, OR, and XOR on register rs1
45and the sign-extended 12-bit immediate and place the result in rd. Note, XORI rd, rs1, -1 performs
46a bitwise logical inversion of register rs1 (assembler pseudoinstruction
47NOT rd, rs).
48"""
49
50[ORI]
51name = "OR immediate"
52opcode = "OP-IMM / ORI"
53encoding = "I"
54extension = "I"
55long_description = """
56ANDI, ORI, XORI are logical operations that perform bitwise AND, OR, and XOR on register rs1
57and the sign-extended 12-bit immediate and place the result in rd. Note, XORI rd, rs1, -1 performs
58a bitwise logical inversion of register rs1 (assembler pseudoinstruction
59NOT rd, rs).
60"""
61
62[XORI]
63name = "XOR immediate"
64opcode = "OP-IMM / XORI"
65encoding = "I"
66extension = "I"
67long_description = """
68ANDI, ORI, XORI are logical operations that perform bitwise AND, OR, and XOR on register rs1
69and the sign-extended 12-bit immediate and place the result in rd. Note, XORI rd, rs1, -1 performs
70a bitwise logical inversion of register rs1 (assembler pseudoinstruction
71NOT rd, rs).
72"""
73
74[SLLI]
75name = "Shift left logical immediate"
76opcode = "OP-IMM / SLLI"
77encoding = "I"
78extension = "I"
79long_description = """
80Shifts by a constant are encoded as a specialization of the I-type
81format. The operand to be shiftedis inrs1, and the shift amount is
82encoded in the lower 5 bits of the I-immediate field. The rightshift
83type is encoded in bit 30. SLLI is a logical left shift (zeros are
84shifted into the lower bits); SRLI is a logical right shift (zeros are
85shifted into the upper bits); and SRAI is an arithmetic rightshift (the
86original sign bit is copied into the vacated upper bits).
87"""
88
89[SRLI]
90name = "Shift right logical immediate"
91opcode = "OP-IMM / SRLI"
92encoding = "I"
93extension = "I"
94long_description = """
95Shifts by a constant are encoded as a specialization of the I-type
96format. The operand to be shiftedis inrs1, and the shift amount is
97encoded in the lower 5 bits of the I-immediate field. The rightshift
98type is encoded in bit 30. SLLI is a logical left shift (zeros are
99shifted into the lower bits); SRLI is a logical right shift (zeros are
100shifted into the upper bits); and SRAI is an arithmetic rightshift (the
101original sign bit is copied into the vacated upper bits).
102"""
103
104[SRAI]
105name="Shift right arithmetic immediate"
106opcode = "OP-IMM / SRAI"
107encoding = "I"
108extension = "I"
109long_description = """
110Shifts by a constant are encoded as a specialization of the I-type
111format. The operand to be shiftedis inrs1, and the shift amount is
112encoded in the lower 5 bits of the I-immediate field. The rightshift
113type is encoded in bit 30. SLLI is a logical left shift (zeros are
114shifted into the lower bits); SRLI is a logical right shift (zeros are
115shifted into the upper bits); and SRAI is an arithmetic rightshift (the
116original sign bit is copied into the vacated upper bits).
117"""
118
119[LUI]
120name = "Load upper immediate"
121opcode = "LUI"
122encoding = "U"
123extension = "I"
124long_description = """
125LUI (load upper immediate) is used to build 32-bit constants and uses the U-type format. LUIplaces the U-immediate value in the top 20 bits of the destination registerrd, filling in the lowest12 bits with zeros.
126"""
127
128[AUIPC]
129name = "Add upper immediate to PC"
130opcode = "AUIPC"
131encoding = "U"
132extension = "I"
133long_description = """
134AUIPC (add upper immediate topc) is used to buildpc-relative addresses and uses the U-typeformat. AUIPC forms a 32-bit offset from the 20-bit U-immediate, filling in the lowest 12 bits withzeros, adds this offset to the address of the AUIPC instruction, then places the result in registerrd.
135"""
136
137[ADD]
138name = "Add"
139opcode = "OP / ADD / 0"
140encoding = "R"
141extension = "I"
142long_description = """
143ADD performs the addition of rs 1andrs2. SUB performs the subtraction of rs2 from rs1. Overflow sare ignored and the low XLEN bits of results are written to the destination rd.
144"""
145
146
147[SUB]
148name = "SUB"
149opcode = "OP / SUB / 0b0100000"
150encoding = "R"
151extension = "I"
152long_description = """
153ADD performs the addition of rs 1andrs2. SUB performs the subtraction of rs2 from rs1. Overflow sare ignored and the low XLEN bits of results are written to the destination rd.
154"""
155
156[SLT]
157name = "Signed less than compare"
158opcode = "OP / SLT / 0"
159encoding = "R"
160extension = "I"
161long_description = """
162SLT and SLTU perform signed and unsigned compares respectively, writing 1 tordifrs1<rs2, 0 otherwise. Note,
163SLTU rd,x0,rs2 sets rd to 1 if rs2 is not equal to zero, otherwise sets rd to zero (assembler pseudoinstruction SNEZ rd, rs).
164"""
165
166[SLTU]
167name = "Signed less than compare unsigned"
168opcode = "OP / SLTU / 0"
169encoding = "R"
170extension = "I"
171long_description = """
172SLT and SLTU perform signed and unsigned compares respectively, writing 1 tordifrs1<rs2, 0 otherwise. Note,
173SLTU rd,x0,rs2 sets rd to 1 if rs2 is not equal to zero, otherwise sets rd to zero (assembler pseudoinstruction SNEZ rd, rs).
174"""
175
176[AND]
177name = "AND"
178opcode = "OP / AND / 0"
179encoding = "R"
180extension = "I"
181long_description = """
182AND, OR, and XOR perform bitwise logical operations.
183"""
184
185[OR]
186name = "OR"
187opcode = "OP / OR / 0"
188encoding = "R"
189extension = "I"
190long_description = """
191AND, OR, and XOR perform bitwise logical operations.
192"""
193
194[XOR]
195name = "XOR"
196opcode = "OP / XOR / 0"
197encoding = "R"
198extension = "I"
199long_description = """
200AND, OR, and XOR perform bitwise logical operations.
201"""
202
203[SLL]
204name = "Shift left logical"
205opcode = "OP / SLL / 0"
206encoding = "R"
207extension = "I"
208long_description = """
209SLL, SRL, and SRA perform logical left, logical right, and arithmetic right shifts on the value inregister rs1 by the shift amount held in the lower 5 bits of register rs2
210"""
211
212[SRL]
213name = "Shift right logical"
214opcode = "OP / SRL / 0"
215encoding = "R"
216extension = "I"
217long_description = """
218SLL, SRL, and SRA perform logical left, logical right, and arithmetic right shifts on the value inregister rs1 by the shift amount held in the lower 5 bits of register rs2
219"""
220
221[SRA]
222name = "Shift right arithmetic"
223opcode = "OP / SRA / 0b0100000"
224encoding = "R"
225extension = "I"
226long_description = """
227SLL, SRL, and SRA perform logical left, logical right, and arithmetic right shifts on the value inregister rs1 by the shift amount held in the lower 5 bits of register rs2
228"""
229
230[NOP]
231name = "No operation"
232opcode = "OP-IMM / ADDI"
233encoding = "I"
234extension = "I"
235long_description = """
236The NOP instruction does not change any architecturally visible state, except for advancing the pc and incrementing any applicable performance counters. NOP is encoded as ADDI x0, x0, 0.
237"""
238
239[J]
240name = "Unconditional jump"
241opcode = "JAL"
242encoding = "J"
243extension = "I"
244long_description = """
245Plain unconditional jumps (assembler pseudoinstruction J) are encoded as
246a JAL with rd=x0.
247"""
248
249[JAL]
250name = "Jump and link"
251opcode = "JAL"
252encoding = "J"
253extension = "I"
254long_description = """
255The jump and link (JAL) instruction uses the J-type format, where the J-immediate encodes asigned offset in multiples of 2 bytes. The offset is sign-extended and added to the address of thejump instruction to form the jump target address. Jumps can therefore target a±1 MiB range. JAL stores the address of the instruction following the jump (pc+4) into register rd. The standard software calling convention uses x1 as the return address register and x5 as an alternate link register
256"""
257
258[JALR]
259name = "Jump and link register"
260opcode = "JAL"
261encoding = "I"
262extension = "I"
263long_description = """
264The indirect jump instruction JALR (jump and link register) uses the I-type encoding. The target
265address is obtained by adding the sign-extended 12-bit I-immediate to the register rs1, then setting
266the least-significant bit of the result to zero. The address of the instruction following the jump
267(pc+4) is written to register rd. Register x0 can be used as the destination if the result is not
268required.
269"""
270
271[BEQ]
272name = "Branch if equal"
273opcode = "BRANCH / BEQ"
274encoding = "B"
275extension = "I"
276long_description = """
277Branch instructions compare two registers. BEQ and BNE take the branch if registers rs1 and rs2
278are equal or unequal respectively. BLT and BLTU take the branch if rs1 is less than rs2, using
279signed and unsigned comparison respectively. BGE and BGEU take the branch if rs1 is greater
280than or equal to rs2, using signed and unsigned comparison respectively. Note, BGT, BGTU,
281BLE, and BLEU can be synthesized by reversing the operands to BLT, BLTU, BGE, and BGEU,
282respectively
283"""
284
285
286[BNE]
287name = "Branch if not equal"
288opcode = "BRANCH / BNE"
289encoding = "B"
290extension = "I"
291long_description = """
292Branch instructions compare two registers. BEQ and BNE take the branch if registers rs1 and rs2
293are equal or unequal respectively. BLT and BLTU take the branch if rs1 is less than rs2, using
294signed and unsigned comparison respectively. BGE and BGEU take the branch if rs1 is greater
295than or equal to rs2, using signed and unsigned comparison respectively. Note, BGT, BGTU,
296BLE, and BLEU can be synthesized by reversing the operands to BLT, BLTU, BGE, and BGEU,
297respectively
298"""
299
300[BLT]
301name = "Branch if less than"
302opcode = "BRANCH / BLT"
303encoding = "B"
304extension = "I"
305long_description = """
306Branch instructions compare two registers. BEQ and BNE take the branch if registers rs1 and rs2
307are equal or unequal respectively. BLT and BLTU take the branch if rs1 is less than rs2, using
308signed and unsigned comparison respectively. BGE and BGEU take the branch if rs1 is greater
309than or equal to rs2, using signed and unsigned comparison respectively. Note, BGT, BGTU,
310BLE, and BLEU can be synthesized by reversing the operands to BLT, BLTU, BGE, and BGEU,
311respectively
312"""
313
314[BLTU]
315name = "Branch if less than unsigned"
316opcode = "BRANCH / BLTU"
317encoding = "B"
318extension = "I"
319long_description = """
320Branch instructions compare two registers. BEQ and BNE take the branch if registers rs1 and rs2
321are equal or unequal respectively. BLT and BLTU take the branch if rs1 is less than rs2, using
322signed and unsigned comparison respectively. BGE and BGEU take the branch if rs1 is greater
323than or equal to rs2, using signed and unsigned comparison respectively. Note, BGT, BGTU,
324BLE, and BLEU can be synthesized by reversing the operands to BLT, BLTU, BGE, and BGEU,
325respectively
326"""
327
328[BGE]
329name = "Branch if greater or equal"
330opcode = "BRANCH / BGE"
331encoding = "B"
332extension = "I"
333long_description = """
334Branch instructions compare two registers. BEQ and BNE take the branch if registers rs1 and rs2
335are equal or unequal respectively. BLT and BLTU take the branch if rs1 is less than rs2, using
336signed and unsigned comparison respectively. BGE and BGEU take the branch if rs1 is greater
337than or equal to rs2, using signed and unsigned comparison respectively. Note, BGT, BGTU,
338BLE, and BLEU can be synthesized by reversing the operands to BLT, BLTU, BGE, and BGEU,
339respectively
340"""
341
342[BGEU]
343name = "Branch if greater or equal unsigned"
344opcode = "BRANCH / BGEU"
345encoding = "B"
346extension = "I"
347long_description = """
348Branch instructions compare two registers. BEQ and BNE take the branch if registers rs1 and rs2
349are equal or unequal respectively. BLT and BLTU take the branch if rs1 is less than rs2, using
350signed and unsigned comparison respectively. BGE and BGEU take the branch if rs1 is greater
351than or equal to rs2, using signed and unsigned comparison respectively. Note, BGT, BGTU,
352BLE, and BLEU can be synthesized by reversing the operands to BLT, BLTU, BGE, and BGEU,
353respectively
354"""
355
356[LW]
357name = "Load word"
358opcode = "LOAD / width"
359encoding = "I"
360extension = "I"
361long_description = """
362The LW instruction loads a 32-bit value from memory into rd. LH loads a 16-bit value from memory,
363then sign-extends to 32-bits before storing in rd. LHU loads a 16-bit value from memory but then
364zero extends to 32-bits before storing in rd. LB and LBU are defined analogously for 8-bit values.
365"""
366
367[LH]
368name = "Load half word"
369opcode = "LOAD / width"
370encoding = "I"
371extension = "I"
372long_description = """
373The LW instruction loads a 32-bit value from memory into rd. LH loads a 16-bit value from memory,
374then sign-extends to 32-bits before storing in rd. LHU loads a 16-bit value from memory but then
375zero extends to 32-bits before storing in rd. LB and LBU are defined analogously for 8-bit values.
376"""
377
378[LHU]
379name = "Load half word unsigned"
380opcode = "LOAD / width"
381encoding = "I"
382extension = "I"
383long_description = """
384The LW instruction loads a 32-bit value from memory into rd. LH loads a 16-bit value from memory,
385then sign-extends to 32-bits before storing in rd. LHU loads a 16-bit value from memory but then
386zero extends to 32-bits before storing in rd. LB and LBU are defined analogously for 8-bit values.
387"""
388
389[LB]
390name = "Load byte"
391opcode = "LOAD / width"
392encoding = "I"
393extension = "I"
394long_description = """
395The LW instruction loads a 32-bit value from memory into rd. LH loads a 16-bit value from memory,
396then sign-extends to 32-bits before storing in rd. LHU loads a 16-bit value from memory but then
397zero extends to 32-bits before storing in rd. LB and LBU are defined analogously for 8-bit values.
398"""
399
400[LBU]
401name = "Load byte unsigned"
402opcode = "LOAD / width"
403encoding = "I"
404extension = "I"
405long_description = """
406The LW instruction loads a 32-bit value from memory into rd. LH loads a 16-bit value from memory,
407then sign-extends to 32-bits before storing in rd. LHU loads a 16-bit value from memory but then
408zero extends to 32-bits before storing in rd. LB and LBU are defined analogously for 8-bit values.
409"""
410
411
412[SW]
413name = "Store word"
414opcode = "STORE / width"
415encoding = "S"
416extension = "I"
417long_description = """
418The SW, SH, and SB instructions store 32-bit, 16-bit, and 8-bit values from the low bits of register
419rs2 to memory
420"""
421
422[SH]
423name = "Store half word"
424opcode = "STORE / width"
425encoding = "S"
426extension = "I"
427long_description = """
428The SW, SH, and SB instructions store 32-bit, 16-bit, and 8-bit values from the low bits of register
429rs2 to memory
430"""
431
432[SB]
433name = "Store byte"
434opcode = "STORE / width"
435encoding = "S"
436extension = "I"
437long_description = """
438The SW, SH, and SB instructions store 32-bit, 16-bit, and 8-bit values from the low bits of register
439rs2 to memory
440"""
441
442[FENCE]
443name = "Fence"
444opcode = "MISC-MEM / FENCE"
445encoding = "I"
446extension = "I"
447long_description = """
448The FENCE instruction is used to order device I/O and memory accesses as
449viewed by other RISCV harts and external devices or coprocessors. Any
450combination of device input (I), device output (O), memory reads (R),
451and memory writes (W) may be ordered with respect to any combination of
452the same. Informally, no other RISC-V hart or external device can
453observe any operation in the successor set following a FENCE before any
454operation in the predecessor set preceding the FENCE. Chapter 14
455provides a precise description of the RISC-V memory consistency model
456"""
457
458[ECALL]
459name = "Environment call"
460opcode = "SYSTEM / PRIV / ECALL"
461encoding = "I"
462extension = "I"
463long_description = """
464The ECALL instruction is used to make a service request to the execution environment. The EEI
465will define how parameters for the service request are passed, but usually these will be in defined
466locations in the integer register file
467"""
468
469[EBREAK]
470name = "Environment break point"
471opcode = "SYSTEM / PRIV / EBREAK"
472encoding = "I"
473extension = "I"
474long_description = """
475The EBREAK instruction is used to return control to a debugging environment.
476"""
477
478[HINT]
479name = "Hint"
480opcode = ""
481encoding = "pseudo"
482extension = "I"
483long_description = """
484RV32I reserves a large encoding space for HINT instructions, which are usually used to communicate performance hints to the microarchitecture. HINTs are encoded as integer computational
485instructions with rd=x0. Hence, like the NOP instruction, HINTs do not change any architecturally
486visible state, except for advancing the pc and any applicable performance counters. Implementations are always allowed to ignore the encoded hints.
487"""
488
489["FENCE.I"]
490name = "Fence"
491opcode = "MISC-MEM / FENCE.I"
492encoding = "I"
493extension = "Zifencei"
494long_description = """
495The FENCE.I instruction is used to synchronize the instruction and data streams. RISC-V does
496not guarantee that stores to instruction memory will be made visible to instruction fetches on a
497RISC-V hart until that hart executes a FENCE.I instruction. A FENCE.I instruction ensures that
498a subsequent instruction fetch on a RISC-V hart will see any previous data stores already visible to
499the same RISC-V hart. FENCE.I does not ensure that other RISC-V harts’ instruction fetches will
500observe the local hart’s stores in a multiprocessor system. To make a store to instruction memory
501visible to all RISC-V harts, the writing hart has to execute a data FENCE before requesting that
502all remote RISC-V harts execute a FENCE.I.
503
504The unused fields in the FENCE.I instruction, imm[11:0], rs1, and rd, are reserved for finer-grain
505fences in future extensions. For forward compatibility, base implementations shall ignore these
506fields, and standard software shall zero these fields.
507"""
508
509[ADDIW]
510name = "Add immediate word"
511opcode = "OP-IMM-32 / ADDIW"
512encoding = "I"
513extension = "I"
514long_description = """
515ADDIW is an RV64I instruction that adds the sign-extended 12-bit immediate to register rs1
516and produces the proper sign-extension of a 32-bit result in rd. Overflows are ignored and the
517result is the low 32 bits of the result sign-extended to 64 bits. Note, ADDIW rd, rs1, 0 writes
518the sign-extension of the lower 32 bits of register rs1 into register rd (assembler pseudoinstruction
519SEXT.W)
520"""
521
522[SLLIW]
523name = "Shift left logical immediate word"
524opcode = "OP-IMM-32 / SLLIW"
525encoding = "I"
526extension = "I"
527long_description = """
528SLLIW, SRLIW, and SRAIW are RV64I-only instructions that are analogously defined but operate
529on 32-bit values and produce signed 32-bit results. SLLIW, SRLIW, and SRAIW encodings with
530imm[5] ̸= 0 are reserved.
531"""
532
533[SRLIW]
534name = "Shift right logical immediate word"
535opcode = "OP-IMM-32 / SLLIW"
536encoding = "I"
537extension = "I"
538long_description = """
539SLLIW, SRLIW, and SRAIW are RV64I-only instructions that are analogously defined but operate
540on 32-bit values and produce signed 32-bit results. SLLIW, SRLIW, and SRAIW encodings with
541imm[5] ̸= 0 are reserved.
542"""
543
544
545[SRAIW]
546name = "Shift right arithmetic immediate word"
547opcode = "OP-IMM-32 / SRAIW"
548encoding = "I"
549extension = "I"
550long_description = """
551SLLIW, SRLIW, and SRAIW are RV64I-only instructions that are analogously defined but operate
552on 32-bit values and produce signed 32-bit results. SLLIW, SRLIW, and SRAIW encodings with
553imm[5] ̸= 0 are reserved.
554"""
555
556[ADDW]
557name = "Add word"
558opcode = "OP-32 / ADDW"
559encoding = "R"
560extension = "I"
561long_description = """
562ADDW and SUBW are RV64I-only instructions that are defined analogously to ADD and SUB
563but operate on 32-bit values and produce signed 32-bit results. Overflows are ignored, and the low
56432-bits of the result is sign-extended to 64-bits and written to the destination register
565"""
566
567[SUBW]
568name = "Subtract word"
569opcode = "OP-32 / SUBW"
570encoding = "R"
571extension = "I"
572long_description = """
573ADDW and SUBW are RV64I-only instructions that are defined analogously to ADD and SUB
574but operate on 32-bit values and produce signed 32-bit results. Overflows are ignored, and the low
57532-bits of the result is sign-extended to 64-bits and written to the destination register
576"""
577
578[SLLW]
579name = "Shift left logical word"
580opcode = "OP-32 / SLLW"
581encoding = "R"
582extension = "I"
583long_description = """
584SLLW, SRLW, and SRAW are RV64I-only instructions that are analogously defined but operate
585on 32-bit values and produce signed 32-bit results. The shift amount is given by rs2[4:0]
586"""
587
588[SRLW]
589name = "Shift right logical word"
590opcode = "OP-32 / SRLW"
591encoding = "R"
592extension = "I"
593long_description = """
594SLLW, SRLW, and SRAW are RV64I-only instructions that are analogously defined but operate
595on 32-bit values and produce signed 32-bit results. The shift amount is given by rs2[4:0]
596"""
597
598[SRAW]
599name = "Shift right arithmetic word"
600opcode = "OP-32 / SRAW"
601encoding = "R"
602extension = "I"
603long_description = """
604SLLW, SRLW, and SRAW are RV64I-only instructions that are analogously defined but operate
605on 32-bit values and produce signed 32-bit results. The shift amount is given by rs2[4:0]
606"""
607
608[LA]
609name = "Load absolute address"
610opcode = ""
611encoding = "pseudo"
612extension = "I"
613long_description = """
614Load absolute address, where delta = symbol − pc.
615
616Non-position-independent version:
617auipc rd, delta[31 : 12] + delta[11]
618addi rd, rd, delta[11:0]
619
620Position-independent version:
621auipc rd, delta[31 : 12] + delta[11]
622l{w|d} rd, rd, delta[11:0]
623
624"""
625
626[LLA]
627name = "Load local address"
628opcode = ""
629encoding = "pseudo"
630extension = "I"
631long_description = """
632Load local address, where delta = symbol − pc
633
634auipc rd, delta[31 : 12] + delta[11]
635addi rd, rd, delta[11:0]
636"""
637
638["LB/LH/LW/LD"]
639name = "Load global byte/halfword/word/double"
640opcode = ""
641encoding = "pseudo"
642extension = "I"
643long_description = """
644Load global
645
646auipc rd, delta[31 : 12] + delta[11]
647l{b|h|w|d} rd, delta[11:0](rd)
648"""
649
650["SB/SH/SW/SD"]
651name = "Store global byte/halfword/word/double"
652opcode = ""
653encoding = "pseudo"
654extension = "I"
655long_description = """
656Store global
657
658auipc rt, delta[31 : 12] + delta[11]
659s{b|h|w|d} rd, delta[11:0](rt)
660"""
661
662[LI]
663name = "Load immediate"
664opcode = ""
665encoding = "pseudo"
666extension = "I"
667long_description = """
668Load immediate. Expands to "myriad sequences".
669"""
670
671[MV]
672name = "Move"
673opcode = ""
674encoding = "pseudo"
675extension = "I"
676long_description = """
677Copy register
678
679add rd, rs, 0
680"""
681
682[NOT]
683name = "One's complement negate"
684opcode = ""
685encoding = "pseudo"
686extension = "I"
687long_description = """
688One's complement negation.
689
690xori rd, rs, -1
691"""
692
693[NEG]
694name = "Two's complement negate"
695opcode = ""
696encoding = "pseudo"
697extension = "I"
698long_description = """
699Two's complement negation.
700
701sub rd, x0, rs
702"""
703
704[NEGW]
705name = "Two's complement negate word"
706opcode = ""
707encoding = "pseudo"
708extension = "I"
709long_description = """
710Two's complement negation, word length.
711
712subw rd, x0, rs
713"""
714
715
716["SEXT.W"]
717name = "Sign extend word"
718opcode = ""
719encoding = "pseudo"
720extension = "I"
721long_description = """
722Sign extend word
723
724addiw rd, rs, 0
725"""
726
727[SEQZ]
728name = "Set if equal to zero"
729opcode = ""
730encoding = "pseudo"
731extension = "I"
732long_description = """
733sltiu rd, rs, 1
734"""
735
736[SNEZ]
737name = "Set if not equal zero"
738opcode = ""
739encoding = "pseudo"
740extension = "I"
741long_description = """
742sltu rd, x0, rs
743"""
744
745[SLTZ]
746name = "Set if less than zero"
747opcode = ""
748encoding = "pseudo"
749extension = "I"
750long_description = """
751slt rd, rs, x0
752"""
753
754
755[SGTZ]
756name = "Set if greater than zero"
757opcode = ""
758encoding = "pseudo"
759extension = "I"
760long_description = """
761lst rd, x0, rs
762"""
763
764[BEQZ]
765name = "Branch if equal to zero"
766opcode = ""
767encoding = "pseudo"
768extension = "I"
769long_description = """
770beq rs, x0, offset
771"""
772
773[BNEZ]
774name = "Branch if not equal zero"
775opcode = ""
776encoding = "pseudo"
777extension = "I"
778long_description = """
779bne rs, x0, offset
780"""
781
782[BLEZ]
783name = "Branch if less than zero"
784opcode = ""
785encoding = "pseudo"
786extension = "I"
787long_description = """
788bge x0, rs, offset
789"""
790
791
792[BGEZ]
793name = "Branch if greater or equal to zero"
794opcode = ""
795encoding = "pseudo"
796extension = "I"
797long_description = """
798bge rs, x0, offset
799"""
800
801[BLTZ]
802name = "Branch if less than zero"
803opcode = ""
804encoding = "pseudo"
805extension = "I"
806long_description = """
807blt rs, x0, offset
808"""
809
810[BGTZ]
811name = "Branch if greater than zero"
812opcode = ""
813encoding = "pseudo"
814extension = "I"
815long_description = """
816blt x0, rs, offset
817"""
818
819[BTG]
820name = "Branch if greater than"
821opcode = ""
822encoding = "pseudo"
823extension = "I"
824long_description = """
825blt rt, rs, offset
826"""
827
828
829[BLE]
830name = "Branch if less than or equal"
831opcode = ""
832encoding = "pseudo"
833extension = "I"
834long_description = """
835bge rt, rs, offset
836"""
837
838[BGTU]
839name = "Branch if greater than, unsigned"
840opcode = ""
841encoding = "pseudo"
842extension = "I"
843long_description = """
844bltu rt, rs, offset
845"""
846
847[BLEU]
848name = "Branch if less than, unsigned"
849opcode = ""
850encoding = "pseudo"
851extension = "I"
852long_description = """
853bgeu rt, rs, offset
854"""
855
856[JR]
857name = "Jump register"
858opcode = ""
859encoding = "pseudo"
860extension = "I"
861long_description = """
862jalr x0, 0(rs)
863"""
864
865
866[RET]
867name = "Return from subroutine"
868opcode = ""
869encoding = "pseudo"
870extension = "I"
871long_description = """
872jalr x0, 0(x1)
873"""
874
875[CALL]
876name = "Call far-away subroutine"
877opcode = ""
878encoding = "pseudo"
879extension = "I"
880long_description = """
881auipc x1, offset[31 : 12] + offset[11]
882jalr x1, offset[11:0](x1)
883"""
884
885[TAIL]
886name = "Tail call far-away subroutine"
887opcode = ""
888encoding = "pseudo"
889extension = "I"
890long_description = """
891auipc x6, offset[31 : 12] + offset[11]
892jalr x0, offset[11:0](x6)
893"""
894
895[MUL]
896name = "Multiply"
897opcode = "OP / MUL / MULDIV"
898encoding = "R"
899extension = "M"
900long_description = """
901MUL performs an XLEN-bit×XLEN-bit multiplication of rs1 by rs2 and places the lower XLEN bits
902in the destination register. MULH, MULHU, and MULHSU perform the same multiplication but re-
903turn the upper XLEN bits of the full 2×XLEN-bit product, for signed×signed, unsigned×unsigned,
904and signed rs1×unsigned rs2 multiplication, respectively. If both the high and low bits of the same
905product are required, then the recommended code sequence is: MULH[[S]U] rdh, rs1, rs2; MUL
906rdl, rs1, rs2 (source register specifiers must be in same order and rdh cannot be the same as rs1 or
907rs2). Microarchitectures can then fuse these into a single multiply operation instead of performing
908two separate multiplies.
909"""
910
911
912[MULH]
913name = "Multiply high"
914opcode = "OP / MULH / MULDIV"
915encoding = "R"
916extension = "M"
917long_description = """
918MUL performs an XLEN-bit×XLEN-bit multiplication of rs1 by rs2 and places the lower XLEN bits
919in the destination register. MULH, MULHU, and MULHSU perform the same multiplication but re-
920turn the upper XLEN bits of the full 2×XLEN-bit product, for signed×signed, unsigned×unsigned,
921and signed rs1×unsigned rs2 multiplication, respectively. If both the high and low bits of the same
922product are required, then the recommended code sequence is: MULH[[S]U] rdh, rs1, rs2; MUL
923rdl, rs1, rs2 (source register specifiers must be in same order and rdh cannot be the same as rs1 or
924rs2). Microarchitectures can then fuse these into a single multiply operation instead of performing
925two separate multiplies.
926"""
927
928
929[MULHU]
930name = "Multiply high unsigned"
931opcode = "OP / MULHW / MULDIV"
932encoding = "R"
933extension = "M"
934long_description = """
935MUL performs an XLEN-bit×XLEN-bit multiplication of rs1 by rs2 and places the lower XLEN bits
936in the destination register. MULH, MULHU, and MULHSU perform the same multiplication but re-
937turn the upper XLEN bits of the full 2×XLEN-bit product, for signed×signed, unsigned×unsigned,
938and signed rs1×unsigned rs2 multiplication, respectively. If both the high and low bits of the same
939product are required, then the recommended code sequence is: MULH[[S]U] rdh, rs1, rs2; MUL
940rdl, rs1, rs2 (source register specifiers must be in same order and rdh cannot be the same as rs1 or
941rs2). Microarchitectures can then fuse these into a single multiply operation instead of performing
942two separate multiplies.
943"""
944
945
946[MULHSU]
947name = "Multiply high signed-unsigned"
948opcode = "OP / MULHSW / MULDIV"
949encoding = "R"
950extension = "M"
951long_description = """
952MUL performs an XLEN-bit×XLEN-bit multiplication of rs1 by rs2 and places the lower XLEN bits
953in the destination register. MULH, MULHU, and MULHSU perform the same multiplication but re-
954turn the upper XLEN bits of the full 2×XLEN-bit product, for signed×signed, unsigned×unsigned,
955and signed rs1×unsigned rs2 multiplication, respectively. If both the high and low bits of the same
956product are required, then the recommended code sequence is: MULH[[S]U] rdh, rs1, rs2; MUL
957rdl, rs1, rs2 (source register specifiers must be in same order and rdh cannot be the same as rs1 or
958rs2). Microarchitectures can then fuse these into a single multiply operation instead of performing
959two separate multiplies.
960"""
961
962
963[MULW]
964name = "Multiply word"
965opcode = "OP-32 / MULW / MULDIV"
966encoding = "R"
967extension = "M"
968long_description = """
969MULW is an RV64 instruction that multiplies the lower 32 bits of the source registers, placing the
970sign-extension of the lower 32 bits of the result into the destination register.
971"""
972
973
974[DIV]
975name = "Divide"
976opcode = "OP / DIV / MULDIV"
977encoding = "R"
978extension = "M"
979long_description = """
980DIV and DIVU perform an XLEN bits by XLEN bits signed and unsigned integer division of rs1 by
981rs2, rounding towards zero. REM and REMU provide the remainder of the corresponding division
982operation. For REM, the sign of the result equals the sign of the dividend.
983For both signed and unsigned division, it holds that dividend = divisor × quotient + remainder.
984If both the quotient and remainder are required from the same division, the recommended code
985sequence is: DIV[U] rdq, rs1, rs2; REM[U] rdr, rs1, rs2 (rdq cannot be the same as rs1 or rs2).
986Microarchitectures can then fuse these into a single divide operation instead of performing two
987separate divides.
988"""
989
990[DIVU]
991name = "Divide unsigned"
992opcode = "OP / DIVU / MULDIV"
993encoding = "R"
994extension = "M"
995long_description = """
996DIV and DIVU perform an XLEN bits by XLEN bits signed and unsigned integer division of rs1 by
997rs2, rounding towards zero. REM and REMU provide the remainder of the corresponding division
998operation. For REM, the sign of the result equals the sign of the dividend.
999For both signed and unsigned division, it holds that dividend = divisor × quotient + remainder.
1000If both the quotient and remainder are required from the same division, the recommended code
1001sequence is: DIV[U] rdq, rs1, rs2; REM[U] rdr, rs1, rs2 (rdq cannot be the same as rs1 or rs2).
1002Microarchitectures can then fuse these into a single divide operation instead of performing two
1003separate divides.
1004"""
1005
1006[REM]
1007name = "Remainder"
1008opcode = "OP / REM / MULDIV"
1009encoding = "R"
1010extension = "M"
1011long_description = """
1012DIV and DIVU perform an XLEN bits by XLEN bits signed and unsigned integer division of rs1 by
1013rs2, rounding towards zero. REM and REMU provide the remainder of the corresponding division
1014operation. For REM, the sign of the result equals the sign of the dividend.
1015For both signed and unsigned division, it holds that dividend = divisor × quotient + remainder.
1016If both the quotient and remainder are required from the same division, the recommended code
1017sequence is: DIV[U] rdq, rs1, rs2; REM[U] rdr, rs1, rs2 (rdq cannot be the same as rs1 or rs2).
1018Microarchitectures can then fuse these into a single divide operation instead of performing two
1019separate divides.
1020"""
1021
1022[REMU]
1023name = "Remainder unsigned"
1024opcode = "OP / REMU / MULDIV"
1025encoding = "R"
1026extension = "M"
1027long_description = """
1028DIV and DIVU perform an XLEN bits by XLEN bits signed and unsigned integer division of rs1 by
1029rs2, rounding towards zero. REM and REMU provide the remainder of the corresponding division
1030operation. For REM, the sign of the result equals the sign of the dividend.
1031For both signed and unsigned division, it holds that dividend = divisor × quotient + remainder.
1032If both the quotient and remainder are required from the same division, the recommended code
1033sequence is: DIV[U] rdq, rs1, rs2; REM[U] rdr, rs1, rs2 (rdq cannot be the same as rs1 or rs2).
1034Microarchitectures can then fuse these into a single divide operation instead of performing two
1035separate divides.
1036"""
1037
1038[DIVW]
1039name = "Divide word"
1040opcode = "OP-32 / DIVW / MULDIV"
1041encoding = "R"
1042extension = "M"
1043long_description = """
1044DIVW and DIVUW are RV64 instructions that divide the lower 32 bits of rs1 by the lower 32
1045bits of rs2, treating them as signed and unsigned integers respectively, placing the 32-bit quotient
1046in rd, sign-extended to 64 bits. REMW and REMUW are RV64 instructions that provide the
1047corresponding signed and unsigned remainder operations respectively. Both REMW and REMUW
1048always sign-extend the 32-bit result to 64 bits, including on a divide by zero.
1049"""
1050
1051[DIVUW]
1052name = "Divide word unsigned"
1053opcode = "OP-32 / DIVUW / MULDIV"
1054encoding = "R"
1055extension = "M"
1056long_description = """
1057DIVW and DIVUW are RV64 instructions that divide the lower 32 bits of rs1 by the lower 32
1058bits of rs2, treating them as signed and unsigned integers respectively, placing the 32-bit quotient
1059in rd, sign-extended to 64 bits. REMW and REMUW are RV64 instructions that provide the
1060corresponding signed and unsigned remainder operations respectively. Both REMW and REMUW
1061always sign-extend the 32-bit result to 64 bits, including on a divide by zero.
1062"""
1063
1064[REMW]
1065name = "Remainder word"
1066opcode = "OP-32 / REMW / MULDIV"
1067encoding = "R"
1068extension = "M"
1069long_description = """
1070DIVW and DIVUW are RV64 instructions that divide the lower 32 bits of rs1 by the lower 32
1071bits of rs2, treating them as signed and unsigned integers respectively, placing the 32-bit quotient
1072in rd, sign-extended to 64 bits. REMW and REMUW are RV64 instructions that provide the
1073corresponding signed and unsigned remainder operations respectively. Both REMW and REMUW
1074always sign-extend the 32-bit result to 64 bits, including on a divide by zero.
1075"""
1076
1077[REMUW]
1078name = "Remainder word unsigned"
1079opcode = "OP-32 / REMUW / MULDIV"
1080encoding = "R"
1081extension = "M"
1082long_description = """
1083DIVW and DIVUW are RV64 instructions that divide the lower 32 bits of rs1 by the lower 32
1084bits of rs2, treating them as signed and unsigned integers respectively, placing the 32-bit quotient
1085in rd, sign-extended to 64 bits. REMW and REMUW are RV64 instructions that provide the
1086corresponding signed and unsigned remainder operations respectively. Both REMW and REMUW
1087always sign-extend the 32-bit result to 64 bits, including on a divide by zero.
1088"""
1089
1090["LR.W"]
1091name = "Load reserved word"
1092opcode = "AMO / width / LR.W"
1093encoding = "R"
1094extension = "A"
1095long_description = """
1096Complex atomic memory operations on a single memory word or doubleword are performed with the
1097load-reserved (LR) and store-conditional (SC) instructions. LR.W loads a word from the address
1098in rs1, places the sign-extended value in rd, and registers a reservation set—a set of bytes that
1099subsumes the bytes in the addressed word. SC.W conditionally writes a word in rs2 to the address
1100in rs1: the SC.W succeeds only if the reservation is still valid and the reservation set contains the
1101bytes being written. If the SC.W succeeds, the instruction writes the word in rs2 to memory, and
1102it writes zero to rd. If the SC.W fails, the instruction does not write to memory, and it writes a
1103nonzero value to rd. Regardless of success or failure, executing an SC.W instruction invalidates
1104any reservation held by this hart. LR.D and SC.D act analogously on doublewords and are only
1105available on RV64. For RV64, LR.W and SC.W sign-extend the value placed in rd.
1106"""
1107
1108["LR.D"]
1109name = "Load reserved doubleword"
1110opcode = "AMO / width / LR.D"
1111encoding = "R"
1112extension = "A"
1113long_description = """
1114Complex atomic memory operations on a single memory word or doubleword are performed with the
1115load-reserved (LR) and store-conditional (SC) instructions. LR.W loads a word from the address
1116in rs1, places the sign-extended value in rd, and registers a reservation set—a set of bytes that
1117subsumes the bytes in the addressed word. SC.W conditionally writes a word in rs2 to the address
1118in rs1: the SC.W succeeds only if the reservation is still valid and the reservation set contains the
1119bytes being written. If the SC.W succeeds, the instruction writes the word in rs2 to memory, and
1120it writes zero to rd. If the SC.W fails, the instruction does not write to memory, and it writes a
1121nonzero value to rd. Regardless of success or failure, executing an SC.W instruction invalidates
1122any reservation held by this hart. LR.D and SC.D act analogously on doublewords and are only
1123available on RV64. For RV64, LR.W and SC.W sign-extend the value placed in rd.
1124"""
1125
1126["SC.W"]
1127name = "Store conditional word"
1128opcode = "AMO / width / SC.W"
1129encoding = "R"
1130extension = "A"
1131long_description = """
1132Complex atomic memory operations on a single memory word or doubleword are performed with the
1133load-reserved (LR) and store-conditional (SC) instructions. LR.W loads a word from the address
1134in rs1, places the sign-extended value in rd, and registers a reservation set—a set of bytes that
1135subsumes the bytes in the addressed word. SC.W conditionally writes a word in rs2 to the address
1136in rs1: the SC.W succeeds only if the reservation is still valid and the reservation set contains the
1137bytes being written. If the SC.W succeeds, the instruction writes the word in rs2 to memory, and
1138it writes zero to rd. If the SC.W fails, the instruction does not write to memory, and it writes a
1139nonzero value to rd. Regardless of success or failure, executing an SC.W instruction invalidates
1140any reservation held by this hart. LR.D and SC.D act analogously on doublewords and are only
1141available on RV64. For RV64, LR.W and SC.W sign-extend the value placed in rd.
1142"""
1143
1144["SC.D"]
1145name = "Store conditional doubleword"
1146opcode = "AMO / width / SC.D"
1147encoding = "R"
1148extension = "A"
1149long_description = """
1150Complex atomic memory operations on a single memory word or doubleword are performed with the
1151load-reserved (LR) and store-conditional (SC) instructions. LR.W loads a word from the address
1152in rs1, places the sign-extended value in rd, and registers a reservation set—a set of bytes that
1153subsumes the bytes in the addressed word. SC.W conditionally writes a word in rs2 to the address
1154in rs1: the SC.W succeeds only if the reservation is still valid and the reservation set contains the
1155bytes being written. If the SC.W succeeds, the instruction writes the word in rs2 to memory, and
1156it writes zero to rd. If the SC.W fails, the instruction does not write to memory, and it writes a
1157nonzero value to rd. Regardless of success or failure, executing an SC.W instruction invalidates
1158any reservation held by this hart. LR.D and SC.D act analogously on doublewords and are only
1159available on RV64. For RV64, LR.W and SC.W sign-extend the value placed in rd.
1160"""
1161
1162
1163["AMOSWAP.W"]
1164name = "Atomic swap word"
1165opcode = "AMO / width / AMOSWAP.W"
1166encoding = "R"
1167extension = "A"
1168long_description = """
1169The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1170tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1171structions atomically load a data value from the address in rs1, place the value into register rd,
1172apply a binary operator to the loaded value and the original value in rs2, then store the result back
1173to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1174For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1175
1176The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1177signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1178can be used to implement parallel reduction operations, where typically the return value would be
1179discarded by writing to x0.
1180"""
1181
1182["AMOSWAP.D"]
1183name = "Atomic swap doubleword"
1184opcode = "AMO / width / AMOSWAP.D"
1185encoding = "R"
1186extension = "A"
1187long_description = """
1188The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1189tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1190structions atomically load a data value from the address in rs1, place the value into register rd,
1191apply a binary operator to the loaded value and the original value in rs2, then store the result back
1192to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1193For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1194
1195The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1196signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1197can be used to implement parallel reduction operations, where typically the return value would be
1198discarded by writing to x0.
1199"""
1200
1201
1202["AMOADD.W"]
1203name = "Atomic ADD word"
1204opcode = "AMO / width / AMOADD.W"
1205encoding = "R"
1206extension = "A"
1207long_description = """
1208The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1209tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1210structions atomically load a data value from the address in rs1, place the value into register rd,
1211apply a binary operator to the loaded value and the original value in rs2, then store the result back
1212to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1213For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1214
1215The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1216signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1217can be used to implement parallel reduction operations, where typically the return value would be
1218discarded by writing to x0.
1219"""
1220
1221["AMOADD.D"]
1222name = "Atomic ADD doubleword"
1223opcode = "AMO / width / AMOADD.D"
1224encoding = "R"
1225extension = "A"
1226long_description = """
1227The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1228tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1229structions atomically load a data value from the address in rs1, place the value into register rd,
1230apply a binary operator to the loaded value and the original value in rs2, then store the result back
1231to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1232For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1233
1234The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1235signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1236can be used to implement parallel reduction operations, where typically the return value would be
1237discarded by writing to x0.
1238"""
1239
1240["AMOAND.W"]
1241name = "Atomic AND word"
1242opcode = "AMO / width / AMOAND.W"
1243encoding = "R"
1244extension = "A"
1245long_description = """
1246The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1247tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1248structions atomically load a data value from the address in rs1, place the value into register rd,
1249apply a binary operator to the loaded value and the original value in rs2, then store the result back
1250to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1251For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1252
1253The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1254signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1255can be used to implement parallel reduction operations, where typically the return value would be
1256discarded by writing to x0.
1257"""
1258
1259["AMOAND.D"]
1260name = "Atomic AND doubleword"
1261opcode = "AMO / width / AMOAND.D"
1262encoding = "R"
1263extension = "A"
1264long_description = """
1265The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1266tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1267structions atomically load a data value from the address in rs1, place the value into register rd,
1268apply a binary operator to the loaded value and the original value in rs2, then store the result back
1269to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1270For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1271
1272The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1273signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1274can be used to implement parallel reduction operations, where typically the return value would be
1275discarded by writing to x0.
1276"""
1277
1278["AMOOR.W"]
1279name = "Atomic OR word"
1280opcode = "AMO / width / AMOOR.W"
1281encoding = "R"
1282extension = "A"
1283long_description = """
1284The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1285tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1286structions atomically load a data value from the address in rs1, place the value into register rd,
1287apply a binary operator to the loaded value and the original value in rs2, then store the result back
1288to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1289For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1290
1291The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1292signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1293can be used to implement parallel reduction operations, where typically the return value would be
1294discarded by writing to x0.
1295"""
1296
1297["AMOOR.D"]
1298name = "Atomic OR doubleword"
1299opcode = "AMO / width / AMOOR.D"
1300encoding = "R"
1301extension = "A"
1302long_description = """
1303The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1304tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1305structions atomically load a data value from the address in rs1, place the value into register rd,
1306apply a binary operator to the loaded value and the original value in rs2, then store the result back
1307to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1308For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1309
1310The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1311signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1312can be used to implement parallel reduction operations, where typically the return value would be
1313discarded by writing to x0.
1314"""
1315
1316["AMOXOR.W"]
1317name = "Atomic XOR word"
1318opcode = "AMO / width / AMOXOR.W"
1319encoding = "R"
1320extension = "A"
1321long_description = """
1322The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1323tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1324structions atomically load a data value from the address in rs1, place the value into register rd,
1325apply a binary operator to the loaded value and the original value in rs2, then store the result back
1326to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1327For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1328
1329The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1330signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1331can be used to implement parallel reduction operations, where typically the return value would be
1332discarded by writing to x0.
1333"""
1334
1335["AMOXOR.D"]
1336name = "Atomic XOR doubleword"
1337opcode = "AMO / width / AMOXOR.D"
1338encoding = "R"
1339extension = "A"
1340long_description = """
1341The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1342tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1343structions atomically load a data value from the address in rs1, place the value into register rd,
1344apply a binary operator to the loaded value and the original value in rs2, then store the result back
1345to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1346For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1347
1348The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1349signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1350can be used to implement parallel reduction operations, where typically the return value would be
1351discarded by writing to x0.
1352"""
1353
1354["AMOMAX.W"]
1355name = "Atomic MAX word"
1356opcode = "AMO / width / AMOMAX.W"
1357encoding = "R"
1358extension = "A"
1359long_description = """
1360The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1361tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1362structions atomically load a data value from the address in rs1, place the value into register rd,
1363apply a binary operator to the loaded value and the original value in rs2, then store the result back
1364to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1365For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1366
1367The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1368signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1369can be used to implement parallel reduction operations, where typically the return value would be
1370discarded by writing to x0.
1371"""
1372
1373["AMOMAX.D"]
1374name = "Atomic MAX doubleword"
1375opcode = "AMO / width / AMOMAX.D"
1376encoding = "R"
1377extension = "A"
1378long_description = """
1379The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1380tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1381structions atomically load a data value from the address in rs1, place the value into register rd,
1382apply a binary operator to the loaded value and the original value in rs2, then store the result back
1383to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1384For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1385
1386The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1387signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1388can be used to implement parallel reduction operations, where typically the return value would be
1389discarded by writing to x0.
1390"""
1391
1392["AMOMAXU.W"]
1393name = "Atomic MAXU word"
1394opcode = "AMO / width / AMOMAXU.W"
1395encoding = "R"
1396extension = "A"
1397long_description = """
1398The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1399tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1400structions atomically load a data value from the address in rs1, place the value into register rd,
1401apply a binary operator to the loaded value and the original value in rs2, then store the result back
1402to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1403For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1404
1405The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1406signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1407can be used to implement parallel reduction operations, where typically the return value would be
1408discarded by writing to x0.
1409"""
1410
1411["AMOMAXU.D"]
1412name = "Atomic MAXU doubleword"
1413opcode = "AMO / width / AMOMAXU.D"
1414encoding = "R"
1415extension = "A"
1416long_description = """
1417The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1418tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1419structions atomically load a data value from the address in rs1, place the value into register rd,
1420apply a binary operator to the loaded value and the original value in rs2, then store the result back
1421to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1422For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1423
1424The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1425signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1426can be used to implement parallel reduction operations, where typically the return value would be
1427discarded by writing to x0.
1428"""
1429
1430["AMOMIN.W"]
1431name = "Atomic MIN word"
1432opcode = "AMO / width / AMOMIN.W"
1433encoding = "R"
1434extension = "A"
1435long_description = """
1436The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1437tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1438structions atomically load a data value from the address in rs1, place the value into register rd,
1439apply a binary operator to the loaded value and the original value in rs2, then store the result back
1440to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1441For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1442
1443The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1444signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1445can be used to implement parallel reduction operations, where typically the return value would be
1446discarded by writing to x0.
1447"""
1448
1449["AMOMIN.D"]
1450name = "Atomic MIN doubleword"
1451opcode = "AMO / width / AMOMIN.D"
1452encoding = "R"
1453extension = "A"
1454long_description = """
1455The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1456tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1457structions atomically load a data value from the address in rs1, place the value into register rd,
1458apply a binary operator to the loaded value and the original value in rs2, then store the result back
1459to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1460For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1461
1462The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1463signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1464can be used to implement parallel reduction operations, where typically the return value would be
1465discarded by writing to x0.
1466"""
1467
1468["AMOMINU.W"]
1469name = "Atomic MINU word"
1470opcode = "AMO / width / AMOMINU.W"
1471encoding = "R"
1472extension = "A"
1473long_description = """
1474The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1475tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1476structions atomically load a data value from the address in rs1, place the value into register rd,
1477apply a binary operator to the loaded value and the original value in rs2, then store the result back
1478to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1479For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1480
1481The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1482signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1483can be used to implement parallel reduction operations, where typically the return value would be
1484discarded by writing to x0.
1485"""
1486
1487["AMOMINU.D"]
1488name = "Atomic MINU doubleword"
1489opcode = "AMO / width / AMOMINU.D"
1490encoding = "R"
1491extension = "A"
1492long_description = """
1493The atomic memory operation (AMO) instructions perform read-modify-write operations for mul-
1494tiprocessor synchronization and are encoded with an R-type instruction format. These AMO in-
1495structions atomically load a data value from the address in rs1, place the value into register rd,
1496apply a binary operator to the loaded value and the original value in rs2, then store the result back
1497to the address in rs1. AMOs can either operate on 64-bit (RV64 only) or 32-bit words in memory.
1498For RV64, 32-bit AMOs always sign-extend the value placed in rd.
1499
1500The operations supported are swap, integer add, bitwise AND, bitwise OR, bitwise XOR, and
1501signed and unsigned integer maximum and minimum. Without ordering constraints, these AMOs
1502can be used to implement parallel reduction operations, where typically the return value would be
1503discarded by writing to x0.
1504"""
1505
1506[FLW]
1507name = "Floating point load word"
1508opcode = "LOAD-FP"
1509encoding = "I"
1510extension = "F"
1511long_description = """
1512Floating-point loads and stores use the same base+offset addressing mode as the integer base ISA,
1513with a base address in register rs1 and a 12-bit signed byte offset. The FLW instruction loads
1514a single-precision floating-point value from memory into floating-point register rd. FSW stores a
1515single-precision value from floating-point register rs2 to memory.
1516"""
1517
1518[FSW]
1519name = "Floating point store word"
1520opcode = "STORE-FP"
1521encoding = "I"
1522extension = "F"
1523long_description = """
1524Floating-point loads and stores use the same base+offset addressing mode as the integer base ISA,
1525with a base address in register rs1 and a 12-bit signed byte offset. The FLW instruction loads
1526a single-precision floating-point value from memory into floating-point register rd. FSW stores a
1527single-precision value from floating-point register rs2 to memory.
1528"""
1529
1530[FADD]
1531name = "Floating point add"
1532opcode = "OP-FP / FADD"
1533encoding = "R"
1534extension = "F"
1535long_description = """
1536Floating-point arithmetic instructions with one or two source operands use the R-type format with
1537the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
153868
1539and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1540point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1541rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1542"""
1543
1544[FSUB]
1545name = "Floating point subtract"
1546opcode = "OP-FP / FSUB"
1547encoding = "R"
1548extension = "F"
1549long_description = """
1550Floating-point arithmetic instructions with one or two source operands use the R-type format with
1551the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
155268
1553and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1554point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1555rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1556"""
1557
1558
1559[FMUL]
1560name = "Floating point multiply"
1561opcode = "OP-FP / FMUL"
1562encoding = "R"
1563extension = "F"
1564long_description = """
1565Floating-point arithmetic instructions with one or two source operands use the R-type format with
1566the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
156768
1568and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1569point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1570rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1571"""
1572
1573
1574[FDIV]
1575name = "Floating point divide"
1576opcode = "OP-FP / FDIV"
1577encoding = "R"
1578extension = "F"
1579long_description = """
1580Floating-point arithmetic instructions with one or two source operands use the R-type format with
1581the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
158268
1583and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1584point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1585rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1586"""
1587
1588
1589[FSQRT]
1590name = "Floating point square root"
1591opcode = "OP-FP / FSQRT"
1592encoding = "R"
1593extension = "F"
1594long_description = """
1595Floating-point arithmetic instructions with one or two source operands use the R-type format with
1596the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
159768
1598and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1599point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1600rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1601"""
1602
1603
1604[FMIN]
1605name = "Floating point min"
1606opcode = "OP-FP / FMIN"
1607encoding = "R"
1608extension = "F"
1609long_description = """
1610Floating-point arithmetic instructions with one or two source operands use the R-type format with
1611the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
161268
1613and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1614point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1615rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1616"""
1617
1618
1619[FMAX]
1620name = "Floating point max"
1621opcode = "OP-FP / F"
1622encoding = "R"
1623extension = "F"
1624long_description = """
1625Floating-point arithmetic instructions with one or two source operands use the R-type format with
1626the OP-FP major opcode. FADD.S and FMUL.S perform single-precision floating-point addition
162768
1628and multiplication respectively, between rs1 and rs2. FSUB.S performs the single-precision floating-
1629point subtraction of rs2 from rs1. FDIV.S performs the single-precision floating-point division of
1630rs1 by rs2. FSQRT.S computes the square root of rs1. In each case, the result is written to rd.
1631"""
1632
1633
1634[FMADD]
1635name = "Floating point fused multiply-add"
1636opcode = "FMADD"
1637encoding = "R4"
1638extension = "F"
1639long_description = """
1640Floating-point fused multiply-add instructions require a new standard instruction format. R4-type
1641instructions specify three source registers (rs1, rs2, and rs3) and a destination register (rd). This
1642format is only used by the floating-point fused multiply-add instructions.
1643FMADD.S multiplies the values in rs1 and rs2, adds the value in rs3, and writes the final result to
1644rd. FMADD.S computes (rs1×rs2)+rs3.
1645FMSUB.S multiplies the values in rs1 and rs2, subtracts the value in rs3, and writes the final result
1646to rd. FMSUB.S computes (rs1×rs2)-rs3.
1647FNMSUB.S multiplies the values in rs1 and rs2, negates the product, adds the value in rs3, and
1648writes the final result to rd. FNMSUB.S computes -(rs1×rs2)+rs3.
1649FNMADD.S multiplies the values in rs1 and rs2, negates the product, subtracts the value in rs3,
1650and writes the final result to rd. FNMADD.S computes -(rs1×rs2)-rs3.
1651"""
1652
1653[FMSUB]
1654name = "Floating point fused multiply-subtract"
1655opcode = "FMSUB"
1656encoding = "R4"
1657extension = "F"
1658long_description = """
1659Floating-point fused multiply-add instructions require a new standard instruction format. R4-type
1660instructions specify three source registers (rs1, rs2, and rs3) and a destination register (rd). This
1661format is only used by the floating-point fused multiply-add instructions.
1662FMADD.S multiplies the values in rs1 and rs2, adds the value in rs3, and writes the final result to
1663rd. FMADD.S computes (rs1×rs2)+rs3.
1664FMSUB.S multiplies the values in rs1 and rs2, subtracts the value in rs3, and writes the final result
1665to rd. FMSUB.S computes (rs1×rs2)-rs3.
1666FNMSUB.S multiplies the values in rs1 and rs2, negates the product, adds the value in rs3, and
1667writes the final result to rd. FNMSUB.S computes -(rs1×rs2)+rs3.
1668FNMADD.S multiplies the values in rs1 and rs2, negates the product, subtracts the value in rs3,
1669and writes the final result to rd. FNMADD.S computes -(rs1×rs2)-rs3.
1670"""
1671
1672[FNMADD]
1673name = "Floating point fused negate multiply-add"
1674opcode = "FNMADD"
1675encoding = "R4"
1676extension = "F"
1677long_description = """
1678Floating-point fused multiply-add instructions require a new standard instruction format. R4-type
1679instructions specify three source registers (rs1, rs2, and rs3) and a destination register (rd). This
1680format is only used by the floating-point fused multiply-add instructions.
1681FMADD.S multiplies the values in rs1 and rs2, adds the value in rs3, and writes the final result to
1682rd. FMADD.S computes (rs1×rs2)+rs3.
1683FMSUB.S multiplies the values in rs1 and rs2, subtracts the value in rs3, and writes the final result
1684to rd. FMSUB.S computes (rs1×rs2)-rs3.
1685FNMSUB.S multiplies the values in rs1 and rs2, negates the product, adds the value in rs3, and
1686writes the final result to rd. FNMSUB.S computes -(rs1×rs2)+rs3.
1687FNMADD.S multiplies the values in rs1 and rs2, negates the product, subtracts the value in rs3,
1688and writes the final result to rd. FNMADD.S computes -(rs1×rs2)-rs3.
1689"""
1690
1691[FNMSUB]
1692name = "Floating point fused negate multiply-subtract"
1693opcode = "FMNSUB"
1694encoding = "R4"
1695extension = "F"
1696long_description = """
1697Floating-point fused multiply-add instructions require a new standard instruction format. R4-type
1698instructions specify three source registers (rs1, rs2, and rs3) and a destination register (rd). This
1699format is only used by the floating-point fused multiply-add instructions.
1700FMADD.S multiplies the values in rs1 and rs2, adds the value in rs3, and writes the final result to
1701rd. FMADD.S computes (rs1×rs2)+rs3.
1702FMSUB.S multiplies the values in rs1 and rs2, subtracts the value in rs3, and writes the final result
1703to rd. FMSUB.S computes (rs1×rs2)-rs3.
1704FNMSUB.S multiplies the values in rs1 and rs2, negates the product, adds the value in rs3, and
1705writes the final result to rd. FNMSUB.S computes -(rs1×rs2)+rs3.
1706FNMADD.S multiplies the values in rs1 and rs2, negates the product, subtracts the value in rs3,
1707and writes the final result to rd. FNMADD.S computes -(rs1×rs2)-rs3.
1708"""
1709
1710
1711
1712["FCVT.W.S"]
1713name = "Convert single floating point to word integer"
1714opcode = "OP-FP / FCVT"
1715encoding = "F"
1716extension = "F"
1717long_description = """
1718Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1719OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1720point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1721or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1722floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1723FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1724sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1725are RV64-only instructions. If the rounded result is not representable in the destination format, it
1726is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1727for FCVT.int.S and the behavior for invalid inputs.
1728
1729All floating-point to integer and integer to floating-point conversion instructions round according
1730to the rm field. A floating-point register can be initialized to floating-point positive zero using
1731FCVT.S.W rd, x0, which will never set any exception flags.
1732"""
1733
1734["FCVT.L.S"]
1735name = "Convert single floating point to doubleword integer"
1736opcode = "OP-FP / FCVT"
1737encoding = "F"
1738extension = "F"
1739long_description = """
1740Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1741OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1742point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1743or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1744floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1745FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1746sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1747are RV64-only instructions. If the rounded result is not representable in the destination format, it
1748is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1749for FCVT.int.S and the behavior for invalid inputs.
1750
1751All floating-point to integer and integer to floating-point conversion instructions round according
1752to the rm field. A floating-point register can be initialized to floating-point positive zero using
1753FCVT.S.W rd, x0, which will never set any exception flags.
1754"""
1755
1756["FCVT.WU.S"]
1757name = "Convert single floating point to unsigned word integer"
1758opcode = "OP-FP / FCVT"
1759encoding = "F"
1760extension = "F"
1761long_description = """
1762Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1763OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1764point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1765or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1766floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1767FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1768sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1769are RV64-only instructions. If the rounded result is not representable in the destination format, it
1770is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1771for FCVT.int.S and the behavior for invalid inputs.
1772
1773All floating-point to integer and integer to floating-point conversion instructions round according
1774to the rm field. A floating-point register can be initialized to floating-point positive zero using
1775FCVT.S.W rd, x0, which will never set any exception flags.
1776"""
1777
1778["FCVT.LU.S"]
1779name = "Convert single floating point to unsigned doubleword integer"
1780opcode = "OP-FP / FCVT"
1781encoding = "F"
1782extension = "F"
1783long_description = """
1784Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1785OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1786point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1787or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1788floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1789FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1790sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1791are RV64-only instructions. If the rounded result is not representable in the destination format, it
1792is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1793for FCVT.int.S and the behavior for invalid inputs.
1794
1795All floating-point to integer and integer to floating-point conversion instructions round according
1796to the rm field. A floating-point register can be initialized to floating-point positive zero using
1797FCVT.S.W rd, x0, which will never set any exception flags.
1798"""
1799
1800
1801
1802["FCVT.S.W"]
1803name = "Convert word integer to single floating point"
1804opcode = "OP-FP / FCVT"
1805encoding = "F"
1806extension = "F"
1807long_description = """
1808Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1809OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1810point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1811or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1812floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1813FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1814sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1815are RV64-only instructions. If the rounded result is not representable in the destination format, it
1816is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1817for FCVT.int.S and the behavior for invalid inputs.
1818
1819All floating-point to integer and integer to floating-point conversion instructions round according
1820to the rm field. A floating-point register can be initialized to floating-point positive zero using
1821FCVT.S.W rd, x0, which will never set any exception flags.
1822"""
1823
1824
1825["FCVT.S.L"]
1826name = "Convert double word integer to single floating point"
1827opcode = "OP-FP / FCVT"
1828encoding = "F"
1829extension = "F"
1830long_description = """
1831Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1832OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1833point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1834or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1835floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1836FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1837sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1838are RV64-only instructions. If the rounded result is not representable in the destination format, it
1839is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1840for FCVT.int.S and the behavior for invalid inputs.
1841
1842All floating-point to integer and integer to floating-point conversion instructions round according
1843to the rm field. A floating-point register can be initialized to floating-point positive zero using
1844FCVT.S.W rd, x0, which will never set any exception flags.
1845"""
1846
1847["FCVT.S.WU"]
1848name = "Convert unsigned word integer to single floating point"
1849opcode = "OP-FP / FCVT"
1850encoding = "F"
1851extension = "F"
1852long_description = """
1853Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1854OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1855point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1856or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1857floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1858FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1859sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1860are RV64-only instructions. If the rounded result is not representable in the destination format, it
1861is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1862for FCVT.int.S and the behavior for invalid inputs.
1863
1864All floating-point to integer and integer to floating-point conversion instructions round according
1865to the rm field. A floating-point register can be initialized to floating-point positive zero using
1866FCVT.S.W rd, x0, which will never set any exception flags.
1867"""
1868
1869
1870["FCVT.S.LU"]
1871name = "Convert unsigned double word integer to single floating point"
1872opcode = "OP-FP / FCVT"
1873encoding = "F"
1874extension = "F"
1875long_description = """
1876Floating-point-to-integer and integer-to-floating-point conversion instructions are encoded in the
1877OP-FP major opcode space. FCVT.W.S or FCVT.L.S converts a floating-point number in floating-
1878point register rs1 to a signed 32-bit or 64-bit integer, respectively, in integer register rd. FCVT.S.W
1879or FCVT.S.L converts a 32-bit or 64-bit signed integer, respectively, in integer register rs1 into a
1880floating-point number in floating-point register rd. FCVT.WU.S, FCVT.LU.S, FCVT.S.WU, and
1881FCVT.S.LU variants convert to or from unsigned integer values. For XLEN> 32, FCVT.W[U].S
1882sign-extends the 32-bit result to the destination register width. FCVT.L[U].S and FCVT.S.L[U]
1883are RV64-only instructions. If the rounded result is not representable in the destination format, it
1884is clipped to the nearest value and the invalid flag is set. Table 11.4 gives the range of valid inputs
1885for FCVT.int.S and the behavior for invalid inputs.
1886
1887All floating-point to integer and integer to floating-point conversion instructions round according
1888to the rm field. A floating-point register can be initialized to floating-point positive zero using
1889FCVT.S.W rd, x0, which will never set any exception flags.
1890"""
1891
1892["FSGNJ.S"]
1893name = "Floating point sign injection"
1894opcode = "OP-FP / FSGNJ"
1895encoding = "R"
1896extension = "F"
1897long_description = """
1898Floating-point to floating-point sign-injection instructions, FSGNJ.S, FSGNJN.S, and FSGNJX.S,
1899produce a result that takes all bits except the sign bit from rs1. For FSGNJ, the result’s sign bit is
1900rs2’s sign bit; for FSGNJN, the result’s sign bit is the opposite of rs2’s sign bit; and for FSGNJX,
1901the sign bit is the XOR of the sign bits of rs1 and rs2. Sign-injection instructions do not set
1902floating-point exception flags, nor do they canonicalize NaNs. Note, FSGNJ.S rx, ry, ry moves ry
1903to rx (assembler pseudoinstruction FMV.S rx, ry); FSGNJN.S rx, ry, ry moves the negation of ry
1904to rx (assembler pseudoinstruction FNEG.S rx, ry); and FSGNJX.S rx, ry, ry moves the absolute
1905value of ry to rx (assembler pseudoinstruction FABS.S rx, ry).
1906"""
1907
1908["FSGNJN.S"]
1909name = "Floating point sign injection with negation"
1910opcode = "OP-FP / FSGNJ"
1911encoding = "R"
1912extension = "F"
1913long_description = """
1914Floating-point to floating-point sign-injection instructions, FSGNJ.S, FSGNJN.S, and FSGNJX.S,
1915produce a result that takes all bits except the sign bit from rs1. For FSGNJ, the result’s sign bit is
1916rs2’s sign bit; for FSGNJN, the result’s sign bit is the opposite of rs2’s sign bit; and for FSGNJX,
1917the sign bit is the XOR of the sign bits of rs1 and rs2. Sign-injection instructions do not set
1918floating-point exception flags, nor do they canonicalize NaNs. Note, FSGNJ.S rx, ry, ry moves ry
1919to rx (assembler pseudoinstruction FMV.S rx, ry); FSGNJN.S rx, ry, ry moves the negation of ry
1920to rx (assembler pseudoinstruction FNEG.S rx, ry); and FSGNJX.S rx, ry, ry moves the absolute
1921value of ry to rx (assembler pseudoinstruction FABS.S rx, ry).
1922"""
1923
1924["FSGNJX.S"]
1925name = "Floating point sign injection with SOR"
1926opcode = "OP-FP / FSGNJ"
1927encoding = "R"
1928extension = "F"
1929long_description = """
1930Floating-point to floating-point sign-injection instructions, FSGNJ.S, FSGNJN.S, and FSGNJX.S,
1931produce a result that takes all bits except the sign bit from rs1. For FSGNJ, the result’s sign bit is
1932rs2’s sign bit; for FSGNJN, the result’s sign bit is the opposite of rs2’s sign bit; and for FSGNJX,
1933the sign bit is the XOR of the sign bits of rs1 and rs2. Sign-injection instructions do not set
1934floating-point exception flags, nor do they canonicalize NaNs. Note, FSGNJ.S rx, ry, ry moves ry
1935to rx (assembler pseudoinstruction FMV.S rx, ry); FSGNJN.S rx, ry, ry moves the negation of ry
1936to rx (assembler pseudoinstruction FNEG.S rx, ry); and FSGNJX.S rx, ry, ry moves the absolute
1937value of ry to rx (assembler pseudoinstruction FABS.S rx, ry).
1938"""
1939
1940["FMV.W.X"]
1941name = "Move single floating point to integer register"
1942opcode = "OP-FP / FMV.W.X"
1943encoding = "R"
1944extension = "F"
1945long_description = """
1946Instructions are provided to move bit patterns between the floating-point and integer registers.
1947FMV.X.W moves the single-precision value in floating-point register rs1 represented in IEEE 754-
19482008 encoding to the lower 32 bits of integer register rd. The bits are not modified in the transfer,
1949and in particular, the payloads of non-canonical NaNs are preserved. For RV64, the higher 32 bits
1950of the destination register are filled with copies of the floating-point number’s sign bit.
1951FMV.W.X moves the single-precision value encoded in IEEE 754-2008 standard encoding from the
1952lower 32 bits of integer register rs1 to the floating-point register rd. The bits are not modified in
1953the transfer, and in particular, the payloads of non-canonical NaNs are preserved.
1954"""
1955
1956["FMV.X.W"]
1957name = "Move word integer to single floating point register"
1958opcode = "OP-FP / FMV.X.W"
1959encoding = "R"
1960extension = "F"
1961long_description = """
1962Instructions are provided to move bit patterns between the floating-point and integer registers.
1963FMV.X.W moves the single-precision value in floating-point register rs1 represented in IEEE 754-
19642008 encoding to the lower 32 bits of integer register rd. The bits are not modified in the transfer,
1965and in particular, the payloads of non-canonical NaNs are preserved. For RV64, the higher 32 bits
1966of the destination register are filled with copies of the floating-point number’s sign bit.
1967FMV.W.X moves the single-precision value encoded in IEEE 754-2008 standard encoding from the
1968lower 32 bits of integer register rs1 to the floating-point register rd. The bits are not modified in
1969the transfer, and in particular, the payloads of non-canonical NaNs are preserved.
1970"""
1971
1972["FEQ.S"]
1973name = "Floating point single precision equal"
1974opcode = "OP-FP / EQ / FCMP"
1975encoding = "R"
1976extension = "F"
1977long_description = """
1978Floating-point compare instructions (FEQ.S, FLT.S, FLE.S) perform the specified comparison be-
1979tween floating-point registers (rs1 = rs2, rs1 < rs2, rs1 ≤ rs2) writing 1 to the integer register rd
1980if the condition holds, and 0 otherwise.
1981FLT.S and FLE.S perform what the IEEE 754-2008 standard refers to as signaling comparisons:
1982that is, they set the invalid operation exception flag if either input is NaN. FEQ.S performs a quiet
1983comparison: it only sets the invalid operation exception flag if either input is a signaling NaN. For
1984all three instructions, the result is 0 if either operand is NaN.
1985"""
1986
1987["FLT.S"]
1988name = "Floating point single precision less than"
1989opcode = "OP-FP / LT / FCMP"
1990encoding = "R"
1991extension = "F"
1992long_description = """
1993Floating-point compare instructions (FEQ.S, FLT.S, FLE.S) perform the specified comparison be-
1994tween floating-point registers (rs1 = rs2, rs1 < rs2, rs1 ≤ rs2) writing 1 to the integer register rd
1995if the condition holds, and 0 otherwise.
1996FLT.S and FLE.S perform what the IEEE 754-2008 standard refers to as signaling comparisons:
1997that is, they set the invalid operation exception flag if either input is NaN. FEQ.S performs a quiet
1998comparison: it only sets the invalid operation exception flag if either input is a signaling NaN. For
1999all three instructions, the result is 0 if either operand is NaN.
2000"""
2001
2002["FLE.S"]
2003name = "Floating point single precision less than or equal"
2004opcode = "OP-FP / LE / FCMP"
2005encoding = "R"
2006extension = "F"
2007long_description = """
2008Floating-point compare instructions (FEQ.S, FLT.S, FLE.S) perform the specified comparison be-
2009tween floating-point registers (rs1 = rs2, rs1 < rs2, rs1 ≤ rs2) writing 1 to the integer register rd
2010if the condition holds, and 0 otherwise.
2011FLT.S and FLE.S perform what the IEEE 754-2008 standard refers to as signaling comparisons:
2012that is, they set the invalid operation exception flag if either input is NaN. FEQ.S performs a quiet
2013comparison: it only sets the invalid operation exception flag if either input is a signaling NaN. For
2014all three instructions, the result is 0 if either operand is NaN.
2015"""
2016
2017["FCLASS.S"]
2018name = "Floating point single precision classify"
2019opcode = "OP-FP / FCLASS"
2020encoding = "R"
2021extension = "F"
2022long_description = """
2023The FCLASS.S instruction examines the value in floating-point register rs1 and writes to integer
2024register rd a 10-bit mask that indicates the class of the floating-point number. The format of the
2025mask is described in Table 11.5. The corresponding bit in rd will be set if the property is true
2026and clear otherwise. All other bits in rd are cleared. Note that exactly one bit in rd will be set.
2027FCLASS.S does not set the floating-point exception flags.
2028"""
2029
2030["FMV.S"]
2031name = "Copy single precision floating point register"
2032opcode = ""
2033encoding = "pseudo"
2034extension = "F"
2035long_description = """
2036fsgnj.s rd, rs, rs
2037"""
2038
2039["FABS.S"]
2040name = "Single precision absolute value"
2041opcode = ""
2042encoding = "pseudo"
2043extension = "F"
2044long_description = """
2045fsgnjx.s rd, rs, rs
2046"""
2047
2048["FNEG.S"]
2049name = "Single precision negate"
2050opcode = ""
2051encoding = "pseudo"
2052extension = "F"
2053long_description = """
2054fsgnjn.s rd, rs, rs
2055"""
2056
2057["FMV.D"]
2058name = "Copy double precision floating point register"
2059opcode = ""
2060encoding = "pseudo"
2061extension = "D"
2062long_description = """
2063fsgnj.d rd, rs, rs
2064"""
2065
2066["FABS.D"]
2067name = "Double precision absolute value"
2068opcode = ""
2069encoding = "pseudo"
2070extension = "F"
2071long_description = """
2072fsgnjx.d rd, rs, rs
2073"""
2074
2075["FNEG.D"]
2076name = "Double precision negate"
2077opcode = ""
2078encoding = "pseudo"
2079extension = "F"
2080long_description = """
2081fsgnjn.d rd, rs, rs
2082"""
2083
2084#[]
2085#name = ""
2086#opcode = ""
2087#encoding = ""
2088#extension = ""
2089#long_description = """
2090#"""
2091
2092