xref: /openbmc/qemu/target/riscv/insn32.decode (revision 3cca75a6)
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_b    31:s1 7:1 25:6 8:4     !function=ex_shift_1
27%imm_j    31:s1 12:8 20:1 21:10  !function=ex_shift_1
28%imm_u    12:s20                 !function=ex_shift_12
29
30# Argument sets:
31&b    imm rs2 rs1
32
33# Formats 32:
34@i       ............    ..... ... ..... .......         imm=%imm_i     %rs1 %rd
35@b       .......   ..... ..... ... ..... ....... &b      imm=%imm_b %rs2 %rs1
36@u       ....................      ..... .......         imm=%imm_u          %rd
37@j       ....................      ..... .......         imm=%imm_j          %rd
38
39# *** RV32I Base Instruction Set ***
40lui      ....................       ..... 0110111 @u
41auipc    ....................       ..... 0010111 @u
42jal      ....................       ..... 1101111 @j
43jalr     ............     ..... 000 ..... 1100111 @i
44beq      ....... .....    ..... 000 ..... 1100011 @b
45bne      ....... .....    ..... 001 ..... 1100011 @b
46blt      ....... .....    ..... 100 ..... 1100011 @b
47bge      ....... .....    ..... 101 ..... 1100011 @b
48bltu     ....... .....    ..... 110 ..... 1100011 @b
49bgeu     ....... .....    ..... 111 ..... 1100011 @b
50