xref: /openbmc/qemu/target/microblaze/insns.decode (revision 081d8e02c352861af5deb20786160fa6860e5f8e)
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
79idiv            010010 ..... ..... ..... 000 0000 0000  @typea
80idivu           010010 ..... ..... ..... 000 0000 0010  @typea
81
82mul             010000 ..... ..... ..... 000 0000 0000  @typea
83mulh            010000 ..... ..... ..... 000 0000 0001  @typea
84mulhu           010000 ..... ..... ..... 000 0000 0011  @typea
85mulhsu          010000 ..... ..... ..... 000 0000 0010  @typea
86muli            011000 ..... ..... ................     @typeb
87
88or              100000 ..... ..... ..... 000 0000 0000  @typea
89ori             101000 ..... ..... ................     @typeb
90
91pcmpbf          100000 ..... ..... ..... 100 0000 0000  @typea
92pcmpeq          100010 ..... ..... ..... 100 0000 0000  @typea
93pcmpne          100011 ..... ..... ..... 100 0000 0000  @typea
94
95rsub            000001 ..... ..... ..... 000 0000 0000  @typea
96rsubc           000011 ..... ..... ..... 000 0000 0000  @typea
97rsubk           000101 ..... ..... ..... 000 0000 0000  @typea
98rsubkc          000111 ..... ..... ..... 000 0000 0000  @typea
99
100rsubi           001001 ..... ..... ................     @typeb
101rsubic          001011 ..... ..... ................     @typeb
102rsubik          001101 ..... ..... ................     @typeb
103rsubikc         001111 ..... ..... ................     @typeb
104
105sext8           100100 ..... ..... 00000 000 0110 0000  @typea0
106sext16          100100 ..... ..... 00000 000 0110 0001  @typea0
107
108sra             100100 ..... ..... 00000 000 0000 0001  @typea0
109src             100100 ..... ..... 00000 000 0010 0001  @typea0
110srl             100100 ..... ..... 00000 000 0100 0001  @typea0
111
112swapb           100100 ..... ..... 00000 001 1110 0000  @typea0
113swaph           100100 ..... ..... 00000 001 1110 0010  @typea0
114
115# Cache operations have no effect in qemu: discard the arguments.
116wdic            100100 00000 ----- ----- -00 -11- 01-0  # wdc
117wdic            100100 00000 ----- ----- 000 0110 1000  # wic
118
119xor             100010 ..... ..... ..... 000 0000 0000  @typea
120xori            101010 ..... ..... ................     @typeb
121