aboutsummaryrefslogtreecommitdiff
path: root/target/avr/insn.decode
blob: 94351ca7879019ebaa8fd8afab903b31de796c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# AVR instruction decode definitions.
#
# Copyright (c) 2019-2020 Michael Rolnik <mrolnik@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
#

#
#   regs_16_31_by_one = [16 .. 31]
#   regs_16_23_by_one = [16 .. 23]
#   regs_24_30_by_two = [24, 26, 28, 30]
#   regs_00_30_by_two = [0, 2, 4, 6, 8, .. 30]

%rd             4:5
%rr             9:1 0:4

%rd_a           4:4                         !function=to_regs_16_31_by_one
%rd_b           4:3                         !function=to_regs_16_23_by_one
%rd_c           4:2                         !function=to_regs_24_30_by_two
%rr_a           0:4                         !function=to_regs_16_31_by_one
%rr_b           0:3                         !function=to_regs_16_23_by_one

%imm6           6:2 0:4
%imm8           8:4 0:4

%io_imm         9:2 0:4
%ldst_d_imm     13:1 10:2 0:3


&rd_rr          rd rr
&rd_imm         rd imm

@op_rd_rr       .... .. . ..... ....        &rd_rr      rd=%rd rr=%rr
@op_rd_imm6     .... .... .. .. ....        &rd_imm     rd=%rd_c imm=%imm6
@op_rd_imm8     .... .... .... ....         &rd_imm     rd=%rd_a imm=%imm8
@fmul           .... .... . ... . ...       &rd_rr      rd=%rd_b rr=%rr_b

#
# Arithmetic Instructions
#
ADD             0000 11 . ..... ....        @op_rd_rr
ADC             0001 11 . ..... ....        @op_rd_rr
ADIW            1001 0110 .. .. ....        @op_rd_imm6
SUB             0001 10 . ..... ....        @op_rd_rr
SUBI            0101 .... .... ....         @op_rd_imm8
SBC             0000 10 . ..... ....        @op_rd_rr
SBCI            0100 .... .... ....         @op_rd_imm8
SBIW            1001 0111 .. .. ....        @op_rd_imm6
AND             0010 00 . ..... ....        @op_rd_rr
ANDI            0111 .... .... ....         @op_rd_imm8
OR              0010 10 . ..... ....        @op_rd_rr
ORI             0110 .... .... ....         @op_rd_imm8
EOR             0010 01 . ..... ....        @op_rd_rr
COM             1001 010 rd:5 0000
NEG             1001 010 rd:5 0001
INC             1001 010 rd:5 0011
DEC             1001 010 rd:5 1010
MUL             1001 11 . ..... ....        @op_rd_rr
MULS            0000 0010 .... ....         &rd_rr      rd=%rd_a rr=%rr_a
MULSU           0000 0011 0 ... 0 ...       @fmul
FMUL            0000 0011 0 ... 1 ...       @fmul
FMULS           0000 0011 1 ... 0 ...       @fmul
FMULSU          0000 0011 1 ... 1 ...       @fmul
DES             1001 0100 imm:4 1011