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 103lbu 110000 ..... ..... ..... 0000 000 0000 @typea 104lbur 110000 ..... ..... ..... 0100 000 0000 @typea 105lbuea 110000 ..... ..... ..... 0001 000 0000 @typea 106lbui 111000 ..... ..... ................ @typeb 107 108lhu 110001 ..... ..... ..... 0000 000 0000 @typea 109lhur 110001 ..... ..... ..... 0100 000 0000 @typea 110lhuea 110001 ..... ..... ..... 0001 000 0000 @typea 111lhui 111001 ..... ..... ................ @typeb 112 113lw 110010 ..... ..... ..... 0000 000 0000 @typea 114lwr 110010 ..... ..... ..... 0100 000 0000 @typea 115lwea 110010 ..... ..... ..... 0001 000 0000 @typea 116lwx 110010 ..... ..... ..... 1000 000 0000 @typea 117lwi 111010 ..... ..... ................ @typeb 118 119mul 010000 ..... ..... ..... 000 0000 0000 @typea 120mulh 010000 ..... ..... ..... 000 0000 0001 @typea 121mulhu 010000 ..... ..... ..... 000 0000 0011 @typea 122mulhsu 010000 ..... ..... ..... 000 0000 0010 @typea 123muli 011000 ..... ..... ................ @typeb 124 125or 100000 ..... ..... ..... 000 0000 0000 @typea 126ori 101000 ..... ..... ................ @typeb 127 128pcmpbf 100000 ..... ..... ..... 100 0000 0000 @typea 129pcmpeq 100010 ..... ..... ..... 100 0000 0000 @typea 130pcmpne 100011 ..... ..... ..... 100 0000 0000 @typea 131 132rsub 000001 ..... ..... ..... 000 0000 0000 @typea 133rsubc 000011 ..... ..... ..... 000 0000 0000 @typea 134rsubk 000101 ..... ..... ..... 000 0000 0000 @typea 135rsubkc 000111 ..... ..... ..... 000 0000 0000 @typea 136 137rsubi 001001 ..... ..... ................ @typeb 138rsubic 001011 ..... ..... ................ @typeb 139rsubik 001101 ..... ..... ................ @typeb 140rsubikc 001111 ..... ..... ................ @typeb 141 142sb 110100 ..... ..... ..... 0000 000 0000 @typea 143sbr 110100 ..... ..... ..... 0100 000 0000 @typea 144sbea 110100 ..... ..... ..... 0001 000 0000 @typea 145sbi 111100 ..... ..... ................ @typeb 146 147sh 110101 ..... ..... ..... 0000 000 0000 @typea 148shr 110101 ..... ..... ..... 0100 000 0000 @typea 149shea 110101 ..... ..... ..... 0001 000 0000 @typea 150shi 111101 ..... ..... ................ @typeb 151 152sw 110110 ..... ..... ..... 0000 000 0000 @typea 153swr 110110 ..... ..... ..... 0100 000 0000 @typea 154swea 110110 ..... ..... ..... 0001 000 0000 @typea 155swx 110110 ..... ..... ..... 1000 000 0000 @typea 156swi 111110 ..... ..... ................ @typeb 157 158sext8 100100 ..... ..... 00000 000 0110 0000 @typea0 159sext16 100100 ..... ..... 00000 000 0110 0001 @typea0 160 161sra 100100 ..... ..... 00000 000 0000 0001 @typea0 162src 100100 ..... ..... 00000 000 0010 0001 @typea0 163srl 100100 ..... ..... 00000 000 0100 0001 @typea0 164 165swapb 100100 ..... ..... 00000 001 1110 0000 @typea0 166swaph 100100 ..... ..... 00000 001 1110 0010 @typea0 167 168# Cache operations have no effect in qemu: discard the arguments. 169wdic 100100 00000 ----- ----- -00 -11- 01-0 # wdc 170wdic 100100 00000 ----- ----- 000 0110 1000 # wic 171 172xor 100010 ..... ..... ..... 000 0000 0000 @typea 173xori 101010 ..... ..... ................ @typeb 174