2 # RISC-V translation routines for the RVXI Base Integer Instruction Set.
4 # Copyright (c) 2018 Peer Adelt, peer.adelt@hni.uni-paderborn.de
5 # Bastian Koppelmann, kbastian@mail.uni-paderborn.de
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms and conditions of the GNU General Public License,
9 # version 2 or later, as published by the Free Software Foundation.
11 # This program is distributed in the hope it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 # You should have received a copy of the GNU General Public License along with
17 # this program. If not, see <http://www.gnu.org/licenses/>.
30 %imm_b 31:s1 7:1 25:6 8:4 !function=ex_shift_1
31 %imm_j 31:s1 12:8 20:1 21:10 !function=ex_shift_1
32 %imm_u 12:s20 !function=ex_shift_12
37 &atomic aq rl rs2 rs1 rd
40 @r ....... ..... ..... ... ..... ....... %rs2 %rs1 %rd
41 @i ............ ..... ... ..... ....... imm=%imm_i %rs1 %rd
42 @b ....... ..... ..... ... ..... ....... &b imm=%imm_b %rs2 %rs1
43 @s ....... ..... ..... ... ..... ....... imm=%imm_s %rs2 %rs1
44 @u .................... ..... ....... imm=%imm_u %rd
45 @j .................... ..... ....... imm=%imm_j %rd
47 @sh ...... ...... ..... ... ..... ....... &shift shamt=%sh10 %rs1 %rd
48 @csr ............ ..... ... ..... ....... %csr %rs1 %rd
50 @atom_ld ..... aq:1 rl:1 ..... ........ ..... ....... &atomic rs2=0 %rs1 %rd
51 @atom_st ..... aq:1 rl:1 ..... ........ ..... ....... &atomic %rs2 %rs1 %rd
53 # *** RV32I Base Instruction Set ***
54 lui .................... ..... 0110111 @u
55 auipc .................... ..... 0010111 @u
56 jal .................... ..... 1101111 @j
57 jalr ............ ..... 000 ..... 1100111 @i
58 beq ....... ..... ..... 000 ..... 1100011 @b
59 bne ....... ..... ..... 001 ..... 1100011 @b
60 blt ....... ..... ..... 100 ..... 1100011 @b
61 bge ....... ..... ..... 101 ..... 1100011 @b
62 bltu ....... ..... ..... 110 ..... 1100011 @b
63 bgeu ....... ..... ..... 111 ..... 1100011 @b
64 lb ............ ..... 000 ..... 0000011 @i
65 lh ............ ..... 001 ..... 0000011 @i
66 lw ............ ..... 010 ..... 0000011 @i
67 lbu ............ ..... 100 ..... 0000011 @i
68 lhu ............ ..... 101 ..... 0000011 @i
69 sb ....... ..... ..... 000 ..... 0100011 @s
70 sh ....... ..... ..... 001 ..... 0100011 @s
71 sw ....... ..... ..... 010 ..... 0100011 @s
72 addi ............ ..... 000 ..... 0010011 @i
73 slti ............ ..... 010 ..... 0010011 @i
74 sltiu ............ ..... 011 ..... 0010011 @i
75 xori ............ ..... 100 ..... 0010011 @i
76 ori ............ ..... 110 ..... 0010011 @i
77 andi ............ ..... 111 ..... 0010011 @i
78 slli 00.... ...... ..... 001 ..... 0010011 @sh
79 srli 00.... ...... ..... 101 ..... 0010011 @sh
80 srai 01.... ...... ..... 101 ..... 0010011 @sh
81 add 0000000 ..... ..... 000 ..... 0110011 @r
82 sub 0100000 ..... ..... 000 ..... 0110011 @r
83 sll 0000000 ..... ..... 001 ..... 0110011 @r
84 slt 0000000 ..... ..... 010 ..... 0110011 @r
85 sltu 0000000 ..... ..... 011 ..... 0110011 @r
86 xor 0000000 ..... ..... 100 ..... 0110011 @r
87 srl 0000000 ..... ..... 101 ..... 0110011 @r
88 sra 0100000 ..... ..... 101 ..... 0110011 @r
89 or 0000000 ..... ..... 110 ..... 0110011 @r
90 and 0000000 ..... ..... 111 ..... 0110011 @r
91 fence ---- pred:4 succ:4 ----- 000 ----- 0001111
92 fence_i ---- ---- ---- ----- 001 ----- 0001111
93 csrrw ............ ..... 001 ..... 1110011 @csr
94 csrrs ............ ..... 010 ..... 1110011 @csr
95 csrrc ............ ..... 011 ..... 1110011 @csr
96 csrrwi ............ ..... 101 ..... 1110011 @csr
97 csrrsi ............ ..... 110 ..... 1110011 @csr
98 csrrci ............ ..... 111 ..... 1110011 @csr
100 # *** RV32M Standard Extension ***
101 mul 0000001 ..... ..... 000 ..... 0110011 @r
102 mulh 0000001 ..... ..... 001 ..... 0110011 @r
103 mulhsu 0000001 ..... ..... 010 ..... 0110011 @r
104 mulhu 0000001 ..... ..... 011 ..... 0110011 @r
105 div 0000001 ..... ..... 100 ..... 0110011 @r
106 divu 0000001 ..... ..... 101 ..... 0110011 @r
107 rem 0000001 ..... ..... 110 ..... 0110011 @r
108 remu 0000001 ..... ..... 111 ..... 0110011 @r
110 # *** RV32A Standard Extension ***
111 lr_w 00010 . . 00000 ..... 010 ..... 0101111 @atom_ld
112 sc_w 00011 . . ..... ..... 010 ..... 0101111 @atom_st
113 amoswap_w 00001 . . ..... ..... 010 ..... 0101111 @atom_st
114 amoadd_w 00000 . . ..... ..... 010 ..... 0101111 @atom_st
115 amoxor_w 00100 . . ..... ..... 010 ..... 0101111 @atom_st
116 amoand_w 01100 . . ..... ..... 010 ..... 0101111 @atom_st
117 amoor_w 01000 . . ..... ..... 010 ..... 0101111 @atom_st
118 amomin_w 10000 . . ..... ..... 010 ..... 0101111 @atom_st
119 amomax_w 10100 . . ..... ..... 010 ..... 0101111 @atom_st
120 amominu_w 11000 . . ..... ..... 010 ..... 0101111 @atom_st
121 amomaxu_w 11100 . . ..... ..... 010 ..... 0101111 @atom_st