hw/timer/sse-counter: Model the SSE Subsystem System Counter
[qemu/ar7.git] / target / openrisc / insns.decode
blob0d6f7c29f82d4344ef09cd8b03bba66fc59a9a40
2 # OpenRISC instruction decode definitions.
4 # Copyright (c) 2018 Richard Henderson <rth@twiddle.net>
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.
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.
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/>.
20 &dab            d a b
21 &da             d a
22 &ab             a b
23 &dal            d a l
24 &ai             a i
25 &dab_pair       d a b dp ap bp
26 &ab_pair        a b ap bp
27 &da_pair        d a dp ap
29 ####
30 # System Instructions
31 ####
33 l_sys           001000 0000000000 k:16
34 l_trap          001000 0100000000 k:16
35 l_msync         001000 1000000000 00000000 00000000
36 l_psync         001000 1010000000 00000000 00000000
37 l_csync         001000 1100000000 00000000 00000000
39 l_rfe           001001 ----- ----- -------- --------
41 ####
42 # Branch Instructions
43 ####
45 l_j             000000 n:s26
46 l_jal           000001 n:s26
47 l_bnf           000011 n:s26
48 l_bf            000100 n:s26
50 l_jr            010001 ---------- b:5 -----------
51 l_jalr          010010 ---------- b:5 -----------
53 ####
54 # Memory Instructions
55 ####
57 &load           d a i
58 @load           ...... d:5 a:5 i:s16                    &load
60 %store_i        21:s5 0:11
61 &store          a b i
62 @store          ...... ..... a:5 b:5 ...........        &store i=%store_i
64 l_lwa           011011 ..... ..... ........ ........    @load
65 l_lwz           100001 ..... ..... ........ ........    @load
66 l_lws           100010 ..... ..... ........ ........    @load
67 l_lbz           100011 ..... ..... ........ ........    @load
68 l_lbs           100100 ..... ..... ........ ........    @load
69 l_lhz           100101 ..... ..... ........ ........    @load
70 l_lhs           100110 ..... ..... ........ ........    @load
72 l_swa           110011 ..... ..... ..... ...........    @store
73 l_sw            110101 ..... ..... ..... ...........    @store
74 l_sb            110110 ..... ..... ..... ...........    @store
75 l_sh            110111 ..... ..... ..... ...........    @store
77 ####
78 # Immediate Operand Instructions
79 ####
81 %mtspr_k        21:5 0:11
83 &rri            d a i
84 &rrk            d a k
85 @rri            ...... d:5 a:5 i:s16                    &rri
86 @rrk            ...... d:5 a:5 k:16                     &rrk
88 l_nop           000101 01--- ----- k:16
90 l_addi          100111 ..... ..... ........ ........    @rri
91 l_addic         101000 ..... ..... ........ ........    @rri
92 l_andi          101001 ..... ..... ........ ........    @rrk
93 l_ori           101010 ..... ..... ........ ........    @rrk
94 l_xori          101011 ..... ..... ........ ........    @rri
95 l_muli          101100 ..... ..... ........ ........    @rri
97 l_mfspr         101101 ..... ..... ........ ........    @rrk
98 l_mtspr         110000 ..... a:5 b:5 ...........        k=%mtspr_k
100 l_maci          010011 ----- a:5 i:s16
102 l_movhi         000110 d:5 ----0 k:16
103 l_macrc         000110 d:5 ----1 00000000 00000000
105 l_adrp          000010 d:5 i:s21
107 ####
108 # Arithmetic Instructions
109 ####
111 l_exths         111000 d:5 a:5 ----- - 0000 -- 1100
112 l_extbs         111000 d:5 a:5 ----- - 0001 -- 1100
113 l_exthz         111000 d:5 a:5 ----- - 0010 -- 1100
114 l_extbz         111000 d:5 a:5 ----- - 0011 -- 1100
116 l_add           111000 d:5 a:5 b:5   - 00 ---- 0000
117 l_addc          111000 d:5 a:5 b:5   - 00 ---- 0001
118 l_sub           111000 d:5 a:5 b:5   - 00 ---- 0010
119 l_and           111000 d:5 a:5 b:5   - 00 ---- 0011
120 l_or            111000 d:5 a:5 b:5   - 00 ---- 0100
121 l_xor           111000 d:5 a:5 b:5   - 00 ---- 0101
122 l_cmov          111000 d:5 a:5 b:5   - 00 ---- 1110
123 l_ff1           111000 d:5 a:5 ----- - 00 ---- 1111
124 l_fl1           111000 d:5 a:5 ----- - 01 ---- 1111
126 l_sll           111000 d:5 a:5 b:5   - 0000 -- 1000
127 l_srl           111000 d:5 a:5 b:5   - 0001 -- 1000
128 l_sra           111000 d:5 a:5 b:5   - 0010 -- 1000
129 l_ror           111000 d:5 a:5 b:5   - 0011 -- 1000
131 l_mul           111000 d:5 a:5 b:5   - 11 ---- 0110
132 l_mulu          111000 d:5 a:5 b:5   - 11 ---- 1011
133 l_div           111000 d:5 a:5 b:5   - 11 ---- 1001
134 l_divu          111000 d:5 a:5 b:5   - 11 ---- 1010
136 l_muld          111000 ----- a:5 b:5 - 11 ---- 0111
137 l_muldu         111000 ----- a:5 b:5 - 11 ---- 1100
139 l_mac           110001 ----- a:5 b:5 ------- 0001
140 l_macu          110001 ----- a:5 b:5 ------- 0011
141 l_msb           110001 ----- a:5 b:5 ------- 0010
142 l_msbu          110001 ----- a:5 b:5 ------- 0100
144 l_slli          101110 d:5 a:5 -------- 00 l:6
145 l_srli          101110 d:5 a:5 -------- 01 l:6
146 l_srai          101110 d:5 a:5 -------- 10 l:6
147 l_rori          101110 d:5 a:5 -------- 11 l:6
149 ####
150 # Compare Instructions
151 ####
153 l_sfeq          111001 00000 a:5 b:5 -----------
154 l_sfne          111001 00001 a:5 b:5 -----------
155 l_sfgtu         111001 00010 a:5 b:5 -----------
156 l_sfgeu         111001 00011 a:5 b:5 -----------
157 l_sfltu         111001 00100 a:5 b:5 -----------
158 l_sfleu         111001 00101 a:5 b:5 -----------
159 l_sfgts         111001 01010 a:5 b:5 -----------
160 l_sfges         111001 01011 a:5 b:5 -----------
161 l_sflts         111001 01100 a:5 b:5 -----------
162 l_sfles         111001 01101 a:5 b:5 -----------
164 l_sfeqi         101111 00000 a:5 i:s16
165 l_sfnei         101111 00001 a:5 i:s16
166 l_sfgtui        101111 00010 a:5 i:s16
167 l_sfgeui        101111 00011 a:5 i:s16
168 l_sfltui        101111 00100 a:5 i:s16
169 l_sfleui        101111 00101 a:5 i:s16
170 l_sfgtsi        101111 01010 a:5 i:s16
171 l_sfgesi        101111 01011 a:5 i:s16
172 l_sfltsi        101111 01100 a:5 i:s16
173 l_sflesi        101111 01101 a:5 i:s16
175 ####
176 # FP Instructions
177 ####
179 lf_add_s        110010 d:5 a:5 b:5   --- 00000000
180 lf_sub_s        110010 d:5 a:5 b:5   --- 00000001
181 lf_mul_s        110010 d:5 a:5 b:5   --- 00000010
182 lf_div_s        110010 d:5 a:5 b:5   --- 00000011
183 lf_rem_s        110010 d:5 a:5 b:5   --- 00000110
184 lf_madd_s       110010 d:5 a:5 b:5   --- 00000111
186 lf_itof_s       110010 d:5 a:5 00000 --- 00000100
187 lf_ftoi_s       110010 d:5 a:5 00000 --- 00000101
189 lf_sfeq_s       110010 ----- a:5 b:5 --- 00001000
190 lf_sfne_s       110010 ----- a:5 b:5 --- 00001001
191 lf_sfgt_s       110010 ----- a:5 b:5 --- 00001010
192 lf_sfge_s       110010 ----- a:5 b:5 --- 00001011
193 lf_sflt_s       110010 ----- a:5 b:5 --- 00001100
194 lf_sfle_s       110010 ----- a:5 b:5 --- 00001101
195 lf_sfueq_s      110010 ----- a:5 b:5 --- 00101000
196 lf_sfuge_s      110010 ----- a:5 b:5 --- 00101011
197 lf_sfugt_s      110010 ----- a:5 b:5 --- 00101010
198 lf_sfule_s      110010 ----- a:5 b:5 --- 00101101
199 lf_sfult_s      110010 ----- a:5 b:5 --- 00101100
200 lf_sfun_s       110010 ----- a:5 b:5 --- 00101110
202 ####
203 # DP Instructions
204 ####
206 @dab_pair       ...... d:5   a:5 b:5   dp:1 ap:1 bp:1 ........  &dab_pair
207 @ab_pair        ...... ..... a:5 b:5   .    ap:1 bp:1 ........  &ab_pair
208 @da_pair        ...... d:5   a:5 ..... dp:1 ap:1 .    ........  &da_pair
210 lf_add_d        110010 ..... ..... ..... ... 00010000  @dab_pair
211 lf_sub_d        110010 ..... ..... ..... ... 00010001  @dab_pair
212 lf_mul_d        110010 ..... ..... ..... ... 00010010  @dab_pair
213 lf_div_d        110010 ..... ..... ..... ... 00010011  @dab_pair
214 lf_rem_d        110010 ..... ..... ..... ... 00010110  @dab_pair
215 lf_madd_d       110010 ..... ..... ..... ... 00010111  @dab_pair
217 lf_itof_d       110010 ..... ..... 00000 ..0 00010100  @da_pair
218 lf_ftoi_d       110010 ..... ..... 00000 ..0 00010101  @da_pair
220 lf_stod_d       110010 d:5 a:5 00000 dp:1 0 0 00110100
221 lf_dtos_d       110010 d:5 a:5 00000 0 ap:1 0 00110101
223 lf_sfeq_d       110010 00000 ..... ..... 0.. 00011000  @ab_pair
224 lf_sfne_d       110010 00000 ..... ..... 0.. 00011001  @ab_pair
225 lf_sfgt_d       110010 00000 ..... ..... 0.. 00011010  @ab_pair
226 lf_sfge_d       110010 00000 ..... ..... 0.. 00011011  @ab_pair
227 lf_sflt_d       110010 00000 ..... ..... 0.. 00011100  @ab_pair
228 lf_sfle_d       110010 00000 ..... ..... 0.. 00011101  @ab_pair
229 lf_sfueq_d      110010 00000 ..... ..... 0.. 00111000  @ab_pair
230 lf_sfuge_d      110010 00000 ..... ..... 0.. 00111011  @ab_pair
231 lf_sfugt_d      110010 00000 ..... ..... 0.. 00111010  @ab_pair
232 lf_sfule_d      110010 00000 ..... ..... 0.. 00111101  @ab_pair
233 lf_sfult_d      110010 00000 ..... ..... 0.. 00111100  @ab_pair
234 lf_sfun_d       110010 00000 ..... ..... 0.. 00111110  @ab_pair