]>
Commit | Line | Data |
---|---|---|
2a53cff4 BK |
1 | # |
2 | # RISC-V translation routines for the RVXI Base Integer Instruction Set. | |
3 | # | |
4 | # Copyright (c) 2018 Peer Adelt, peer.adelt@hni.uni-paderborn.de | |
5 | # Bastian Koppelmann, kbastian@mail.uni-paderborn.de | |
6 | # | |
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. | |
10 | # | |
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 | |
14 | # more details. | |
15 | # | |
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/>. | |
18 | ||
19 | # Fields: | |
6f0e74ff | 20 | %rs3 27:5 |
3cca75a6 BK |
21 | %rs2 20:5 |
22 | %rs1 15:5 | |
2a53cff4 BK |
23 | %rd 7:5 |
24 | ||
b73a987b | 25 | %sh10 20:10 |
771fbe15 | 26 | %csr 20:12 |
6f0e74ff | 27 | %rm 12:3 |
b73a987b | 28 | |
2a53cff4 | 29 | # immediates: |
3cca75a6 | 30 | %imm_i 20:s12 |
c1000d4e | 31 | %imm_s 25:s7 7:5 |
3cca75a6 BK |
32 | %imm_b 31:s1 7:1 25:6 8:4 !function=ex_shift_1 |
33 | %imm_j 31:s1 12:8 20:1 21:10 !function=ex_shift_1 | |
2a53cff4 BK |
34 | %imm_u 12:s20 !function=ex_shift_12 |
35 | ||
3cca75a6 BK |
36 | # Argument sets: |
37 | &b imm rs2 rs1 | |
b73a987b | 38 | &shift shamt rs1 rd |
3b77c289 | 39 | &atomic aq rl rs2 rs1 rd |
3cca75a6 | 40 | |
2a53cff4 | 41 | # Formats 32: |
b73a987b | 42 | @r ....... ..... ..... ... ..... ....... %rs2 %rs1 %rd |
3cca75a6 BK |
43 | @i ............ ..... ... ..... ....... imm=%imm_i %rs1 %rd |
44 | @b ....... ..... ..... ... ..... ....... &b imm=%imm_b %rs2 %rs1 | |
c1000d4e | 45 | @s ....... ..... ..... ... ..... ....... imm=%imm_s %rs2 %rs1 |
2a53cff4 | 46 | @u .................... ..... ....... imm=%imm_u %rd |
3cca75a6 | 47 | @j .................... ..... ....... imm=%imm_j %rd |
2a53cff4 | 48 | |
b73a987b | 49 | @sh ...... ...... ..... ... ..... ....... &shift shamt=%sh10 %rs1 %rd |
771fbe15 | 50 | @csr ............ ..... ... ..... ....... %csr %rs1 %rd |
b73a987b | 51 | |
3b77c289 BK |
52 | @atom_ld ..... aq:1 rl:1 ..... ........ ..... ....... &atomic rs2=0 %rs1 %rd |
53 | @atom_st ..... aq:1 rl:1 ..... ........ ..... ....... &atomic %rs2 %rs1 %rd | |
54 | ||
6f0e74ff BK |
55 | @r4_rm ..... .. ..... ..... ... ..... ....... %rs3 %rs2 %rs1 %rm %rd |
56 | @r_rm ....... ..... ..... ... ..... ....... %rs2 %rs1 %rm %rd | |
57 | @r2_rm ....... ..... ..... ... ..... ....... %rs1 %rm %rd | |
58 | @r2 ....... ..... ..... ... ..... ....... %rs1 %rd | |
59 | ||
2a53cff4 BK |
60 | # *** RV32I Base Instruction Set *** |
61 | lui .................... ..... 0110111 @u | |
62 | auipc .................... ..... 0010111 @u | |
3cca75a6 BK |
63 | jal .................... ..... 1101111 @j |
64 | jalr ............ ..... 000 ..... 1100111 @i | |
65 | beq ....... ..... ..... 000 ..... 1100011 @b | |
66 | bne ....... ..... ..... 001 ..... 1100011 @b | |
67 | blt ....... ..... ..... 100 ..... 1100011 @b | |
68 | bge ....... ..... ..... 101 ..... 1100011 @b | |
69 | bltu ....... ..... ..... 110 ..... 1100011 @b | |
70 | bgeu ....... ..... ..... 111 ..... 1100011 @b | |
c1000d4e BK |
71 | lb ............ ..... 000 ..... 0000011 @i |
72 | lh ............ ..... 001 ..... 0000011 @i | |
73 | lw ............ ..... 010 ..... 0000011 @i | |
74 | lbu ............ ..... 100 ..... 0000011 @i | |
75 | lhu ............ ..... 101 ..... 0000011 @i | |
76 | sb ....... ..... ..... 000 ..... 0100011 @s | |
77 | sh ....... ..... ..... 001 ..... 0100011 @s | |
78 | sw ....... ..... ..... 010 ..... 0100011 @s | |
b73a987b BK |
79 | addi ............ ..... 000 ..... 0010011 @i |
80 | slti ............ ..... 010 ..... 0010011 @i | |
81 | sltiu ............ ..... 011 ..... 0010011 @i | |
82 | xori ............ ..... 100 ..... 0010011 @i | |
83 | ori ............ ..... 110 ..... 0010011 @i | |
84 | andi ............ ..... 111 ..... 0010011 @i | |
85 | slli 00.... ...... ..... 001 ..... 0010011 @sh | |
86 | srli 00.... ...... ..... 101 ..... 0010011 @sh | |
87 | srai 01.... ...... ..... 101 ..... 0010011 @sh | |
88 | add 0000000 ..... ..... 000 ..... 0110011 @r | |
89 | sub 0100000 ..... ..... 000 ..... 0110011 @r | |
90 | sll 0000000 ..... ..... 001 ..... 0110011 @r | |
91 | slt 0000000 ..... ..... 010 ..... 0110011 @r | |
92 | sltu 0000000 ..... ..... 011 ..... 0110011 @r | |
93 | xor 0000000 ..... ..... 100 ..... 0110011 @r | |
94 | srl 0000000 ..... ..... 101 ..... 0110011 @r | |
95 | sra 0100000 ..... ..... 101 ..... 0110011 @r | |
96 | or 0000000 ..... ..... 110 ..... 0110011 @r | |
97 | and 0000000 ..... ..... 111 ..... 0110011 @r | |
0c865e85 BK |
98 | fence ---- pred:4 succ:4 ----- 000 ----- 0001111 |
99 | fence_i ---- ---- ---- ----- 001 ----- 0001111 | |
771fbe15 BK |
100 | csrrw ............ ..... 001 ..... 1110011 @csr |
101 | csrrs ............ ..... 010 ..... 1110011 @csr | |
102 | csrrc ............ ..... 011 ..... 1110011 @csr | |
103 | csrrwi ............ ..... 101 ..... 1110011 @csr | |
104 | csrrsi ............ ..... 110 ..... 1110011 @csr | |
105 | csrrci ............ ..... 111 ..... 1110011 @csr | |
d2e2c1e4 BK |
106 | |
107 | # *** RV32M Standard Extension *** | |
108 | mul 0000001 ..... ..... 000 ..... 0110011 @r | |
109 | mulh 0000001 ..... ..... 001 ..... 0110011 @r | |
110 | mulhsu 0000001 ..... ..... 010 ..... 0110011 @r | |
111 | mulhu 0000001 ..... ..... 011 ..... 0110011 @r | |
112 | div 0000001 ..... ..... 100 ..... 0110011 @r | |
113 | divu 0000001 ..... ..... 101 ..... 0110011 @r | |
114 | rem 0000001 ..... ..... 110 ..... 0110011 @r | |
115 | remu 0000001 ..... ..... 111 ..... 0110011 @r | |
3b77c289 BK |
116 | |
117 | # *** RV32A Standard Extension *** | |
118 | lr_w 00010 . . 00000 ..... 010 ..... 0101111 @atom_ld | |
119 | sc_w 00011 . . ..... ..... 010 ..... 0101111 @atom_st | |
120 | amoswap_w 00001 . . ..... ..... 010 ..... 0101111 @atom_st | |
121 | amoadd_w 00000 . . ..... ..... 010 ..... 0101111 @atom_st | |
122 | amoxor_w 00100 . . ..... ..... 010 ..... 0101111 @atom_st | |
123 | amoand_w 01100 . . ..... ..... 010 ..... 0101111 @atom_st | |
124 | amoor_w 01000 . . ..... ..... 010 ..... 0101111 @atom_st | |
125 | amomin_w 10000 . . ..... ..... 010 ..... 0101111 @atom_st | |
126 | amomax_w 10100 . . ..... ..... 010 ..... 0101111 @atom_st | |
127 | amominu_w 11000 . . ..... ..... 010 ..... 0101111 @atom_st | |
128 | amomaxu_w 11100 . . ..... ..... 010 ..... 0101111 @atom_st | |
6f0e74ff BK |
129 | |
130 | # *** RV32F Standard Extension *** | |
131 | flw ............ ..... 010 ..... 0000111 @i | |
132 | fsw ....... ..... ..... 010 ..... 0100111 @s | |
133 | fmadd_s ..... 00 ..... ..... ... ..... 1000011 @r4_rm | |
134 | fmsub_s ..... 00 ..... ..... ... ..... 1000111 @r4_rm | |
135 | fnmsub_s ..... 00 ..... ..... ... ..... 1001011 @r4_rm | |
136 | fnmadd_s ..... 00 ..... ..... ... ..... 1001111 @r4_rm | |
137 | fadd_s 0000000 ..... ..... ... ..... 1010011 @r_rm | |
138 | fsub_s 0000100 ..... ..... ... ..... 1010011 @r_rm | |
139 | fmul_s 0001000 ..... ..... ... ..... 1010011 @r_rm | |
140 | fdiv_s 0001100 ..... ..... ... ..... 1010011 @r_rm | |
141 | fsqrt_s 0101100 00000 ..... ... ..... 1010011 @r2_rm | |
142 | fsgnj_s 0010000 ..... ..... 000 ..... 1010011 @r | |
143 | fsgnjn_s 0010000 ..... ..... 001 ..... 1010011 @r | |
144 | fsgnjx_s 0010000 ..... ..... 010 ..... 1010011 @r | |
145 | fmin_s 0010100 ..... ..... 000 ..... 1010011 @r | |
146 | fmax_s 0010100 ..... ..... 001 ..... 1010011 @r | |
147 | fcvt_w_s 1100000 00000 ..... ... ..... 1010011 @r2_rm | |
148 | fcvt_wu_s 1100000 00001 ..... ... ..... 1010011 @r2_rm | |
149 | fmv_x_w 1110000 00000 ..... 000 ..... 1010011 @r2 | |
150 | feq_s 1010000 ..... ..... 010 ..... 1010011 @r | |
151 | flt_s 1010000 ..... ..... 001 ..... 1010011 @r | |
152 | fle_s 1010000 ..... ..... 000 ..... 1010011 @r | |
153 | fclass_s 1110000 00000 ..... 001 ..... 1010011 @r2 | |
154 | fcvt_s_w 1101000 00000 ..... ... ..... 1010011 @r2_rm | |
155 | fcvt_s_wu 1101000 00001 ..... ... ..... 1010011 @r2_rm | |
156 | fmv_w_x 1111000 00000 ..... 000 ..... 1010011 @r2 |