1 1.1 christos /* CPU family header for crisv10f. 2 1.1 christos 3 1.1 christos THIS FILE IS MACHINE GENERATED WITH CGEN. 4 1.1 christos 5 1.11 christos Copyright (C) 1996-2024 Free Software Foundation, Inc. 6 1.1 christos 7 1.1 christos This file is part of the GNU simulators. 8 1.1 christos 9 1.1 christos This file is free software; you can redistribute it and/or modify 10 1.1 christos it under the terms of the GNU General Public License as published by 11 1.1 christos the Free Software Foundation; either version 3, or (at your option) 12 1.1 christos any later version. 13 1.1 christos 14 1.1 christos It is distributed in the hope that it will be useful, but WITHOUT 15 1.1 christos ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 1.1 christos or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 17 1.1 christos License for more details. 18 1.1 christos 19 1.1 christos You should have received a copy of the GNU General Public License along 20 1.11 christos with this program; if not, write to the Free Software Foundation, Inc., 21 1.11 christos 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 22 1.1 christos 23 1.1 christos */ 24 1.1 christos 25 1.1 christos #ifndef CPU_CRISV10F_H 26 1.1 christos #define CPU_CRISV10F_H 27 1.1 christos 28 1.1 christos /* Maximum number of instructions that are fetched at a time. 29 1.1 christos This is for LIW type instructions sets (e.g. m32r). */ 30 1.1 christos #define MAX_LIW_INSNS 1 31 1.1 christos 32 1.1 christos /* Maximum number of instructions that can be executed in parallel. */ 33 1.1 christos #define MAX_PARALLEL_INSNS 1 34 1.1 christos 35 1.1 christos /* The size of an "int" needed to hold an instruction word. 36 1.1 christos This is usually 32 bits, but some architectures needs 64 bits. */ 37 1.1 christos typedef CGEN_INSN_INT CGEN_INSN_WORD; 38 1.1 christos 39 1.1 christos #include "cgen-engine.h" 40 1.1 christos 41 1.1 christos /* CPU state information. */ 42 1.1 christos typedef struct { 43 1.1 christos /* Hardware elements. */ 44 1.1 christos struct { 45 1.1 christos /* program counter */ 46 1.1 christos USI h_pc; 47 1.1 christos #define GET_H_PC() CPU (h_pc) 48 1.1 christos #define SET_H_PC(x) \ 49 1.1 christos do { \ 50 1.1 christos CPU (h_pc) = ANDSI ((x), (~ (1)));\ 51 1.1 christos ;} while (0) 52 1.1 christos /* General purpose registers */ 53 1.1 christos SI h_gr_real_pc[16]; 54 1.1 christos #define GET_H_GR_REAL_PC(a1) CPU (h_gr_real_pc)[a1] 55 1.1 christos #define SET_H_GR_REAL_PC(a1, x) (CPU (h_gr_real_pc)[a1] = (x)) 56 1.1 christos /* Special registers for v10 */ 57 1.1 christos SI h_sr_v10[16]; 58 1.1 christos #define GET_H_SR_V10(index) (ORIF (ORIF (((index) == (((UINT) 0))), ((index) == (((UINT) 4)))), ((index) == (((UINT) 8))))) ? (0) : (((index) == (((UINT) 1)))) ? (10) : (ORIF (((index) == (((UINT) 5))), ((index) == (((UINT) 13))))) ? (ORSI (ANDSI (CPU (h_sr_v10[((UINT) 5)]), 0xffffff00), ORSI (ZEXTBISI (CPU (h_cbit)), ORSI (SLLSI (ZEXTBISI (CPU (h_vbit)), 1), ORSI (SLLSI (ZEXTBISI (CPU (h_zbit)), 2), ORSI (SLLSI (ZEXTBISI (CPU (h_nbit)), 3), ORSI (SLLSI (ZEXTBISI (CPU (h_xbit)), 4), ORSI (SLLSI (ZEXTBISI (GET_H_IBIT ()), 5), ORSI (SLLSI (ZEXTBISI (GET_H_UBIT ()), 6), ORSI (SLLSI (ZEXTBISI (CPU (h_pbit)), 7), 0)))))))))) : (CPU (h_sr_v10[index])) 59 1.1 christos #define SET_H_SR_V10(index, x) \ 60 1.1 christos do { \ 61 1.1 christos if (ORIF (ORIF ((((index)) == (((UINT) 0))), (((index)) == (((UINT) 4)))), ORIF ((((index)) == (((UINT) 8))), (((index)) == (((UINT) 1)))))) {\ 62 1.1 christos ((void) 0); /*nop*/\ 63 1.1 christos }\ 64 1.1 christos else if (ORIF ((((index)) == (((UINT) 5))), (((index)) == (((UINT) 13))))) {\ 65 1.1 christos {\ 66 1.1 christos CPU (h_cbit) = ((NESI (ANDSI ((x), ((1) << (0))), 0)) ? (1) : (0));\ 67 1.1 christos CPU (h_vbit) = ((NESI (ANDSI ((x), ((1) << (1))), 0)) ? (1) : (0));\ 68 1.1 christos CPU (h_zbit) = ((NESI (ANDSI ((x), ((1) << (2))), 0)) ? (1) : (0));\ 69 1.1 christos CPU (h_nbit) = ((NESI (ANDSI ((x), ((1) << (3))), 0)) ? (1) : (0));\ 70 1.1 christos CPU (h_xbit) = ((NESI (ANDSI ((x), ((1) << (4))), 0)) ? (1) : (0));\ 71 1.1 christos SET_H_IBIT (((NESI (ANDSI ((x), ((1) << (5))), 0)) ? (1) : (0)));\ 72 1.1 christos SET_H_UBIT (((NESI (ANDSI ((x), ((1) << (6))), 0)) ? (1) : (0)));\ 73 1.1 christos CPU (h_pbit) = ((NESI (ANDSI ((x), ((1) << (7))), 0)) ? (1) : (0));\ 74 1.1 christos CPU (h_sr_v10[((UINT) 5)]) = (x);\ 75 1.1 christos CPU (h_sr_v10[((UINT) 13)]) = (x);\ 76 1.1 christos }\ 77 1.1 christos }\ 78 1.1 christos else {\ 79 1.1 christos CPU (h_sr_v10[(index)]) = (x);\ 80 1.1 christos }\ 81 1.1 christos ;} while (0) 82 1.1 christos /* carry bit */ 83 1.1 christos BI h_cbit; 84 1.1 christos #define GET_H_CBIT() CPU (h_cbit) 85 1.1 christos #define SET_H_CBIT(x) (CPU (h_cbit) = (x)) 86 1.1 christos /* overflow bit */ 87 1.1 christos BI h_vbit; 88 1.1 christos #define GET_H_VBIT() CPU (h_vbit) 89 1.1 christos #define SET_H_VBIT(x) (CPU (h_vbit) = (x)) 90 1.1 christos /* zero bit */ 91 1.1 christos BI h_zbit; 92 1.1 christos #define GET_H_ZBIT() CPU (h_zbit) 93 1.1 christos #define SET_H_ZBIT(x) (CPU (h_zbit) = (x)) 94 1.1 christos /* sign bit */ 95 1.1 christos BI h_nbit; 96 1.1 christos #define GET_H_NBIT() CPU (h_nbit) 97 1.1 christos #define SET_H_NBIT(x) (CPU (h_nbit) = (x)) 98 1.1 christos /* extended-arithmetic bit */ 99 1.1 christos BI h_xbit; 100 1.1 christos #define GET_H_XBIT() CPU (h_xbit) 101 1.1 christos #define SET_H_XBIT(x) (CPU (h_xbit) = (x)) 102 1.1 christos /* interrupt-enable bit */ 103 1.1 christos BI h_ibit_pre_v32; 104 1.1 christos #define GET_H_IBIT_PRE_V32() CPU (h_ibit_pre_v32) 105 1.1 christos #define SET_H_IBIT_PRE_V32(x) (CPU (h_ibit_pre_v32) = (x)) 106 1.1 christos /* sequence-broken bit */ 107 1.1 christos BI h_pbit; 108 1.1 christos #define GET_H_PBIT() CPU (h_pbit) 109 1.1 christos #define SET_H_PBIT(x) (CPU (h_pbit) = (x)) 110 1.1 christos /* user mode bit */ 111 1.1 christos BI h_ubit_pre_v32; 112 1.1 christos #define GET_H_UBIT_PRE_V32() CPU (h_ubit_pre_v32) 113 1.1 christos #define SET_H_UBIT_PRE_V32(x) (CPU (h_ubit_pre_v32) = (x)) 114 1.1 christos /* instruction-is-prefixed bit */ 115 1.1 christos BI h_insn_prefixed_p_pre_v32; 116 1.1 christos #define GET_H_INSN_PREFIXED_P_PRE_V32() CPU (h_insn_prefixed_p_pre_v32) 117 1.1 christos #define SET_H_INSN_PREFIXED_P_PRE_V32(x) (CPU (h_insn_prefixed_p_pre_v32) = (x)) 118 1.1 christos /* Prefix-address register */ 119 1.1 christos SI h_prefixreg_pre_v32; 120 1.1 christos #define GET_H_PREFIXREG_PRE_V32() CPU (h_prefixreg_pre_v32) 121 1.1 christos #define SET_H_PREFIXREG_PRE_V32(x) (CPU (h_prefixreg_pre_v32) = (x)) 122 1.1 christos } hardware; 123 1.11 christos #define CPU_CGEN_HW(cpu) (& CRIS_SIM_CPU (cpu)->cpu_data.hardware) 124 1.1 christos } CRISV10F_CPU_DATA; 125 1.1 christos 126 1.1 christos /* Virtual regs. */ 127 1.1 christos 128 1.1 christos #define GET_H_V32_NON_V32() 0 129 1.1 christos #define SET_H_V32_NON_V32(x) \ 130 1.1 christos do { \ 131 1.1 christos cgen_rtx_error (current_cpu, "Can't set h-v32");\ 132 1.1 christos ;} while (0) 133 1.1 christos #define GET_H_GR(index) GET_H_GR_PC (index) 134 1.1 christos #define SET_H_GR(index, x) \ 135 1.1 christos do { \ 136 1.1 christos SET_H_GR_PC ((index), (x));\ 137 1.1 christos ;} while (0) 138 1.1 christos #define GET_H_GR_PC(index) ((((index) == (15))) ? ((cgen_rtx_error (current_cpu, "General register read of PC is not implemented."), 0)) : (CPU (h_gr_real_pc[index]))) 139 1.1 christos #define SET_H_GR_PC(index, x) \ 140 1.1 christos do { \ 141 1.1 christos {\ 142 1.1 christos if ((((index)) == (15))) {\ 143 1.1 christos cgen_rtx_error (current_cpu, "General register write to PC is not implemented.");\ 144 1.1 christos }\ 145 1.1 christos CPU (h_gr_real_pc[(index)]) = (x);\ 146 1.1 christos }\ 147 1.1 christos ;} while (0) 148 1.1 christos #define GET_H_RAW_GR_PC(index) CPU (h_gr_real_pc[index]) 149 1.1 christos #define SET_H_RAW_GR_PC(index, x) \ 150 1.1 christos do { \ 151 1.1 christos CPU (h_gr_real_pc[(index)]) = (x);\ 152 1.1 christos ;} while (0) 153 1.1 christos #define GET_H_SR(index) GET_H_SR_V10 (index) 154 1.1 christos #define SET_H_SR(index, x) \ 155 1.1 christos do { \ 156 1.1 christos SET_H_SR_V10 ((index), (x));\ 157 1.1 christos ;} while (0) 158 1.1 christos #define GET_H_CBIT_MOVE() GET_H_CBIT_MOVE_PRE_V32 () 159 1.1 christos #define SET_H_CBIT_MOVE(x) \ 160 1.1 christos do { \ 161 1.1 christos SET_H_CBIT_MOVE_PRE_V32 ((x));\ 162 1.1 christos ;} while (0) 163 1.1 christos #define GET_H_CBIT_MOVE_PRE_V32() CPU (h_cbit) 164 1.1 christos #define SET_H_CBIT_MOVE_PRE_V32(x) \ 165 1.1 christos do { \ 166 1.1 christos CPU (h_cbit) = (x);\ 167 1.1 christos ;} while (0) 168 1.1 christos #define GET_H_VBIT_MOVE() GET_H_VBIT_MOVE_PRE_V32 () 169 1.1 christos #define SET_H_VBIT_MOVE(x) \ 170 1.1 christos do { \ 171 1.1 christos SET_H_VBIT_MOVE_PRE_V32 ((x));\ 172 1.1 christos ;} while (0) 173 1.1 christos #define GET_H_VBIT_MOVE_PRE_V32() CPU (h_vbit) 174 1.1 christos #define SET_H_VBIT_MOVE_PRE_V32(x) \ 175 1.1 christos do { \ 176 1.1 christos CPU (h_vbit) = (x);\ 177 1.1 christos ;} while (0) 178 1.1 christos #define GET_H_ZBIT_MOVE() GET_H_ZBIT_MOVE_PRE_V32 () 179 1.1 christos #define SET_H_ZBIT_MOVE(x) \ 180 1.1 christos do { \ 181 1.1 christos SET_H_ZBIT_MOVE_PRE_V32 ((x));\ 182 1.1 christos ;} while (0) 183 1.1 christos #define GET_H_ZBIT_MOVE_PRE_V32() CPU (h_zbit) 184 1.1 christos #define SET_H_ZBIT_MOVE_PRE_V32(x) \ 185 1.1 christos do { \ 186 1.1 christos CPU (h_zbit) = (x);\ 187 1.1 christos ;} while (0) 188 1.1 christos #define GET_H_NBIT_MOVE() GET_H_NBIT_MOVE_PRE_V32 () 189 1.1 christos #define SET_H_NBIT_MOVE(x) \ 190 1.1 christos do { \ 191 1.1 christos SET_H_NBIT_MOVE_PRE_V32 ((x));\ 192 1.1 christos ;} while (0) 193 1.1 christos #define GET_H_NBIT_MOVE_PRE_V32() CPU (h_nbit) 194 1.1 christos #define SET_H_NBIT_MOVE_PRE_V32(x) \ 195 1.1 christos do { \ 196 1.1 christos CPU (h_nbit) = (x);\ 197 1.1 christos ;} while (0) 198 1.1 christos #define GET_H_IBIT() CPU (h_ibit_pre_v32) 199 1.1 christos #define SET_H_IBIT(x) \ 200 1.1 christos do { \ 201 1.1 christos CPU (h_ibit_pre_v32) = (x);\ 202 1.1 christos ;} while (0) 203 1.1 christos #define GET_H_UBIT() CPU (h_ubit_pre_v32) 204 1.1 christos #define SET_H_UBIT(x) \ 205 1.1 christos do { \ 206 1.1 christos CPU (h_ubit_pre_v32) = (x);\ 207 1.1 christos ;} while (0) 208 1.1 christos #define GET_H_INSN_PREFIXED_P() CPU (h_insn_prefixed_p_pre_v32) 209 1.1 christos #define SET_H_INSN_PREFIXED_P(x) \ 210 1.1 christos do { \ 211 1.1 christos CPU (h_insn_prefixed_p_pre_v32) = (x);\ 212 1.1 christos ;} while (0) 213 1.1 christos 214 1.1 christos /* Cover fns for register access. */ 215 1.1 christos BI crisv10f_h_v32_non_v32_get (SIM_CPU *); 216 1.1 christos void crisv10f_h_v32_non_v32_set (SIM_CPU *, BI); 217 1.1 christos USI crisv10f_h_pc_get (SIM_CPU *); 218 1.1 christos void crisv10f_h_pc_set (SIM_CPU *, USI); 219 1.1 christos SI crisv10f_h_gr_get (SIM_CPU *, UINT); 220 1.1 christos void crisv10f_h_gr_set (SIM_CPU *, UINT, SI); 221 1.1 christos SI crisv10f_h_gr_pc_get (SIM_CPU *, UINT); 222 1.1 christos void crisv10f_h_gr_pc_set (SIM_CPU *, UINT, SI); 223 1.1 christos SI crisv10f_h_gr_real_pc_get (SIM_CPU *, UINT); 224 1.1 christos void crisv10f_h_gr_real_pc_set (SIM_CPU *, UINT, SI); 225 1.1 christos SI crisv10f_h_raw_gr_pc_get (SIM_CPU *, UINT); 226 1.1 christos void crisv10f_h_raw_gr_pc_set (SIM_CPU *, UINT, SI); 227 1.1 christos SI crisv10f_h_sr_get (SIM_CPU *, UINT); 228 1.1 christos void crisv10f_h_sr_set (SIM_CPU *, UINT, SI); 229 1.1 christos SI crisv10f_h_sr_v10_get (SIM_CPU *, UINT); 230 1.1 christos void crisv10f_h_sr_v10_set (SIM_CPU *, UINT, SI); 231 1.1 christos BI crisv10f_h_cbit_get (SIM_CPU *); 232 1.1 christos void crisv10f_h_cbit_set (SIM_CPU *, BI); 233 1.1 christos BI crisv10f_h_cbit_move_get (SIM_CPU *); 234 1.1 christos void crisv10f_h_cbit_move_set (SIM_CPU *, BI); 235 1.1 christos BI crisv10f_h_cbit_move_pre_v32_get (SIM_CPU *); 236 1.1 christos void crisv10f_h_cbit_move_pre_v32_set (SIM_CPU *, BI); 237 1.1 christos BI crisv10f_h_vbit_get (SIM_CPU *); 238 1.1 christos void crisv10f_h_vbit_set (SIM_CPU *, BI); 239 1.1 christos BI crisv10f_h_vbit_move_get (SIM_CPU *); 240 1.1 christos void crisv10f_h_vbit_move_set (SIM_CPU *, BI); 241 1.1 christos BI crisv10f_h_vbit_move_pre_v32_get (SIM_CPU *); 242 1.1 christos void crisv10f_h_vbit_move_pre_v32_set (SIM_CPU *, BI); 243 1.1 christos BI crisv10f_h_zbit_get (SIM_CPU *); 244 1.1 christos void crisv10f_h_zbit_set (SIM_CPU *, BI); 245 1.1 christos BI crisv10f_h_zbit_move_get (SIM_CPU *); 246 1.1 christos void crisv10f_h_zbit_move_set (SIM_CPU *, BI); 247 1.1 christos BI crisv10f_h_zbit_move_pre_v32_get (SIM_CPU *); 248 1.1 christos void crisv10f_h_zbit_move_pre_v32_set (SIM_CPU *, BI); 249 1.1 christos BI crisv10f_h_nbit_get (SIM_CPU *); 250 1.1 christos void crisv10f_h_nbit_set (SIM_CPU *, BI); 251 1.1 christos BI crisv10f_h_nbit_move_get (SIM_CPU *); 252 1.1 christos void crisv10f_h_nbit_move_set (SIM_CPU *, BI); 253 1.1 christos BI crisv10f_h_nbit_move_pre_v32_get (SIM_CPU *); 254 1.1 christos void crisv10f_h_nbit_move_pre_v32_set (SIM_CPU *, BI); 255 1.1 christos BI crisv10f_h_xbit_get (SIM_CPU *); 256 1.1 christos void crisv10f_h_xbit_set (SIM_CPU *, BI); 257 1.1 christos BI crisv10f_h_ibit_get (SIM_CPU *); 258 1.1 christos void crisv10f_h_ibit_set (SIM_CPU *, BI); 259 1.1 christos BI crisv10f_h_ibit_pre_v32_get (SIM_CPU *); 260 1.1 christos void crisv10f_h_ibit_pre_v32_set (SIM_CPU *, BI); 261 1.1 christos BI crisv10f_h_pbit_get (SIM_CPU *); 262 1.1 christos void crisv10f_h_pbit_set (SIM_CPU *, BI); 263 1.1 christos BI crisv10f_h_ubit_get (SIM_CPU *); 264 1.1 christos void crisv10f_h_ubit_set (SIM_CPU *, BI); 265 1.1 christos BI crisv10f_h_ubit_pre_v32_get (SIM_CPU *); 266 1.1 christos void crisv10f_h_ubit_pre_v32_set (SIM_CPU *, BI); 267 1.1 christos BI crisv10f_h_insn_prefixed_p_get (SIM_CPU *); 268 1.1 christos void crisv10f_h_insn_prefixed_p_set (SIM_CPU *, BI); 269 1.1 christos BI crisv10f_h_insn_prefixed_p_pre_v32_get (SIM_CPU *); 270 1.1 christos void crisv10f_h_insn_prefixed_p_pre_v32_set (SIM_CPU *, BI); 271 1.1 christos SI crisv10f_h_prefixreg_pre_v32_get (SIM_CPU *); 272 1.1 christos void crisv10f_h_prefixreg_pre_v32_set (SIM_CPU *, SI); 273 1.1 christos 274 1.1 christos /* These must be hand-written. */ 275 1.1 christos extern CPUREG_FETCH_FN crisv10f_fetch_register; 276 1.1 christos extern CPUREG_STORE_FN crisv10f_store_register; 277 1.1 christos 278 1.1 christos typedef struct { 279 1.1 christos int empty; 280 1.1 christos } MODEL_CRISV10_DATA; 281 1.1 christos 282 1.1 christos /* Instruction argument buffer. */ 283 1.1 christos 284 1.1 christos union sem_fields { 285 1.1 christos struct { /* no operands */ 286 1.1 christos int empty; 287 1.1 christos } sfmt_empty; 288 1.1 christos struct { /* */ 289 1.1 christos UINT f_u4; 290 1.1 christos } sfmt_break; 291 1.1 christos struct { /* */ 292 1.1 christos UINT f_dstsrc; 293 1.1 christos } sfmt_setf; 294 1.1 christos struct { /* */ 295 1.1 christos IADDR i_o_word_pcrel; 296 1.1 christos UINT f_operand2; 297 1.1 christos } sfmt_bcc_w; 298 1.1 christos struct { /* */ 299 1.1 christos IADDR i_o_pcrel; 300 1.1 christos UINT f_operand2; 301 1.1 christos } sfmt_bcc_b; 302 1.1 christos struct { /* */ 303 1.1 christos UINT f_memmode; 304 1.1 christos unsigned char in_h_gr_SI_14; 305 1.1 christos unsigned char out_h_gr_SI_14; 306 1.1 christos } sfmt_move_m_spplus_p8; 307 1.1 christos struct { /* */ 308 1.1 christos INT f_s8; 309 1.1 christos UINT f_operand2; 310 1.1 christos unsigned char in_Rd; 311 1.1 christos } sfmt_addoq; 312 1.1 christos struct { /* */ 313 1.1 christos INT f_indir_pc__dword; 314 1.1 christos UINT f_operand2; 315 1.1 christos unsigned char out_Pd; 316 1.1 christos } sfmt_move_c_sprv10_p9; 317 1.1 christos struct { /* */ 318 1.1 christos INT f_indir_pc__word; 319 1.1 christos UINT f_operand2; 320 1.1 christos unsigned char out_Pd; 321 1.1 christos } sfmt_move_c_sprv10_p5; 322 1.1 christos struct { /* */ 323 1.1 christos INT f_s6; 324 1.1 christos UINT f_operand2; 325 1.1 christos unsigned char out_Rd; 326 1.1 christos } sfmt_moveq; 327 1.1 christos struct { /* */ 328 1.1 christos INT f_indir_pc__dword; 329 1.1 christos UINT f_operand2; 330 1.1 christos unsigned char in_Rd; 331 1.1 christos unsigned char out_Rd; 332 1.1 christos } sfmt_bound_cd; 333 1.1 christos struct { /* */ 334 1.1 christos INT f_indir_pc__word; 335 1.1 christos UINT f_operand2; 336 1.1 christos unsigned char in_Rd; 337 1.1 christos unsigned char out_Rd; 338 1.1 christos } sfmt_bound_cw; 339 1.1 christos struct { /* */ 340 1.1 christos INT f_indir_pc__byte; 341 1.1 christos UINT f_operand2; 342 1.1 christos unsigned char in_Rd; 343 1.1 christos unsigned char out_Rd; 344 1.1 christos } sfmt_bound_cb; 345 1.1 christos struct { /* */ 346 1.1 christos UINT f_operand2; 347 1.1 christos UINT f_u5; 348 1.1 christos unsigned char in_Rd; 349 1.1 christos unsigned char out_Rd; 350 1.1 christos } sfmt_asrq; 351 1.1 christos struct { /* */ 352 1.1 christos INT f_s6; 353 1.1 christos UINT f_operand2; 354 1.1 christos unsigned char in_Rd; 355 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rd; 356 1.1 christos } sfmt_andq; 357 1.1 christos struct { /* */ 358 1.1 christos INT f_indir_pc__dword; 359 1.1 christos UINT f_operand2; 360 1.1 christos unsigned char in_Rd; 361 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rd; 362 1.1 christos } sfmt_addcdr; 363 1.1 christos struct { /* */ 364 1.1 christos INT f_indir_pc__word; 365 1.1 christos UINT f_operand2; 366 1.1 christos unsigned char in_Rd; 367 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rd; 368 1.1 christos } sfmt_addcwr; 369 1.1 christos struct { /* */ 370 1.1 christos INT f_indir_pc__byte; 371 1.1 christos UINT f_operand2; 372 1.1 christos unsigned char in_Rd; 373 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rd; 374 1.1 christos } sfmt_addcbr; 375 1.1 christos struct { /* */ 376 1.1 christos UINT f_operand1; 377 1.1 christos UINT f_operand2; 378 1.1 christos unsigned char in_Ps; 379 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rs; 380 1.1 christos } sfmt_move_spr_rv10; 381 1.1 christos struct { /* */ 382 1.1 christos UINT f_operand2; 383 1.1 christos UINT f_u6; 384 1.1 christos unsigned char in_Rd; 385 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rd; 386 1.1 christos } sfmt_addq; 387 1.1 christos struct { /* */ 388 1.1 christos UINT f_operand1; 389 1.1 christos UINT f_operand2; 390 1.1 christos unsigned char in_Rd; 391 1.1 christos unsigned char in_Rs; 392 1.1 christos unsigned char out_h_gr_SI_index_of__INT_Rd; 393 1.1 christos } sfmt_add_b_r; 394 1.1 christos struct { /* */ 395 1.1 christos UINT f_operand1; 396 1.1 christos UINT f_operand2; 397 1.1 christos unsigned char in_Rd; 398 1.1 christos unsigned char in_Rs; 399 1.1 christos unsigned char out_Rd; 400 1.1 christos unsigned char out_h_sr_SI_7; 401 1.1 christos } sfmt_muls_b; 402 1.1 christos struct { /* */ 403 1.1 christos UINT f_memmode; 404 1.1 christos UINT f_operand1; 405 1.1 christos UINT f_operand2; 406 1.1 christos unsigned char in_Ps; 407 1.1 christos unsigned char in_Rs; 408 1.1 christos unsigned char out_Rs; 409 1.1 christos } sfmt_move_spr_mv10; 410 1.1 christos struct { /* */ 411 1.1 christos UINT f_memmode; 412 1.1 christos UINT f_operand1; 413 1.1 christos UINT f_operand2; 414 1.1 christos unsigned char in_Rs; 415 1.1 christos unsigned char out_Pd; 416 1.1 christos unsigned char out_Rs; 417 1.1 christos } sfmt_move_m_sprv10; 418 1.1 christos struct { /* */ 419 1.1 christos UINT f_memmode; 420 1.1 christos UINT f_operand1; 421 1.1 christos UINT f_operand2; 422 1.1 christos unsigned char in_Rd; 423 1.1 christos unsigned char in_Rs; 424 1.1 christos unsigned char out_Rd; 425 1.1 christos unsigned char out_Rs; 426 1.1 christos } sfmt_bound_m_b_m; 427 1.1 christos struct { /* */ 428 1.1 christos UINT f_memmode; 429 1.1 christos UINT f_operand1; 430 1.1 christos UINT f_operand2; 431 1.1 christos unsigned char in_Rd; 432 1.1 christos unsigned char in_Rs; 433 1.1 christos unsigned char out_Rs; 434 1.1 christos unsigned char out_h_gr_SI_if__SI_andif__DFLT_prefix_set_not__UINT_inc_index_of__INT_Rs_index_of__INT_Rd; 435 1.1 christos } sfmt_add_m_b_m; 436 1.1 christos struct { /* */ 437 1.1 christos UINT f_memmode; 438 1.1 christos UINT f_operand1; 439 1.1 christos UINT f_operand2; 440 1.1 christos unsigned char in_Rd; 441 1.1 christos unsigned char in_Rs; 442 1.1 christos unsigned char out_Rs; 443 1.1 christos unsigned char out_h_gr_SI_0; 444 1.1 christos unsigned char out_h_gr_SI_1; 445 1.1 christos unsigned char out_h_gr_SI_10; 446 1.1 christos unsigned char out_h_gr_SI_11; 447 1.1 christos unsigned char out_h_gr_SI_12; 448 1.1 christos unsigned char out_h_gr_SI_13; 449 1.1 christos unsigned char out_h_gr_SI_14; 450 1.1 christos unsigned char out_h_gr_SI_2; 451 1.1 christos unsigned char out_h_gr_SI_3; 452 1.1 christos unsigned char out_h_gr_SI_4; 453 1.1 christos unsigned char out_h_gr_SI_5; 454 1.1 christos unsigned char out_h_gr_SI_6; 455 1.1 christos unsigned char out_h_gr_SI_7; 456 1.1 christos unsigned char out_h_gr_SI_8; 457 1.1 christos unsigned char out_h_gr_SI_9; 458 1.1 christos } sfmt_movem_m_r; 459 1.1 christos struct { /* */ 460 1.1 christos UINT f_memmode; 461 1.1 christos UINT f_operand1; 462 1.1 christos UINT f_operand2; 463 1.1 christos unsigned char in_Rd; 464 1.1 christos unsigned char in_Rs; 465 1.1 christos unsigned char in_h_gr_SI_0; 466 1.1 christos unsigned char in_h_gr_SI_1; 467 1.1 christos unsigned char in_h_gr_SI_10; 468 1.1 christos unsigned char in_h_gr_SI_11; 469 1.1 christos unsigned char in_h_gr_SI_12; 470 1.1 christos unsigned char in_h_gr_SI_13; 471 1.1 christos unsigned char in_h_gr_SI_14; 472 1.1 christos unsigned char in_h_gr_SI_15; 473 1.1 christos unsigned char in_h_gr_SI_2; 474 1.1 christos unsigned char in_h_gr_SI_3; 475 1.1 christos unsigned char in_h_gr_SI_4; 476 1.1 christos unsigned char in_h_gr_SI_5; 477 1.1 christos unsigned char in_h_gr_SI_6; 478 1.1 christos unsigned char in_h_gr_SI_7; 479 1.1 christos unsigned char in_h_gr_SI_8; 480 1.1 christos unsigned char in_h_gr_SI_9; 481 1.1 christos unsigned char out_Rs; 482 1.1 christos } sfmt_movem_r_m; 483 1.1 christos #if WITH_SCACHE_PBB 484 1.1 christos /* Writeback handler. */ 485 1.1 christos struct { 486 1.1 christos /* Pointer to argbuf entry for insn whose results need writing back. */ 487 1.1 christos const struct argbuf *abuf; 488 1.1 christos } write; 489 1.1 christos /* x-before handler */ 490 1.1 christos struct { 491 1.1 christos /*const SCACHE *insns[MAX_PARALLEL_INSNS];*/ 492 1.1 christos int first_p; 493 1.1 christos } before; 494 1.1 christos /* x-after handler */ 495 1.1 christos struct { 496 1.1 christos int empty; 497 1.1 christos } after; 498 1.1 christos /* This entry is used to terminate each pbb. */ 499 1.1 christos struct { 500 1.1 christos /* Number of insns in pbb. */ 501 1.1 christos int insn_count; 502 1.1 christos /* Next pbb to execute. */ 503 1.1 christos SCACHE *next; 504 1.1 christos SCACHE *branch_target; 505 1.1 christos } chain; 506 1.1 christos #endif 507 1.1 christos }; 508 1.1 christos 509 1.1 christos /* The ARGBUF struct. */ 510 1.1 christos struct argbuf { 511 1.1 christos /* These are the baseclass definitions. */ 512 1.1 christos IADDR addr; 513 1.1 christos const IDESC *idesc; 514 1.1 christos char trace_p; 515 1.1 christos char profile_p; 516 1.1 christos /* ??? Temporary hack for skip insns. */ 517 1.1 christos char skip_count; 518 1.1 christos char unused; 519 1.1 christos /* cpu specific data follows */ 520 1.1 christos union sem semantic; 521 1.1 christos int written; 522 1.1 christos union sem_fields fields; 523 1.1 christos }; 524 1.1 christos 525 1.1 christos /* A cached insn. 526 1.1 christos 527 1.1 christos ??? SCACHE used to contain more than just argbuf. We could delete the 528 1.1 christos type entirely and always just use ARGBUF, but for future concerns and as 529 1.1 christos a level of abstraction it is left in. */ 530 1.1 christos 531 1.1 christos struct scache { 532 1.1 christos struct argbuf argbuf; 533 1.1 christos }; 534 1.1 christos 535 1.1 christos /* Macros to simplify extraction, reading and semantic code. 536 1.1 christos These define and assign the local vars that contain the insn's fields. */ 537 1.1 christos 538 1.1 christos #define EXTRACT_IFMT_EMPTY_VARS \ 539 1.1 christos unsigned int length; 540 1.1 christos #define EXTRACT_IFMT_EMPTY_CODE \ 541 1.1 christos length = 0; \ 542 1.1 christos 543 1.1 christos #define EXTRACT_IFMT_NOP_VARS \ 544 1.1 christos UINT f_operand2; \ 545 1.1 christos UINT f_mode; \ 546 1.1 christos UINT f_opcode; \ 547 1.1 christos UINT f_size; \ 548 1.1 christos UINT f_operand1; \ 549 1.1 christos unsigned int length; 550 1.1 christos #define EXTRACT_IFMT_NOP_CODE \ 551 1.1 christos length = 2; \ 552 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 553 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 554 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 555 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 556 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 557 1.1 christos 558 1.1 christos #define EXTRACT_IFMT_MOVE_B_R_VARS \ 559 1.1 christos UINT f_operand2; \ 560 1.1 christos UINT f_mode; \ 561 1.1 christos UINT f_opcode; \ 562 1.1 christos UINT f_size; \ 563 1.1 christos UINT f_operand1; \ 564 1.1 christos unsigned int length; 565 1.1 christos #define EXTRACT_IFMT_MOVE_B_R_CODE \ 566 1.1 christos length = 2; \ 567 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 568 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 569 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 570 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 571 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 572 1.1 christos 573 1.1 christos #define EXTRACT_IFMT_MOVEPCR_VARS \ 574 1.1 christos UINT f_operand2; \ 575 1.1 christos UINT f_mode; \ 576 1.1 christos UINT f_opcode; \ 577 1.1 christos UINT f_size; \ 578 1.1 christos UINT f_operand1; \ 579 1.1 christos unsigned int length; 580 1.1 christos #define EXTRACT_IFMT_MOVEPCR_CODE \ 581 1.1 christos length = 2; \ 582 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 583 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 584 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 585 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 586 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 587 1.1 christos 588 1.1 christos #define EXTRACT_IFMT_MOVEQ_VARS \ 589 1.1 christos UINT f_operand2; \ 590 1.1 christos UINT f_mode; \ 591 1.1 christos UINT f_opcode; \ 592 1.1 christos INT f_s6; \ 593 1.1 christos unsigned int length; 594 1.1 christos #define EXTRACT_IFMT_MOVEQ_CODE \ 595 1.1 christos length = 2; \ 596 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 597 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 598 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 599 1.1 christos f_s6 = EXTRACT_LSB0_SINT (insn, 16, 5, 6); \ 600 1.1 christos 601 1.1 christos #define EXTRACT_IFMT_MOVECBR_VARS \ 602 1.1 christos UINT f_operand2; \ 603 1.1 christos INT f_indir_pc__byte; \ 604 1.1 christos UINT f_mode; \ 605 1.1 christos UINT f_opcode; \ 606 1.1 christos UINT f_size; \ 607 1.1 christos UINT f_operand1; \ 608 1.1 christos /* Contents of trailing part of insn. */ \ 609 1.1 christos UINT word_1; \ 610 1.1 christos unsigned int length; 611 1.1 christos #define EXTRACT_IFMT_MOVECBR_CODE \ 612 1.1 christos length = 4; \ 613 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 614 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 615 1.1 christos f_indir_pc__byte = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \ 616 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 617 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 618 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 619 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 620 1.1 christos 621 1.1 christos #define EXTRACT_IFMT_MOVECWR_VARS \ 622 1.1 christos UINT f_operand2; \ 623 1.1 christos INT f_indir_pc__word; \ 624 1.1 christos UINT f_mode; \ 625 1.1 christos UINT f_opcode; \ 626 1.1 christos UINT f_size; \ 627 1.1 christos UINT f_operand1; \ 628 1.1 christos /* Contents of trailing part of insn. */ \ 629 1.1 christos UINT word_1; \ 630 1.1 christos unsigned int length; 631 1.1 christos #define EXTRACT_IFMT_MOVECWR_CODE \ 632 1.1 christos length = 4; \ 633 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 634 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 635 1.1 christos f_indir_pc__word = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \ 636 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 637 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 638 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 639 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 640 1.1 christos 641 1.1 christos #define EXTRACT_IFMT_MOVECDR_VARS \ 642 1.1 christos INT f_indir_pc__dword; \ 643 1.1 christos UINT f_operand2; \ 644 1.1 christos UINT f_mode; \ 645 1.1 christos UINT f_opcode; \ 646 1.1 christos UINT f_size; \ 647 1.1 christos UINT f_operand1; \ 648 1.1 christos /* Contents of trailing part of insn. */ \ 649 1.1 christos UINT word_1; \ 650 1.1 christos unsigned int length; 651 1.1 christos #define EXTRACT_IFMT_MOVECDR_CODE \ 652 1.1 christos length = 6; \ 653 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 654 1.1 christos f_indir_pc__dword = (0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)); \ 655 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 656 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 657 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 658 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 659 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 660 1.1 christos 661 1.1 christos #define EXTRACT_IFMT_MOVUCBR_VARS \ 662 1.1 christos UINT f_operand2; \ 663 1.1 christos INT f_indir_pc__byte; \ 664 1.1 christos UINT f_mode; \ 665 1.1 christos UINT f_opcode; \ 666 1.1 christos UINT f_size; \ 667 1.1 christos UINT f_operand1; \ 668 1.1 christos /* Contents of trailing part of insn. */ \ 669 1.1 christos UINT word_1; \ 670 1.1 christos unsigned int length; 671 1.1 christos #define EXTRACT_IFMT_MOVUCBR_CODE \ 672 1.1 christos length = 4; \ 673 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 674 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 675 1.1 christos f_indir_pc__byte = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \ 676 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 677 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 678 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 679 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 680 1.1 christos 681 1.1 christos #define EXTRACT_IFMT_MOVUCWR_VARS \ 682 1.1 christos UINT f_operand2; \ 683 1.1 christos INT f_indir_pc__word; \ 684 1.1 christos UINT f_mode; \ 685 1.1 christos UINT f_opcode; \ 686 1.1 christos UINT f_size; \ 687 1.1 christos UINT f_operand1; \ 688 1.1 christos /* Contents of trailing part of insn. */ \ 689 1.1 christos UINT word_1; \ 690 1.1 christos unsigned int length; 691 1.1 christos #define EXTRACT_IFMT_MOVUCWR_CODE \ 692 1.1 christos length = 4; \ 693 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 694 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 695 1.1 christos f_indir_pc__word = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \ 696 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 697 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 698 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 699 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 700 1.1 christos 701 1.1 christos #define EXTRACT_IFMT_ADDQ_VARS \ 702 1.1 christos UINT f_operand2; \ 703 1.1 christos UINT f_mode; \ 704 1.1 christos UINT f_opcode; \ 705 1.1 christos UINT f_u6; \ 706 1.1 christos unsigned int length; 707 1.1 christos #define EXTRACT_IFMT_ADDQ_CODE \ 708 1.1 christos length = 2; \ 709 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 710 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 711 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 712 1.1 christos f_u6 = EXTRACT_LSB0_UINT (insn, 16, 5, 6); \ 713 1.1 christos 714 1.1 christos #define EXTRACT_IFMT_CMP_M_B_M_VARS \ 715 1.1 christos UINT f_operand2; \ 716 1.1 christos UINT f_membit; \ 717 1.1 christos UINT f_memmode; \ 718 1.1 christos UINT f_opcode; \ 719 1.1 christos UINT f_size; \ 720 1.1 christos UINT f_operand1; \ 721 1.1 christos unsigned int length; 722 1.1 christos #define EXTRACT_IFMT_CMP_M_B_M_CODE \ 723 1.1 christos length = 2; \ 724 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 725 1.1 christos f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \ 726 1.1 christos f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \ 727 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 728 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 729 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 730 1.1 christos 731 1.1 christos #define EXTRACT_IFMT_MOVE_R_SPRV10_VARS \ 732 1.1 christos UINT f_operand2; \ 733 1.1 christos UINT f_mode; \ 734 1.1 christos UINT f_opcode; \ 735 1.1 christos UINT f_size; \ 736 1.1 christos UINT f_operand1; \ 737 1.1 christos unsigned int length; 738 1.1 christos #define EXTRACT_IFMT_MOVE_R_SPRV10_CODE \ 739 1.1 christos length = 2; \ 740 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 741 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 742 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 743 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 744 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 745 1.1 christos 746 1.1 christos #define EXTRACT_IFMT_MOVE_SPR_RV10_VARS \ 747 1.1 christos UINT f_operand2; \ 748 1.1 christos UINT f_mode; \ 749 1.1 christos UINT f_opcode; \ 750 1.1 christos UINT f_size; \ 751 1.1 christos UINT f_operand1; \ 752 1.1 christos unsigned int length; 753 1.1 christos #define EXTRACT_IFMT_MOVE_SPR_RV10_CODE \ 754 1.1 christos length = 2; \ 755 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 756 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 757 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 758 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 759 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 760 1.1 christos 761 1.1 christos #define EXTRACT_IFMT_RET_TYPE_VARS \ 762 1.1 christos UINT f_operand2; \ 763 1.1 christos UINT f_mode; \ 764 1.1 christos UINT f_opcode; \ 765 1.1 christos UINT f_size; \ 766 1.1 christos UINT f_operand1; \ 767 1.1 christos unsigned int length; 768 1.1 christos #define EXTRACT_IFMT_RET_TYPE_CODE \ 769 1.1 christos length = 2; \ 770 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 771 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 772 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 773 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 774 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 775 1.1 christos 776 1.1 christos #define EXTRACT_IFMT_MOVE_M_SPRV10_VARS \ 777 1.1 christos UINT f_operand2; \ 778 1.1 christos UINT f_membit; \ 779 1.1 christos UINT f_memmode; \ 780 1.1 christos UINT f_opcode; \ 781 1.1 christos UINT f_size; \ 782 1.1 christos UINT f_operand1; \ 783 1.1 christos unsigned int length; 784 1.1 christos #define EXTRACT_IFMT_MOVE_M_SPRV10_CODE \ 785 1.1 christos length = 2; \ 786 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 787 1.1 christos f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \ 788 1.1 christos f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \ 789 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 790 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 791 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 792 1.1 christos 793 1.1 christos #define EXTRACT_IFMT_MOVE_C_SPRV10_P5_VARS \ 794 1.1 christos UINT f_operand2; \ 795 1.1 christos INT f_indir_pc__word; \ 796 1.1 christos UINT f_mode; \ 797 1.1 christos UINT f_opcode; \ 798 1.1 christos UINT f_size; \ 799 1.1 christos UINT f_operand1; \ 800 1.1 christos /* Contents of trailing part of insn. */ \ 801 1.1 christos UINT word_1; \ 802 1.1 christos unsigned int length; 803 1.1 christos #define EXTRACT_IFMT_MOVE_C_SPRV10_P5_CODE \ 804 1.1 christos length = 4; \ 805 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 806 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 807 1.1 christos f_indir_pc__word = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \ 808 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 809 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 810 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 811 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 812 1.1 christos 813 1.1 christos #define EXTRACT_IFMT_MOVE_C_SPRV10_P9_VARS \ 814 1.1 christos INT f_indir_pc__dword; \ 815 1.1 christos UINT f_operand2; \ 816 1.1 christos UINT f_mode; \ 817 1.1 christos UINT f_opcode; \ 818 1.1 christos UINT f_size; \ 819 1.1 christos UINT f_operand1; \ 820 1.1 christos /* Contents of trailing part of insn. */ \ 821 1.1 christos UINT word_1; \ 822 1.1 christos unsigned int length; 823 1.1 christos #define EXTRACT_IFMT_MOVE_C_SPRV10_P9_CODE \ 824 1.1 christos length = 6; \ 825 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 826 1.1 christos f_indir_pc__dword = (0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)); \ 827 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 828 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 829 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 830 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 831 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 832 1.1 christos 833 1.1 christos #define EXTRACT_IFMT_MOVE_SPR_MV10_VARS \ 834 1.1 christos UINT f_operand2; \ 835 1.1 christos UINT f_membit; \ 836 1.1 christos UINT f_memmode; \ 837 1.1 christos UINT f_opcode; \ 838 1.1 christos UINT f_size; \ 839 1.1 christos UINT f_operand1; \ 840 1.1 christos unsigned int length; 841 1.1 christos #define EXTRACT_IFMT_MOVE_SPR_MV10_CODE \ 842 1.1 christos length = 2; \ 843 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 844 1.1 christos f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \ 845 1.1 christos f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \ 846 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 847 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 848 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 849 1.1 christos 850 1.1 christos #define EXTRACT_IFMT_SBFS_VARS \ 851 1.1 christos UINT f_operand2; \ 852 1.1 christos UINT f_membit; \ 853 1.1 christos UINT f_memmode; \ 854 1.1 christos UINT f_opcode; \ 855 1.1 christos UINT f_size; \ 856 1.1 christos UINT f_operand1; \ 857 1.1 christos unsigned int length; 858 1.1 christos #define EXTRACT_IFMT_SBFS_CODE \ 859 1.1 christos length = 2; \ 860 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 861 1.1 christos f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \ 862 1.1 christos f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \ 863 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 864 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 865 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 866 1.1 christos 867 1.1 christos #define EXTRACT_IFMT_SWAP_VARS \ 868 1.1 christos UINT f_operand2; \ 869 1.1 christos UINT f_mode; \ 870 1.1 christos UINT f_opcode; \ 871 1.1 christos UINT f_size; \ 872 1.1 christos UINT f_operand1; \ 873 1.1 christos unsigned int length; 874 1.1 christos #define EXTRACT_IFMT_SWAP_CODE \ 875 1.1 christos length = 2; \ 876 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 877 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 878 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 879 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 880 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 881 1.1 christos 882 1.1 christos #define EXTRACT_IFMT_ASRQ_VARS \ 883 1.1 christos UINT f_operand2; \ 884 1.1 christos UINT f_mode; \ 885 1.1 christos UINT f_opcode; \ 886 1.1 christos UINT f_b5; \ 887 1.1 christos UINT f_u5; \ 888 1.1 christos unsigned int length; 889 1.1 christos #define EXTRACT_IFMT_ASRQ_CODE \ 890 1.1 christos length = 2; \ 891 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 892 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 893 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 894 1.1 christos f_b5 = EXTRACT_LSB0_UINT (insn, 16, 5, 1); \ 895 1.1 christos f_u5 = EXTRACT_LSB0_UINT (insn, 16, 4, 5); \ 896 1.1 christos 897 1.1 christos #define EXTRACT_IFMT_SETF_VARS \ 898 1.1 christos UINT f_mode; \ 899 1.1 christos UINT f_opcode; \ 900 1.1 christos UINT f_size; \ 901 1.1 christos UINT f_operand2; \ 902 1.1 christos UINT f_operand1; \ 903 1.1 christos UINT f_dstsrc; \ 904 1.1 christos unsigned int length; 905 1.1 christos #define EXTRACT_IFMT_SETF_CODE \ 906 1.1 christos length = 2; \ 907 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 908 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 909 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 910 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 911 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 912 1.1 christos f_dstsrc = ((((f_operand1) | (((f_operand2) << (4))))) & (255));\ 913 1.1 christos 914 1.1 christos #define EXTRACT_IFMT_BCC_B_VARS \ 915 1.1 christos UINT f_operand2; \ 916 1.1 christos UINT f_mode; \ 917 1.1 christos UINT f_opcode_hi; \ 918 1.1 christos INT f_disp9_hi; \ 919 1.1 christos UINT f_disp9_lo; \ 920 1.1 christos INT f_disp9; \ 921 1.1 christos unsigned int length; 922 1.1 christos #define EXTRACT_IFMT_BCC_B_CODE \ 923 1.1 christos length = 2; \ 924 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 925 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 926 1.1 christos f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \ 927 1.1 christos f_disp9_hi = EXTRACT_LSB0_SINT (insn, 16, 0, 1); \ 928 1.1 christos f_disp9_lo = EXTRACT_LSB0_UINT (insn, 16, 7, 7); \ 929 1.1 christos {\ 930 1.1 christos SI tmp_abslo;\ 931 1.1 christos SI tmp_absval;\ 932 1.1 christos tmp_abslo = ((f_disp9_lo) << (1));\ 933 1.1 christos tmp_absval = ((((((f_disp9_hi) != (0))) ? ((~ (255))) : (0))) | (tmp_abslo));\ 934 1.1 christos f_disp9 = ((((pc) + (tmp_absval))) + (((GET_H_V32_NON_V32 ()) ? (0) : (2))));\ 935 1.1 christos }\ 936 1.1 christos 937 1.1 christos #define EXTRACT_IFMT_BA_B_VARS \ 938 1.1 christos UINT f_operand2; \ 939 1.1 christos UINT f_mode; \ 940 1.1 christos UINT f_opcode_hi; \ 941 1.1 christos INT f_disp9_hi; \ 942 1.1 christos UINT f_disp9_lo; \ 943 1.1 christos INT f_disp9; \ 944 1.1 christos unsigned int length; 945 1.1 christos #define EXTRACT_IFMT_BA_B_CODE \ 946 1.1 christos length = 2; \ 947 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 948 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 949 1.1 christos f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \ 950 1.1 christos f_disp9_hi = EXTRACT_LSB0_SINT (insn, 16, 0, 1); \ 951 1.1 christos f_disp9_lo = EXTRACT_LSB0_UINT (insn, 16, 7, 7); \ 952 1.1 christos {\ 953 1.1 christos SI tmp_abslo;\ 954 1.1 christos SI tmp_absval;\ 955 1.1 christos tmp_abslo = ((f_disp9_lo) << (1));\ 956 1.1 christos tmp_absval = ((((((f_disp9_hi) != (0))) ? ((~ (255))) : (0))) | (tmp_abslo));\ 957 1.1 christos f_disp9 = ((((pc) + (tmp_absval))) + (((GET_H_V32_NON_V32 ()) ? (0) : (2))));\ 958 1.1 christos }\ 959 1.1 christos 960 1.1 christos #define EXTRACT_IFMT_BCC_W_VARS \ 961 1.1 christos UINT f_operand2; \ 962 1.1 christos SI f_indir_pc__word_pcrel; \ 963 1.1 christos UINT f_mode; \ 964 1.1 christos UINT f_opcode; \ 965 1.1 christos UINT f_size; \ 966 1.1 christos UINT f_operand1; \ 967 1.1 christos /* Contents of trailing part of insn. */ \ 968 1.1 christos UINT word_1; \ 969 1.1 christos unsigned int length; 970 1.1 christos #define EXTRACT_IFMT_BCC_W_CODE \ 971 1.1 christos length = 4; \ 972 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 973 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 974 1.1 christos f_indir_pc__word_pcrel = ((EXTHISI (((HI) (UINT) ((0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)))))) + (((pc) + (((GET_H_V32_NON_V32 ()) ? (0) : (4)))))); \ 975 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 976 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 977 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 978 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 979 1.1 christos 980 1.1 christos #define EXTRACT_IFMT_BA_W_VARS \ 981 1.1 christos UINT f_operand2; \ 982 1.1 christos SI f_indir_pc__word_pcrel; \ 983 1.1 christos UINT f_mode; \ 984 1.1 christos UINT f_opcode; \ 985 1.1 christos UINT f_size; \ 986 1.1 christos UINT f_operand1; \ 987 1.1 christos /* Contents of trailing part of insn. */ \ 988 1.1 christos UINT word_1; \ 989 1.1 christos unsigned int length; 990 1.1 christos #define EXTRACT_IFMT_BA_W_CODE \ 991 1.1 christos length = 4; \ 992 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 993 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 994 1.1 christos f_indir_pc__word_pcrel = ((EXTHISI (((HI) (UINT) ((0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)))))) + (((pc) + (((GET_H_V32_NON_V32 ()) ? (0) : (4)))))); \ 995 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 996 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 997 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 998 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 999 1.1 christos 1000 1.1 christos #define EXTRACT_IFMT_JUMP_C_VARS \ 1001 1.1 christos INT f_indir_pc__dword; \ 1002 1.1 christos UINT f_operand2; \ 1003 1.1 christos UINT f_mode; \ 1004 1.1 christos UINT f_opcode; \ 1005 1.1 christos UINT f_size; \ 1006 1.1 christos UINT f_operand1; \ 1007 1.1 christos /* Contents of trailing part of insn. */ \ 1008 1.1 christos UINT word_1; \ 1009 1.1 christos unsigned int length; 1010 1.1 christos #define EXTRACT_IFMT_JUMP_C_CODE \ 1011 1.1 christos length = 6; \ 1012 1.1 christos word_1 = GETIMEMUSI (current_cpu, pc + 2); \ 1013 1.1 christos f_indir_pc__dword = (0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)); \ 1014 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 1015 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 1016 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 1017 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 1018 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 1019 1.1 christos 1020 1.1 christos #define EXTRACT_IFMT_BREAK_VARS \ 1021 1.1 christos UINT f_operand2; \ 1022 1.1 christos UINT f_mode; \ 1023 1.1 christos UINT f_opcode; \ 1024 1.1 christos UINT f_size; \ 1025 1.1 christos UINT f_u4; \ 1026 1.1 christos unsigned int length; 1027 1.1 christos #define EXTRACT_IFMT_BREAK_CODE \ 1028 1.1 christos length = 2; \ 1029 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 1030 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 1031 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 1032 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 1033 1.1 christos f_u4 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 1034 1.1 christos 1035 1.1 christos #define EXTRACT_IFMT_SCC_VARS \ 1036 1.1 christos UINT f_operand2; \ 1037 1.1 christos UINT f_mode; \ 1038 1.1 christos UINT f_opcode; \ 1039 1.1 christos UINT f_size; \ 1040 1.1 christos UINT f_operand1; \ 1041 1.1 christos unsigned int length; 1042 1.1 christos #define EXTRACT_IFMT_SCC_CODE \ 1043 1.1 christos length = 2; \ 1044 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 1045 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 1046 1.1 christos f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \ 1047 1.1 christos f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \ 1048 1.1 christos f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \ 1049 1.1 christos 1050 1.1 christos #define EXTRACT_IFMT_ADDOQ_VARS \ 1051 1.1 christos UINT f_operand2; \ 1052 1.1 christos UINT f_mode; \ 1053 1.1 christos UINT f_opcode_hi; \ 1054 1.1 christos INT f_s8; \ 1055 1.1 christos unsigned int length; 1056 1.1 christos #define EXTRACT_IFMT_ADDOQ_CODE \ 1057 1.1 christos length = 2; \ 1058 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 1059 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 1060 1.1 christos f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \ 1061 1.1 christos f_s8 = EXTRACT_LSB0_SINT (insn, 16, 7, 8); \ 1062 1.1 christos 1063 1.1 christos #define EXTRACT_IFMT_BDAPQPC_VARS \ 1064 1.1 christos UINT f_operand2; \ 1065 1.1 christos UINT f_mode; \ 1066 1.1 christos UINT f_opcode_hi; \ 1067 1.1 christos INT f_s8; \ 1068 1.1 christos unsigned int length; 1069 1.1 christos #define EXTRACT_IFMT_BDAPQPC_CODE \ 1070 1.1 christos length = 2; \ 1071 1.1 christos f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \ 1072 1.1 christos f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \ 1073 1.1 christos f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \ 1074 1.1 christos f_s8 = EXTRACT_LSB0_SINT (insn, 16, 7, 8); \ 1075 1.1 christos 1076 1.1 christos /* Collection of various things for the trace handler to use. */ 1077 1.1 christos 1078 1.1 christos typedef struct trace_record { 1079 1.1 christos IADDR pc; 1080 1.1 christos /* FIXME:wip */ 1081 1.1 christos } TRACE_RECORD; 1082 1.1 christos 1083 1.1 christos #endif /* CPU_CRISV10F_H */ 1084