xref: /openbmc/qemu/target/microblaze/insns.decode (revision f523531471c9342020cda0ef5a2eccb7d77e7e34)
1#
2# MicroBlaze instruction decode definitions.
3#
4# Copyright (c) 2020 Richard Henderson <rth@twiddle.net>
5#
6# This library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Lesser General Public
8# License as published by the Free Software Foundation; either
9# version 2.1 of the License, or (at your option) any later version.
10#
11# This library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14# Lesser General Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with this library; if not, see <http://www.gnu.org/licenses/>.
18#
19
20&typea0         rd ra
21&typea          rd ra rb
22&typea_br       rd rb
23&typeb          rd ra imm
24&typeb_br       rd imm
25
26# Include any IMM prefix in the value reported.
27%extimm         0:s16 !function=typeb_imm
28
29@typea          ...... rd:5 ra:5 rb:5 ... .... ....     &typea
30@typeb          ...... rd:5 ra:5 ................       &typeb imm=%extimm
31
32# Officially typea, but with rb==0, which is not used.
33@typea0         ...... rd:5 ra:5 ................       &typea0
34
35# Officially typea, but with ra as opcode.
36@typea_br       ...... rd:5 ..... rb:5 ...........      &typea_br
37
38# Officially typeb, but any immediate extension is unused.
39@typeb_bs       ...... rd:5 ra:5 ..... ...... imm:5     &typeb
40
41# Officially typeb, but with ra as opcode.
42@typeb_br       ...... rd:5 ..... ................      &typeb_br imm=%extimm
43
44# For convenience, extract the two imm_w/imm_s fields, then pack
45# them back together as "imm".  Doing this makes it easiest to
46# match the required zero at bit 5.
47%ieimm          6:5 0:5
48@typeb_ie       ...... rd:5 ra:5 ..... ..... . .....    &typeb imm=%ieimm
49
50###
51
52{
53  zero          000000 00000 00000 00000 000 0000 0000
54  add           000000 ..... ..... ..... 000 0000 0000  @typea
55}
56addc            000010 ..... ..... ..... 000 0000 0000  @typea
57addk            000100 ..... ..... ..... 000 0000 0000  @typea
58addkc           000110 ..... ..... ..... 000 0000 0000  @typea
59
60addi            001000 ..... ..... ................     @typeb
61addic           001010 ..... ..... ................     @typeb
62addik           001100 ..... ..... ................     @typeb
63addikc          001110 ..... ..... ................     @typeb
64
65and             100001 ..... ..... ..... 000 0000 0000  @typea
66andi            101001 ..... ..... ................     @typeb
67
68andn            100011 ..... ..... ..... 000 0000 0000  @typea
69andni           101011 ..... ..... ................     @typeb
70
71brk             100110 ..... 01100 ..... 000 0000 0000  @typea_br
72brki            101110 ..... 01100 ................     @typeb_br
73
74bsrl            010001 ..... ..... ..... 000 0000 0000  @typea
75bsra            010001 ..... ..... ..... 010 0000 0000  @typea
76bsll            010001 ..... ..... ..... 100 0000 0000  @typea
77
78bsrli           011001 ..... ..... 00000 000000 .....   @typeb_bs
79bsrai           011001 ..... ..... 00000 010000 .....   @typeb_bs
80bslli           011001 ..... ..... 00000 100000 .....   @typeb_bs
81
82bsefi           011001 ..... ..... 01000 .....0 .....   @typeb_ie
83bsifi           011001 ..... ..... 10000 .....0 .....   @typeb_ie
84
85clz             100100 ..... ..... 00000 000 1110 0000  @typea0
86
87cmp             000101 ..... ..... ..... 000 0000 0001  @typea
88cmpu            000101 ..... ..... ..... 000 0000 0011  @typea
89
90fadd            010110 ..... ..... ..... 0000 000 0000  @typea
91frsub           010110 ..... ..... ..... 0001 000 0000  @typea
92fmul            010110 ..... ..... ..... 0010 000 0000  @typea
93fdiv            010110 ..... ..... ..... 0011 000 0000  @typea
94fcmp_un         010110 ..... ..... ..... 0100 000 0000  @typea
95fcmp_lt         010110 ..... ..... ..... 0100 001 0000  @typea
96fcmp_eq         010110 ..... ..... ..... 0100 010 0000  @typea
97fcmp_le         010110 ..... ..... ..... 0100 011 0000  @typea
98fcmp_gt         010110 ..... ..... ..... 0100 100 0000  @typea
99fcmp_ne         010110 ..... ..... ..... 0100 101 0000  @typea
100fcmp_ge         010110 ..... ..... ..... 0100 110 0000  @typea
101
102# Note that flt and fint, unlike fsqrt, are documented as having the RB
103# operand which is unused.  So allow the field to be non-zero but discard
104# the value and treat as 2-operand insns.
105flt             010110 ..... ..... ----- 0101 000 0000  @typea0
106fint            010110 ..... ..... ----- 0110 000 0000  @typea0
107fsqrt           010110 ..... ..... 00000 0111 000 0000  @typea0
108
109idiv            010010 ..... ..... ..... 000 0000 0000  @typea
110idivu           010010 ..... ..... ..... 000 0000 0010  @typea
111
112imm             101100 00000 00000 imm:16
113
114lbu             110000 ..... ..... ..... 0000 000 0000  @typea
115lbur            110000 ..... ..... ..... 0100 000 0000  @typea
116lbuea           110000 ..... ..... ..... 0001 000 0000  @typea
117lbui            111000 ..... ..... ................     @typeb
118
119lhu             110001 ..... ..... ..... 0000 000 0000  @typea
120lhur            110001 ..... ..... ..... 0100 000 0000  @typea
121lhuea           110001 ..... ..... ..... 0001 000 0000  @typea
122lhui            111001 ..... ..... ................     @typeb
123
124lw              110010 ..... ..... ..... 0000 000 0000  @typea
125lwr             110010 ..... ..... ..... 0100 000 0000  @typea
126lwea            110010 ..... ..... ..... 0001 000 0000  @typea
127lwx             110010 ..... ..... ..... 1000 000 0000  @typea
128lwi             111010 ..... ..... ................     @typeb
129
130mul             010000 ..... ..... ..... 000 0000 0000  @typea
131mulh            010000 ..... ..... ..... 000 0000 0001  @typea
132mulhu           010000 ..... ..... ..... 000 0000 0011  @typea
133mulhsu          010000 ..... ..... ..... 000 0000 0010  @typea
134muli            011000 ..... ..... ................     @typeb
135
136or              100000 ..... ..... ..... 000 0000 0000  @typea
137ori             101000 ..... ..... ................     @typeb
138
139pcmpbf          100000 ..... ..... ..... 100 0000 0000  @typea
140pcmpeq          100010 ..... ..... ..... 100 0000 0000  @typea
141pcmpne          100011 ..... ..... ..... 100 0000 0000  @typea
142
143rsub            000001 ..... ..... ..... 000 0000 0000  @typea
144rsubc           000011 ..... ..... ..... 000 0000 0000  @typea
145rsubk           000101 ..... ..... ..... 000 0000 0000  @typea
146rsubkc          000111 ..... ..... ..... 000 0000 0000  @typea
147
148rsubi           001001 ..... ..... ................     @typeb
149rsubic          001011 ..... ..... ................     @typeb
150rsubik          001101 ..... ..... ................     @typeb
151rsubikc         001111 ..... ..... ................     @typeb
152
153sb              110100 ..... ..... ..... 0000 000 0000  @typea
154sbr             110100 ..... ..... ..... 0100 000 0000  @typea
155sbea            110100 ..... ..... ..... 0001 000 0000  @typea
156sbi             111100 ..... ..... ................     @typeb
157
158sh              110101 ..... ..... ..... 0000 000 0000  @typea
159shr             110101 ..... ..... ..... 0100 000 0000  @typea
160shea            110101 ..... ..... ..... 0001 000 0000  @typea
161shi             111101 ..... ..... ................     @typeb
162
163sw              110110 ..... ..... ..... 0000 000 0000  @typea
164swr             110110 ..... ..... ..... 0100 000 0000  @typea
165swea            110110 ..... ..... ..... 0001 000 0000  @typea
166swx             110110 ..... ..... ..... 1000 000 0000  @typea
167swi             111110 ..... ..... ................     @typeb
168
169sext8           100100 ..... ..... 00000 000 0110 0000  @typea0
170sext16          100100 ..... ..... 00000 000 0110 0001  @typea0
171
172sra             100100 ..... ..... 00000 000 0000 0001  @typea0
173src             100100 ..... ..... 00000 000 0010 0001  @typea0
174srl             100100 ..... ..... 00000 000 0100 0001  @typea0
175
176swapb           100100 ..... ..... 00000 001 1110 0000  @typea0
177swaph           100100 ..... ..... 00000 001 1110 0010  @typea0
178
179# Cache operations have no effect in qemu: discard the arguments.
180wdic            100100 00000 ----- ----- -00 -11- 01-0  # wdc
181wdic            100100 00000 ----- ----- 000 0110 1000  # wic
182
183xor             100010 ..... ..... ..... 000 0000 0000  @typea
184xori            101010 ..... ..... ................     @typeb
185