xref: /qemu/target/microblaze/insns.decode (revision d5aead3df4369f56bf79bcd97a06cd63e4acfee6)
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&typeb          rd ra imm
23
24# Include any IMM prefix in the value reported.
25%extimm         0:s16 !function=typeb_imm
26
27@typea          ...... rd:5 ra:5 rb:5 ... .... ....     &typea
28@typeb          ...... rd:5 ra:5 ................       &typeb imm=%extimm
29
30# Officially typea, but with rb==0, which is not used.
31@typea0         ...... rd:5 ra:5 ................       &typea0
32
33# Officially typeb, but any immediate extension is unused.
34@typeb_bs       ...... rd:5 ra:5 ..... ...... imm:5     &typeb
35
36# For convenience, extract the two imm_w/imm_s fields, then pack
37# them back together as "imm".  Doing this makes it easiest to
38# match the required zero at bit 5.
39%ieimm          6:5 0:5
40@typeb_ie       ...... rd:5 ra:5 ..... ..... . .....    &typeb imm=%ieimm
41
42###
43
44{
45  zero          000000 00000 00000 00000 000 0000 0000
46  add           000000 ..... ..... ..... 000 0000 0000  @typea
47}
48addc            000010 ..... ..... ..... 000 0000 0000  @typea
49addk            000100 ..... ..... ..... 000 0000 0000  @typea
50addkc           000110 ..... ..... ..... 000 0000 0000  @typea
51
52addi            001000 ..... ..... ................     @typeb
53addic           001010 ..... ..... ................     @typeb
54addik           001100 ..... ..... ................     @typeb
55addikc          001110 ..... ..... ................     @typeb
56
57and             100001 ..... ..... ..... 000 0000 0000  @typea
58andi            101001 ..... ..... ................     @typeb
59
60andn            100011 ..... ..... ..... 000 0000 0000  @typea
61andni           101011 ..... ..... ................     @typeb
62
63bsrl            010001 ..... ..... ..... 000 0000 0000  @typea
64bsra            010001 ..... ..... ..... 010 0000 0000  @typea
65bsll            010001 ..... ..... ..... 100 0000 0000  @typea
66
67bsrli           011001 ..... ..... 00000 000000 .....   @typeb_bs
68bsrai           011001 ..... ..... 00000 010000 .....   @typeb_bs
69bslli           011001 ..... ..... 00000 100000 .....   @typeb_bs
70
71bsefi           011001 ..... ..... 01000 .....0 .....   @typeb_ie
72bsifi           011001 ..... ..... 10000 .....0 .....   @typeb_ie
73
74clz             100100 ..... ..... 00000 000 1110 0000  @typea0
75
76cmp             000101 ..... ..... ..... 000 0000 0001  @typea
77cmpu            000101 ..... ..... ..... 000 0000 0011  @typea
78
79fadd            010110 ..... ..... ..... 0000 000 0000  @typea
80frsub           010110 ..... ..... ..... 0001 000 0000  @typea
81fmul            010110 ..... ..... ..... 0010 000 0000  @typea
82fdiv            010110 ..... ..... ..... 0011 000 0000  @typea
83fcmp_un         010110 ..... ..... ..... 0100 000 0000  @typea
84fcmp_lt         010110 ..... ..... ..... 0100 001 0000  @typea
85fcmp_eq         010110 ..... ..... ..... 0100 010 0000  @typea
86fcmp_le         010110 ..... ..... ..... 0100 011 0000  @typea
87fcmp_gt         010110 ..... ..... ..... 0100 100 0000  @typea
88fcmp_ne         010110 ..... ..... ..... 0100 101 0000  @typea
89fcmp_ge         010110 ..... ..... ..... 0100 110 0000  @typea
90
91# Note that flt and fint, unlike fsqrt, are documented as having the RB
92# operand which is unused.  So allow the field to be non-zero but discard
93# the value and treat as 2-operand insns.
94flt             010110 ..... ..... ----- 0101 000 0000  @typea0
95fint            010110 ..... ..... ----- 0110 000 0000  @typea0
96fsqrt           010110 ..... ..... 00000 0111 000 0000  @typea0
97
98idiv            010010 ..... ..... ..... 000 0000 0000  @typea
99idivu           010010 ..... ..... ..... 000 0000 0010  @typea
100
101imm             101100 00000 00000 imm:16
102
103mul             010000 ..... ..... ..... 000 0000 0000  @typea
104mulh            010000 ..... ..... ..... 000 0000 0001  @typea
105mulhu           010000 ..... ..... ..... 000 0000 0011  @typea
106mulhsu          010000 ..... ..... ..... 000 0000 0010  @typea
107muli            011000 ..... ..... ................     @typeb
108
109or              100000 ..... ..... ..... 000 0000 0000  @typea
110ori             101000 ..... ..... ................     @typeb
111
112pcmpbf          100000 ..... ..... ..... 100 0000 0000  @typea
113pcmpeq          100010 ..... ..... ..... 100 0000 0000  @typea
114pcmpne          100011 ..... ..... ..... 100 0000 0000  @typea
115
116rsub            000001 ..... ..... ..... 000 0000 0000  @typea
117rsubc           000011 ..... ..... ..... 000 0000 0000  @typea
118rsubk           000101 ..... ..... ..... 000 0000 0000  @typea
119rsubkc          000111 ..... ..... ..... 000 0000 0000  @typea
120
121rsubi           001001 ..... ..... ................     @typeb
122rsubic          001011 ..... ..... ................     @typeb
123rsubik          001101 ..... ..... ................     @typeb
124rsubikc         001111 ..... ..... ................     @typeb
125
126sext8           100100 ..... ..... 00000 000 0110 0000  @typea0
127sext16          100100 ..... ..... 00000 000 0110 0001  @typea0
128
129sra             100100 ..... ..... 00000 000 0000 0001  @typea0
130src             100100 ..... ..... 00000 000 0010 0001  @typea0
131srl             100100 ..... ..... 00000 000 0100 0001  @typea0
132
133swapb           100100 ..... ..... 00000 001 1110 0000  @typea0
134swaph           100100 ..... ..... 00000 001 1110 0010  @typea0
135
136# Cache operations have no effect in qemu: discard the arguments.
137wdic            100100 00000 ----- ----- -00 -11- 01-0  # wdc
138wdic            100100 00000 ----- ----- 000 0110 1000  # wic
139
140xor             100010 ..... ..... ..... 000 0000 0000  @typea
141xori            101010 ..... ..... ................     @typeb
142