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 162get 011011 rd:5 00000 0 ctrl:5 000000 imm:4 163getd 010011 rd:5 00000 rb:5 0 ctrl:5 00000 164 165idiv 010010 ..... ..... ..... 000 0000 0000 @typea 166idivu 010010 ..... ..... ..... 000 0000 0010 @typea 167 168imm 101100 00000 00000 imm:16 169 170lbu 110000 ..... ..... ..... 0000 000 0000 @typea 171lbur 110000 ..... ..... ..... 0100 000 0000 @typea 172lbuea 110000 ..... ..... ..... 0001 000 0000 @typea 173lbui 111000 ..... ..... ................ @typeb 174 175lhu 110001 ..... ..... ..... 0000 000 0000 @typea 176lhur 110001 ..... ..... ..... 0100 000 0000 @typea 177lhuea 110001 ..... ..... ..... 0001 000 0000 @typea 178lhui 111001 ..... ..... ................ @typeb 179 180lw 110010 ..... ..... ..... 0000 000 0000 @typea 181lwr 110010 ..... ..... ..... 0100 000 0000 @typea 182lwea 110010 ..... ..... ..... 0001 000 0000 @typea 183lwx 110010 ..... ..... ..... 1000 000 0000 @typea 184lwi 111010 ..... ..... ................ @typeb 185 186mbar 101110 imm:5 00010 0000 0000 0000 0100 187 188mfs 100101 rd:5 0 e:1 000 10 rs:14 189mts 100101 0 e:1 000 ra:5 11 rs:14 190 191msrclr 100101 ..... 100010 ............... @type_msr 192msrset 100101 ..... 100000 ............... @type_msr 193 194mul 010000 ..... ..... ..... 000 0000 0000 @typea 195mulh 010000 ..... ..... ..... 000 0000 0001 @typea 196mulhu 010000 ..... ..... ..... 000 0000 0011 @typea 197mulhsu 010000 ..... ..... ..... 000 0000 0010 @typea 198muli 011000 ..... ..... ................ @typeb 199 200or 100000 ..... ..... ..... 000 0000 0000 @typea 201ori 101000 ..... ..... ................ @typeb 202 203pcmpbf 100000 ..... ..... ..... 100 0000 0000 @typea 204pcmpeq 100010 ..... ..... ..... 100 0000 0000 @typea 205pcmpne 100011 ..... ..... ..... 100 0000 0000 @typea 206 207put 011011 00000 ra:5 1 ctrl:5 000000 imm:4 208putd 010011 00000 ra:5 rb:5 1 ctrl:5 00000 209 210rsub 000001 ..... ..... ..... 000 0000 0000 @typea 211rsubc 000011 ..... ..... ..... 000 0000 0000 @typea 212rsubk 000101 ..... ..... ..... 000 0000 0000 @typea 213rsubkc 000111 ..... ..... ..... 000 0000 0000 @typea 214 215rsubi 001001 ..... ..... ................ @typeb 216rsubic 001011 ..... ..... ................ @typeb 217rsubik 001101 ..... ..... ................ @typeb 218rsubikc 001111 ..... ..... ................ @typeb 219 220rtbd 101101 10010 ..... ................ @typeb_bc 221rtid 101101 10001 ..... ................ @typeb_bc 222rted 101101 10100 ..... ................ @typeb_bc 223rtsd 101101 10000 ..... ................ @typeb_bc 224 225sb 110100 ..... ..... ..... 0000 000 0000 @typea 226sbr 110100 ..... ..... ..... 0100 000 0000 @typea 227sbea 110100 ..... ..... ..... 0001 000 0000 @typea 228sbi 111100 ..... ..... ................ @typeb 229 230sh 110101 ..... ..... ..... 0000 000 0000 @typea 231shr 110101 ..... ..... ..... 0100 000 0000 @typea 232shea 110101 ..... ..... ..... 0001 000 0000 @typea 233shi 111101 ..... ..... ................ @typeb 234 235sw 110110 ..... ..... ..... 0000 000 0000 @typea 236swr 110110 ..... ..... ..... 0100 000 0000 @typea 237swea 110110 ..... ..... ..... 0001 000 0000 @typea 238swx 110110 ..... ..... ..... 1000 000 0000 @typea 239swi 111110 ..... ..... ................ @typeb 240 241sext8 100100 ..... ..... 00000 000 0110 0000 @typea0 242sext16 100100 ..... ..... 00000 000 0110 0001 @typea0 243 244sra 100100 ..... ..... 00000 000 0000 0001 @typea0 245src 100100 ..... ..... 00000 000 0010 0001 @typea0 246srl 100100 ..... ..... 00000 000 0100 0001 @typea0 247 248swapb 100100 ..... ..... 00000 001 1110 0000 @typea0 249swaph 100100 ..... ..... 00000 001 1110 0010 @typea0 250 251# Cache operations have no effect in qemu: discard the arguments. 252wdic 100100 00000 ----- ----- -00 -11- 01-0 # wdc 253wdic 100100 00000 ----- ----- 000 0110 1000 # wic 254 255xor 100010 ..... ..... ..... 000 0000 0000 @typea 256xori 101010 ..... ..... ................ @typeb 257