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