xref: /openbmc/qemu/target/microblaze/insns.decode (revision 16bbbbc91ad0c2c8cfdc0e17a0cb7f60b690b534)
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
71br              100110 ..... 00000 ..... 000 0000 0000  @typea_br
72bra             100110 ..... 01000 ..... 000 0000 0000  @typea_br
73brd             100110 ..... 10000 ..... 000 0000 0000  @typea_br
74brad            100110 ..... 11000 ..... 000 0000 0000  @typea_br
75brld            100110 ..... 10100 ..... 000 0000 0000  @typea_br
76brald           100110 ..... 11100 ..... 000 0000 0000  @typea_br
77
78bri             101110 ..... 00000 ................     @typeb_br
79brai            101110 ..... 01000 ................     @typeb_br
80brid            101110 ..... 10000 ................     @typeb_br
81braid           101110 ..... 11000 ................     @typeb_br
82brlid           101110 ..... 10100 ................     @typeb_br
83bralid          101110 ..... 11100 ................     @typeb_br
84
85brk             100110 ..... 01100 ..... 000 0000 0000  @typea_br
86brki            101110 ..... 01100 ................     @typeb_br
87
88bsrl            010001 ..... ..... ..... 000 0000 0000  @typea
89bsra            010001 ..... ..... ..... 010 0000 0000  @typea
90bsll            010001 ..... ..... ..... 100 0000 0000  @typea
91
92bsrli           011001 ..... ..... 00000 000000 .....   @typeb_bs
93bsrai           011001 ..... ..... 00000 010000 .....   @typeb_bs
94bslli           011001 ..... ..... 00000 100000 .....   @typeb_bs
95
96bsefi           011001 ..... ..... 01000 .....0 .....   @typeb_ie
97bsifi           011001 ..... ..... 10000 .....0 .....   @typeb_ie
98
99clz             100100 ..... ..... 00000 000 1110 0000  @typea0
100
101cmp             000101 ..... ..... ..... 000 0000 0001  @typea
102cmpu            000101 ..... ..... ..... 000 0000 0011  @typea
103
104fadd            010110 ..... ..... ..... 0000 000 0000  @typea
105frsub           010110 ..... ..... ..... 0001 000 0000  @typea
106fmul            010110 ..... ..... ..... 0010 000 0000  @typea
107fdiv            010110 ..... ..... ..... 0011 000 0000  @typea
108fcmp_un         010110 ..... ..... ..... 0100 000 0000  @typea
109fcmp_lt         010110 ..... ..... ..... 0100 001 0000  @typea
110fcmp_eq         010110 ..... ..... ..... 0100 010 0000  @typea
111fcmp_le         010110 ..... ..... ..... 0100 011 0000  @typea
112fcmp_gt         010110 ..... ..... ..... 0100 100 0000  @typea
113fcmp_ne         010110 ..... ..... ..... 0100 101 0000  @typea
114fcmp_ge         010110 ..... ..... ..... 0100 110 0000  @typea
115
116# Note that flt and fint, unlike fsqrt, are documented as having the RB
117# operand which is unused.  So allow the field to be non-zero but discard
118# the value and treat as 2-operand insns.
119flt             010110 ..... ..... ----- 0101 000 0000  @typea0
120fint            010110 ..... ..... ----- 0110 000 0000  @typea0
121fsqrt           010110 ..... ..... 00000 0111 000 0000  @typea0
122
123idiv            010010 ..... ..... ..... 000 0000 0000  @typea
124idivu           010010 ..... ..... ..... 000 0000 0010  @typea
125
126imm             101100 00000 00000 imm:16
127
128lbu             110000 ..... ..... ..... 0000 000 0000  @typea
129lbur            110000 ..... ..... ..... 0100 000 0000  @typea
130lbuea           110000 ..... ..... ..... 0001 000 0000  @typea
131lbui            111000 ..... ..... ................     @typeb
132
133lhu             110001 ..... ..... ..... 0000 000 0000  @typea
134lhur            110001 ..... ..... ..... 0100 000 0000  @typea
135lhuea           110001 ..... ..... ..... 0001 000 0000  @typea
136lhui            111001 ..... ..... ................     @typeb
137
138lw              110010 ..... ..... ..... 0000 000 0000  @typea
139lwr             110010 ..... ..... ..... 0100 000 0000  @typea
140lwea            110010 ..... ..... ..... 0001 000 0000  @typea
141lwx             110010 ..... ..... ..... 1000 000 0000  @typea
142lwi             111010 ..... ..... ................     @typeb
143
144mbar            101110 imm:5 00010 0000 0000 0000 0100
145
146mul             010000 ..... ..... ..... 000 0000 0000  @typea
147mulh            010000 ..... ..... ..... 000 0000 0001  @typea
148mulhu           010000 ..... ..... ..... 000 0000 0011  @typea
149mulhsu          010000 ..... ..... ..... 000 0000 0010  @typea
150muli            011000 ..... ..... ................     @typeb
151
152or              100000 ..... ..... ..... 000 0000 0000  @typea
153ori             101000 ..... ..... ................     @typeb
154
155pcmpbf          100000 ..... ..... ..... 100 0000 0000  @typea
156pcmpeq          100010 ..... ..... ..... 100 0000 0000  @typea
157pcmpne          100011 ..... ..... ..... 100 0000 0000  @typea
158
159rsub            000001 ..... ..... ..... 000 0000 0000  @typea
160rsubc           000011 ..... ..... ..... 000 0000 0000  @typea
161rsubk           000101 ..... ..... ..... 000 0000 0000  @typea
162rsubkc          000111 ..... ..... ..... 000 0000 0000  @typea
163
164rsubi           001001 ..... ..... ................     @typeb
165rsubic          001011 ..... ..... ................     @typeb
166rsubik          001101 ..... ..... ................     @typeb
167rsubikc         001111 ..... ..... ................     @typeb
168
169sb              110100 ..... ..... ..... 0000 000 0000  @typea
170sbr             110100 ..... ..... ..... 0100 000 0000  @typea
171sbea            110100 ..... ..... ..... 0001 000 0000  @typea
172sbi             111100 ..... ..... ................     @typeb
173
174sh              110101 ..... ..... ..... 0000 000 0000  @typea
175shr             110101 ..... ..... ..... 0100 000 0000  @typea
176shea            110101 ..... ..... ..... 0001 000 0000  @typea
177shi             111101 ..... ..... ................     @typeb
178
179sw              110110 ..... ..... ..... 0000 000 0000  @typea
180swr             110110 ..... ..... ..... 0100 000 0000  @typea
181swea            110110 ..... ..... ..... 0001 000 0000  @typea
182swx             110110 ..... ..... ..... 1000 000 0000  @typea
183swi             111110 ..... ..... ................     @typeb
184
185sext8           100100 ..... ..... 00000 000 0110 0000  @typea0
186sext16          100100 ..... ..... 00000 000 0110 0001  @typea0
187
188sra             100100 ..... ..... 00000 000 0000 0001  @typea0
189src             100100 ..... ..... 00000 000 0010 0001  @typea0
190srl             100100 ..... ..... 00000 000 0100 0001  @typea0
191
192swapb           100100 ..... ..... 00000 001 1110 0000  @typea0
193swaph           100100 ..... ..... 00000 001 1110 0010  @typea0
194
195# Cache operations have no effect in qemu: discard the arguments.
196wdic            100100 00000 ----- ----- -00 -11- 01-0  # wdc
197wdic            100100 00000 ----- ----- 000 0110 1000  # wic
198
199xor             100010 ..... ..... ..... 000 0000 0000  @typea
200xori            101010 ..... ..... ................     @typeb
201