2019-03-18 19:41:19 +00:00
|
|
|
#
|
|
|
|
# RISC-V translation routines for the RVXI Base Integer Instruction Set.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2018 Peer Adelt, peer.adelt@hni.uni-paderborn.de
|
|
|
|
# Bastian Koppelmann, kbastian@mail.uni-paderborn.de
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms and conditions of the GNU General Public License,
|
|
|
|
# version 2 or later, as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
# more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along with
|
|
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# Fields:
|
2019-03-18 19:56:49 +00:00
|
|
|
%rs2 20:5
|
|
|
|
%rs1 15:5
|
2019-03-18 19:41:19 +00:00
|
|
|
%rd 7:5
|
|
|
|
|
|
|
|
# immediates:
|
2019-03-18 19:56:49 +00:00
|
|
|
%imm_i 20:s12
|
2019-03-18 19:59:40 +00:00
|
|
|
%imm_s 25:s7 7:5
|
2019-03-18 19:56:49 +00:00
|
|
|
%imm_b 31:s1 7:1 25:6 8:4 !function=ex_shift_1
|
|
|
|
%imm_j 31:s1 12:8 20:1 21:10 !function=ex_shift_1
|
2019-03-18 19:41:19 +00:00
|
|
|
%imm_u 12:s20 !function=ex_shift_12
|
|
|
|
|
2019-03-18 19:56:49 +00:00
|
|
|
# Argument sets:
|
|
|
|
&b imm rs2 rs1
|
|
|
|
|
2019-03-18 19:41:19 +00:00
|
|
|
# Formats 32:
|
2019-03-18 19:56:49 +00:00
|
|
|
@i ............ ..... ... ..... ....... imm=%imm_i %rs1 %rd
|
|
|
|
@b ....... ..... ..... ... ..... ....... &b imm=%imm_b %rs2 %rs1
|
2019-03-18 19:59:40 +00:00
|
|
|
@s ....... ..... ..... ... ..... ....... imm=%imm_s %rs2 %rs1
|
2019-03-18 19:41:19 +00:00
|
|
|
@u .................... ..... ....... imm=%imm_u %rd
|
2019-03-18 19:56:49 +00:00
|
|
|
@j .................... ..... ....... imm=%imm_j %rd
|
2019-03-18 19:41:19 +00:00
|
|
|
|
|
|
|
# *** RV32I Base Instruction Set ***
|
|
|
|
lui .................... ..... 0110111 @u
|
2019-03-18 19:56:49 +00:00
|
|
|
auipc .................... ..... 0010111 @u
|
|
|
|
jal .................... ..... 1101111 @j
|
|
|
|
jalr ............ ..... 000 ..... 1100111 @i
|
|
|
|
beq ....... ..... ..... 000 ..... 1100011 @b
|
|
|
|
bne ....... ..... ..... 001 ..... 1100011 @b
|
|
|
|
blt ....... ..... ..... 100 ..... 1100011 @b
|
|
|
|
bge ....... ..... ..... 101 ..... 1100011 @b
|
|
|
|
bltu ....... ..... ..... 110 ..... 1100011 @b
|
|
|
|
bgeu ....... ..... ..... 111 ..... 1100011 @b
|
2019-03-18 19:59:40 +00:00
|
|
|
lb ............ ..... 000 ..... 0000011 @i
|
|
|
|
lh ............ ..... 001 ..... 0000011 @i
|
|
|
|
lw ............ ..... 010 ..... 0000011 @i
|
|
|
|
lbu ............ ..... 100 ..... 0000011 @i
|
|
|
|
lhu ............ ..... 101 ..... 0000011 @i
|
|
|
|
sb ....... ..... ..... 000 ..... 0100011 @s
|
|
|
|
sh ....... ..... ..... 001 ..... 0100011 @s
|
|
|
|
sw ....... ..... ..... 010 ..... 0100011 @s
|