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&typea_bc ra rb 24&typeb rd ra imm 25&typeb_br rd imm 26&typeb_bc ra imm 27&type_msr rd imm 28 29# Include any IMM prefix in the value reported. 30%extimm 0:s16 !function=typeb_imm 31 32@typea ...... rd:5 ra:5 rb:5 ... .... .... &typea 33@typeb ...... rd:5 ra:5 ................ &typeb imm=%extimm 34 35# Officially typea, but with rb==0, which is not used. 36@typea0 ...... rd:5 ra:5 ................ &typea0 37 38# Officially typea, but with ra as opcode. 39@typea_br ...... rd:5 ..... rb:5 ........... &typea_br 40 41# Officially typea, but with rd as opcode. 42@typea_bc ...... ..... ra:5 rb:5 ........... &typea_bc 43 44# Officially typeb, but any immediate extension is unused. 45@typeb_bs ...... rd:5 ra:5 ..... ...... imm:5 &typeb 46 47# Officially typeb, but with ra as opcode. 48@typeb_br ...... rd:5 ..... ................ &typeb_br imm=%extimm 49 50# Officially typeb, but with rd as opcode. 51@typeb_bc ...... ..... ra:5 ................ &typeb_bc imm=%extimm 52 53# For convenience, extract the two imm_w/imm_s fields, then pack 54# them back together as "imm". Doing this makes it easiest to 55# match the required zero at bit 5. 56%ieimm 6:5 0:5 57@typeb_ie ...... rd:5 ra:5 ..... ..... . ..... &typeb imm=%ieimm 58 59@type_msr ...... rd:5 ...... imm:15 &type_msr 60 61### 62 63{ 64 zero 000000 00000 00000 00000 000 0000 0000 65 add 000000 ..... ..... ..... 000 0000 0000 @typea 66} 67addc 000010 ..... ..... ..... 000 0000 0000 @typea 68addk 000100 ..... ..... ..... 000 0000 0000 @typea 69addkc 000110 ..... ..... ..... 000 0000 0000 @typea 70 71addi 001000 ..... ..... ................ @typeb 72addic 001010 ..... ..... ................ @typeb 73addik 001100 ..... ..... ................ @typeb 74addikc 001110 ..... ..... ................ @typeb 75 76and 100001 ..... ..... ..... 000 0000 0000 @typea 77andi 101001 ..... ..... ................ @typeb 78 79andn 100011 ..... ..... ..... 000 0000 0000 @typea 80andni 101011 ..... ..... ................ @typeb 81 82beq 100111 00000 ..... ..... 000 0000 0000 @typea_bc 83bge 100111 00101 ..... ..... 000 0000 0000 @typea_bc 84bgt 100111 00100 ..... ..... 000 0000 0000 @typea_bc 85ble 100111 00011 ..... ..... 000 0000 0000 @typea_bc 86blt 100111 00010 ..... ..... 000 0000 0000 @typea_bc 87bne 100111 00001 ..... ..... 000 0000 0000 @typea_bc 88 89beqd 100111 10000 ..... ..... 000 0000 0000 @typea_bc 90bged 100111 10101 ..... ..... 000 0000 0000 @typea_bc 91bgtd 100111 10100 ..... ..... 000 0000 0000 @typea_bc 92bled 100111 10011 ..... ..... 000 0000 0000 @typea_bc 93bltd 100111 10010 ..... ..... 000 0000 0000 @typea_bc 94bned 100111 10001 ..... ..... 000 0000 0000 @typea_bc 95 96beqi 101111 00000 ..... ................ @typeb_bc 97bgei 101111 00101 ..... ................ @typeb_bc 98bgti 101111 00100 ..... ................ @typeb_bc 99blei 101111 00011 ..... ................ @typeb_bc 100blti 101111 00010 ..... ................ @typeb_bc 101bnei 101111 00001 ..... ................ @typeb_bc 102 103beqid 101111 10000 ..... ................ @typeb_bc 104bgeid 101111 10101 ..... ................ @typeb_bc 105bgtid 101111 10100 ..... ................ @typeb_bc 106bleid 101111 10011 ..... ................ @typeb_bc 107bltid 101111 10010 ..... ................ @typeb_bc 108bneid 101111 10001 ..... ................ @typeb_bc 109 110br 100110 ..... 00000 ..... 000 0000 0000 @typea_br 111bra 100110 ..... 01000 ..... 000 0000 0000 @typea_br 112brd 100110 ..... 10000 ..... 000 0000 0000 @typea_br 113brad 100110 ..... 11000 ..... 000 0000 0000 @typea_br 114brld 100110 ..... 10100 ..... 000 0000 0000 @typea_br 115brald 100110 ..... 11100 ..... 000 0000 0000 @typea_br 116 117bri 101110 ..... 00000 ................ @typeb_br 118brai 101110 ..... 01000 ................ @typeb_br 119brid 101110 ..... 10000 ................ @typeb_br 120braid 101110 ..... 11000 ................ @typeb_br 121brlid 101110 ..... 10100 ................ @typeb_br 122bralid 101110 ..... 11100 ................ @typeb_br 123 124brk 100110 ..... 01100 ..... 000 0000 0000 @typea_br 125brki 101110 ..... 01100 ................ @typeb_br 126 127bsrl 010001 ..... ..... ..... 000 0000 0000 @typea 128bsra 010001 ..... ..... ..... 010 0000 0000 @typea 129bsll 010001 ..... ..... ..... 100 0000 0000 @typea 130 131bsrli 011001 ..... ..... 00000 000000 ..... @typeb_bs 132bsrai 011001 ..... ..... 00000 010000 ..... @typeb_bs 133bslli 011001 ..... ..... 00000 100000 ..... @typeb_bs 134 135bsefi 011001 ..... ..... 01000 .....0 ..... @typeb_ie 136bsifi 011001 ..... ..... 10000 .....0 ..... @typeb_ie 137 138clz 100100 ..... ..... 00000 000 1110 0000 @typea0 139 140cmp 000101 ..... ..... ..... 000 0000 0001 @typea 141cmpu 000101 ..... ..... ..... 000 0000 0011 @typea 142 143fadd 010110 ..... ..... ..... 0000 000 0000 @typea 144frsub 010110 ..... ..... ..... 0001 000 0000 @typea 145fmul 010110 ..... ..... ..... 0010 000 0000 @typea 146fdiv 010110 ..... ..... ..... 0011 000 0000 @typea 147fcmp_un 010110 ..... ..... ..... 0100 000 0000 @typea 148fcmp_lt 010110 ..... ..... ..... 0100 001 0000 @typea 149fcmp_eq 010110 ..... ..... ..... 0100 010 0000 @typea 150fcmp_le 010110 ..... ..... ..... 0100 011 0000 @typea 151fcmp_gt 010110 ..... ..... ..... 0100 100 0000 @typea 152fcmp_ne 010110 ..... ..... ..... 0100 101 0000 @typea 153fcmp_ge 010110 ..... ..... ..... 0100 110 0000 @typea 154 155# Note that flt and fint, unlike fsqrt, are documented as having the RB 156# operand which is unused. So allow the field to be non-zero but discard 157# the value and treat as 2-operand insns. 158flt 010110 ..... ..... ----- 0101 000 0000 @typea0 159fint 010110 ..... ..... ----- 0110 000 0000 @typea0 160fsqrt 010110 ..... ..... 00000 0111 000 0000 @typea0 161 162idiv 010010 ..... ..... ..... 000 0000 0000 @typea 163idivu 010010 ..... ..... ..... 000 0000 0010 @typea 164 165imm 101100 00000 00000 imm:16 166 167lbu 110000 ..... ..... ..... 0000 000 0000 @typea 168lbur 110000 ..... ..... ..... 0100 000 0000 @typea 169lbuea 110000 ..... ..... ..... 0001 000 0000 @typea 170lbui 111000 ..... ..... ................ @typeb 171 172lhu 110001 ..... ..... ..... 0000 000 0000 @typea 173lhur 110001 ..... ..... ..... 0100 000 0000 @typea 174lhuea 110001 ..... ..... ..... 0001 000 0000 @typea 175lhui 111001 ..... ..... ................ @typeb 176 177lw 110010 ..... ..... ..... 0000 000 0000 @typea 178lwr 110010 ..... ..... ..... 0100 000 0000 @typea 179lwea 110010 ..... ..... ..... 0001 000 0000 @typea 180lwx 110010 ..... ..... ..... 1000 000 0000 @typea 181lwi 111010 ..... ..... ................ @typeb 182 183mbar 101110 imm:5 00010 0000 0000 0000 0100 184 185msrclr 100101 ..... 100010 ............... @type_msr 186msrset 100101 ..... 100000 ............... @type_msr 187 188mul 010000 ..... ..... ..... 000 0000 0000 @typea 189mulh 010000 ..... ..... ..... 000 0000 0001 @typea 190mulhu 010000 ..... ..... ..... 000 0000 0011 @typea 191mulhsu 010000 ..... ..... ..... 000 0000 0010 @typea 192muli 011000 ..... ..... ................ @typeb 193 194or 100000 ..... ..... ..... 000 0000 0000 @typea 195ori 101000 ..... ..... ................ @typeb 196 197pcmpbf 100000 ..... ..... ..... 100 0000 0000 @typea 198pcmpeq 100010 ..... ..... ..... 100 0000 0000 @typea 199pcmpne 100011 ..... ..... ..... 100 0000 0000 @typea 200 201rsub 000001 ..... ..... ..... 000 0000 0000 @typea 202rsubc 000011 ..... ..... ..... 000 0000 0000 @typea 203rsubk 000101 ..... ..... ..... 000 0000 0000 @typea 204rsubkc 000111 ..... ..... ..... 000 0000 0000 @typea 205 206rsubi 001001 ..... ..... ................ @typeb 207rsubic 001011 ..... ..... ................ @typeb 208rsubik 001101 ..... ..... ................ @typeb 209rsubikc 001111 ..... ..... ................ @typeb 210 211rtbd 101101 10010 ..... ................ @typeb_bc 212rtid 101101 10001 ..... ................ @typeb_bc 213rted 101101 10100 ..... ................ @typeb_bc 214rtsd 101101 10000 ..... ................ @typeb_bc 215 216sb 110100 ..... ..... ..... 0000 000 0000 @typea 217sbr 110100 ..... ..... ..... 0100 000 0000 @typea 218sbea 110100 ..... ..... ..... 0001 000 0000 @typea 219sbi 111100 ..... ..... ................ @typeb 220 221sh 110101 ..... ..... ..... 0000 000 0000 @typea 222shr 110101 ..... ..... ..... 0100 000 0000 @typea 223shea 110101 ..... ..... ..... 0001 000 0000 @typea 224shi 111101 ..... ..... ................ @typeb 225 226sw 110110 ..... ..... ..... 0000 000 0000 @typea 227swr 110110 ..... ..... ..... 0100 000 0000 @typea 228swea 110110 ..... ..... ..... 0001 000 0000 @typea 229swx 110110 ..... ..... ..... 1000 000 0000 @typea 230swi 111110 ..... ..... ................ @typeb 231 232sext8 100100 ..... ..... 00000 000 0110 0000 @typea0 233sext16 100100 ..... ..... 00000 000 0110 0001 @typea0 234 235sra 100100 ..... ..... 00000 000 0000 0001 @typea0 236src 100100 ..... ..... 00000 000 0010 0001 @typea0 237srl 100100 ..... ..... 00000 000 0100 0001 @typea0 238 239swapb 100100 ..... ..... 00000 001 1110 0000 @typea0 240swaph 100100 ..... ..... 00000 001 1110 0010 @typea0 241 242# Cache operations have no effect in qemu: discard the arguments. 243wdic 100100 00000 ----- ----- -00 -11- 01-0 # wdc 244wdic 100100 00000 ----- ----- 000 0110 1000 # wic 245 246xor 100010 ..... ..... ..... 000 0000 0000 @typea 247xori 101010 ..... ..... ................ @typeb 248