xref: /openbmc/qemu/target/riscv/insn32.decode (revision c1000d4e)
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:
20%rs2       20:5
21%rs1       15:5
22%rd        7:5
23
24# immediates:
25%imm_i    20:s12
26%imm_s    25:s7 7:5
27%imm_b    31:s1 7:1 25:6 8:4     !function=ex_shift_1
28%imm_j    31:s1 12:8 20:1 21:10  !function=ex_shift_1
29%imm_u    12:s20                 !function=ex_shift_12
30
31# Argument sets:
32&b    imm rs2 rs1
33
34# Formats 32:
35@i       ............    ..... ... ..... .......         imm=%imm_i     %rs1 %rd
36@b       .......   ..... ..... ... ..... ....... &b      imm=%imm_b %rs2 %rs1
37@s       .......   ..... ..... ... ..... .......         imm=%imm_s %rs2 %rs1
38@u       ....................      ..... .......         imm=%imm_u          %rd
39@j       ....................      ..... .......         imm=%imm_j          %rd
40
41# *** RV32I Base Instruction Set ***
42lui      ....................       ..... 0110111 @u
43auipc    ....................       ..... 0010111 @u
44jal      ....................       ..... 1101111 @j
45jalr     ............     ..... 000 ..... 1100111 @i
46beq      ....... .....    ..... 000 ..... 1100011 @b
47bne      ....... .....    ..... 001 ..... 1100011 @b
48blt      ....... .....    ..... 100 ..... 1100011 @b
49bge      ....... .....    ..... 101 ..... 1100011 @b
50bltu     ....... .....    ..... 110 ..... 1100011 @b
51bgeu     ....... .....    ..... 111 ..... 1100011 @b
52lb       ............     ..... 000 ..... 0000011 @i
53lh       ............     ..... 001 ..... 0000011 @i
54lw       ............     ..... 010 ..... 0000011 @i
55lbu      ............     ..... 100 ..... 0000011 @i
56lhu      ............     ..... 101 ..... 0000011 @i
57sb       .......  .....   ..... 000 ..... 0100011 @s
58sh       .......  .....   ..... 001 ..... 0100011 @s
59sw       .......  .....   ..... 010 ..... 0100011 @s
60