Home | History | Annotate | Line # | Download | only in cris
      1       1.1  christos /* CPU family header for crisv32f.
      2       1.1  christos 
      3       1.1  christos THIS FILE IS MACHINE GENERATED WITH CGEN.
      4       1.1  christos 
      5  1.1.1.10  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.1.1.10  christos    with this program; if not, write to the Free Software Foundation, Inc.,
     21  1.1.1.10  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_CRISV32F_H
     26       1.1  christos #define CPU_CRISV32F_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_acr[16];
     54       1.1  christos #define GET_H_GR_ACR(a1) CPU (h_gr_acr)[a1]
     55       1.1  christos #define SET_H_GR_ACR(a1, x) (CPU (h_gr_acr)[a1] = (x))
     56       1.1  christos   /* Special registers for v32 */
     57       1.1  christos   SI h_sr_v32[16];
     58       1.1  christos #define GET_H_SR_V32(index) (ORIF (ORIF (((index) == (((UINT) 0))), ((index) == (((UINT) 4)))), ((index) == (((UINT) 8))))) ? (0) : (((index) == (((UINT) 1)))) ? (32) : (((index) == (((UINT) 13)))) ? (ORSI (ANDSI (CPU (h_sr_v32[((UINT) 13)]), 1073740800), 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), ORSI (SLLSI (ZEXTBISI (CPU (h_rbit)), 8), ORSI (SLLSI (ZEXTBISI (CPU (h_sbit)), 9), ORSI (SLLSI (ZEXTBISI (CPU (h_mbit)), 30), ORSI (SLLSI (ZEXTBISI (CPU (h_qbit)), 31), 0)))))))))))))) : (((index) == (((UINT) 14)))) ? (((GET_H_UBIT ()) ? (CPU (h_gr_acr[((UINT) 14)])) : (CPU (h_sr_v32[((UINT) 14)])))) : (CPU (h_sr_v32[index]))
     59       1.1  christos #define SET_H_SR_V32(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 ((((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_SBIT (((NESI (ANDSI ((x), ((1) << (9))), 0)) ? (1) : (0)));\
     73       1.1  christos SET_H_MBIT (((NESI (ANDSI ((x), ((1) << (30))), 0)) ? (1) : (0)));\
     74       1.1  christos CPU (h_pbit) = ((NESI (ANDSI ((x), ((1) << (7))), 0)) ? (1) : (0));\
     75       1.1  christos CPU (h_rbit) = ((NESI (ANDSI ((x), ((1) << (8))), 0)) ? (1) : (0));\
     76       1.1  christos SET_H_QBIT (((NESI (ANDSI ((x), ((1) << (31))), 0)) ? (1) : (0)));\
     77       1.1  christos SET_H_UBIT (((NESI (ANDSI ((x), ((1) << (6))), 0)) ? (1) : (0)));\
     78       1.1  christos CPU (h_sr_v32[(index)]) = (x);\
     79       1.1  christos }\
     80       1.1  christos }\
     81       1.1  christos  else if ((((index)) == (((UINT) 14)))) {\
     82       1.1  christos {\
     83       1.1  christos if (GET_H_UBIT ()) {\
     84       1.1  christos CPU (h_gr_acr[((UINT) 14)]) = (x);\
     85       1.1  christos }\
     86       1.1  christos CPU (h_sr_v32[((UINT) 14)]) = (x);\
     87       1.1  christos }\
     88       1.1  christos }\
     89       1.1  christos  else if ((((index)) == (((UINT) 3)))) {\
     90       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
     91       1.1  christos CPU (h_sr_v32[((UINT) 3)]) = (x);\
     92       1.1  christos }\
     93       1.1  christos }\
     94       1.1  christos  else if ((((index)) == (((UINT) 9)))) {\
     95       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
     96       1.1  christos CPU (h_sr_v32[((UINT) 9)]) = (x);\
     97       1.1  christos }\
     98       1.1  christos }\
     99       1.1  christos  else if ((((index)) == (((UINT) 2)))) {\
    100       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
    101       1.1  christos {\
    102       1.1  christos crisv32f_write_pid_handler (current_cpu, (x));\
    103       1.1  christos CPU (h_sr_v32[((UINT) 2)]) = (x);\
    104       1.1  christos }\
    105       1.1  christos }\
    106       1.1  christos }\
    107       1.1  christos  else if ((((index)) == (((UINT) 15)))) {\
    108       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
    109       1.1  christos CPU (h_sr_v32[((UINT) 15)]) = (x);\
    110       1.1  christos }\
    111       1.1  christos }\
    112       1.1  christos  else {\
    113       1.1  christos CPU (h_sr_v32[(index)]) = (x);\
    114       1.1  christos }\
    115       1.1  christos ;} while (0)
    116       1.1  christos   /* carry bit */
    117       1.1  christos   BI h_cbit;
    118       1.1  christos #define GET_H_CBIT() CPU (h_cbit)
    119       1.1  christos #define SET_H_CBIT(x) (CPU (h_cbit) = (x))
    120       1.1  christos   /* overflow bit */
    121       1.1  christos   BI h_vbit;
    122       1.1  christos #define GET_H_VBIT() CPU (h_vbit)
    123       1.1  christos #define SET_H_VBIT(x) (CPU (h_vbit) = (x))
    124       1.1  christos   /* zero bit */
    125       1.1  christos   BI h_zbit;
    126       1.1  christos #define GET_H_ZBIT() CPU (h_zbit)
    127       1.1  christos #define SET_H_ZBIT(x) (CPU (h_zbit) = (x))
    128       1.1  christos   /* sign bit */
    129       1.1  christos   BI h_nbit;
    130       1.1  christos #define GET_H_NBIT() CPU (h_nbit)
    131       1.1  christos #define SET_H_NBIT(x) (CPU (h_nbit) = (x))
    132       1.1  christos   /* extended-arithmetic bit */
    133       1.1  christos   BI h_xbit;
    134       1.1  christos #define GET_H_XBIT() CPU (h_xbit)
    135       1.1  christos #define SET_H_XBIT(x) (CPU (h_xbit) = (x))
    136       1.1  christos   /* sequence-broken bit */
    137       1.1  christos   BI h_pbit;
    138       1.1  christos #define GET_H_PBIT() CPU (h_pbit)
    139       1.1  christos #define SET_H_PBIT(x) (CPU (h_pbit) = (x))
    140       1.1  christos   /* carry bit for MCP+restore-p bit */
    141       1.1  christos   BI h_rbit;
    142       1.1  christos #define GET_H_RBIT() CPU (h_rbit)
    143       1.1  christos #define SET_H_RBIT(x) (CPU (h_rbit) = (x))
    144       1.1  christos   /* guru mode bit */
    145       1.1  christos   BI h_gbit;
    146       1.1  christos #define GET_H_GBIT() CPU (h_gbit)
    147       1.1  christos #define SET_H_GBIT(x) (CPU (h_gbit) = (x))
    148       1.1  christos   /* Kernel stack pointer during user mode */
    149       1.1  christos   SI h_kernel_sp;
    150       1.1  christos #define GET_H_KERNEL_SP() CPU (h_kernel_sp)
    151       1.1  christos #define SET_H_KERNEL_SP(x) (CPU (h_kernel_sp) = (x))
    152       1.1  christos   /* User mode bit */
    153       1.1  christos   BI h_ubit_v32;
    154       1.1  christos #define GET_H_UBIT_V32() CPU (h_ubit_v32)
    155       1.1  christos #define SET_H_UBIT_V32(x) \
    156       1.1  christos do { \
    157       1.1  christos {\
    158       1.1  christos if (ANDIF ((x), NOTBI (CPU (h_ubit_v32)))) {\
    159       1.1  christos {\
    160       1.1  christos CPU (h_kernel_sp) = CPU (h_gr_acr[((UINT) 14)]);\
    161       1.1  christos CPU (h_gr_acr[((UINT) 14)]) = CPU (h_sr_v32[((UINT) 14)]);\
    162       1.1  christos CPU (h_ubit_v32) = (x);\
    163       1.1  christos crisv32f_usermode_enabled (current_cpu);\
    164       1.1  christos }\
    165       1.1  christos }\
    166       1.1  christos }\
    167       1.1  christos ;} while (0)
    168       1.1  christos   /* Interrupt-enable bit */
    169       1.1  christos   BI h_ibit_v32;
    170       1.1  christos #define GET_H_IBIT_V32() CPU (h_ibit_v32)
    171       1.1  christos #define SET_H_IBIT_V32(x) \
    172       1.1  christos do { \
    173       1.1  christos {\
    174       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
    175       1.1  christos {\
    176       1.1  christos   BI tmp_enabled;\
    177       1.1  christos   tmp_enabled = ANDIF ((x), NOTBI (CPU (h_ibit_v32)));\
    178       1.1  christos CPU (h_ibit_v32) = (x);\
    179       1.1  christos if (tmp_enabled) {\
    180       1.1  christos crisv32f_interrupts_enabled (current_cpu);\
    181       1.1  christos }\
    182       1.1  christos }\
    183       1.1  christos }\
    184       1.1  christos }\
    185       1.1  christos ;} while (0)
    186       1.1  christos   /* NMI enable bit */
    187       1.1  christos   BI h_mbit;
    188       1.1  christos #define GET_H_MBIT() CPU (h_mbit)
    189       1.1  christos #define SET_H_MBIT(x) \
    190       1.1  christos do { \
    191       1.1  christos {\
    192       1.1  christos if (ANDIF ((x), ANDIF (NOTBI (CPU (h_mbit)), NOTBI (GET_H_UBIT ())))) {\
    193       1.1  christos {\
    194       1.1  christos CPU (h_mbit) = 1;\
    195       1.1  christos crisv32f_nmi_enabled (current_cpu);\
    196       1.1  christos }\
    197       1.1  christos }\
    198       1.1  christos }\
    199       1.1  christos ;} while (0)
    200       1.1  christos   /* Pending single-step bit */
    201       1.1  christos   BI h_qbit;
    202       1.1  christos #define GET_H_QBIT() CPU (h_qbit)
    203       1.1  christos #define SET_H_QBIT(x) \
    204       1.1  christos do { \
    205       1.1  christos {\
    206       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
    207       1.1  christos CPU (h_qbit) = (x);\
    208       1.1  christos }\
    209       1.1  christos }\
    210       1.1  christos ;} while (0)
    211       1.1  christos   /* Cause single step exception on ... [see CRISv32 ref] bit */
    212       1.1  christos   BI h_sbit;
    213       1.1  christos #define GET_H_SBIT() CPU (h_sbit)
    214       1.1  christos #define SET_H_SBIT(x) \
    215       1.1  christos do { \
    216       1.1  christos {\
    217       1.1  christos if (NOTBI (GET_H_UBIT ())) {\
    218       1.1  christos {\
    219       1.1  christos   BI tmp_enabled;\
    220       1.1  christos   tmp_enabled = ANDIF ((x), NOTBI (CPU (h_sbit)));\
    221       1.1  christos CPU (h_sbit) = (x);\
    222       1.1  christos if (tmp_enabled) {\
    223       1.1  christos crisv32f_single_step_enabled (current_cpu);\
    224       1.1  christos }\
    225       1.1  christos }\
    226       1.1  christos }\
    227       1.1  christos }\
    228       1.1  christos ;} while (0)
    229       1.1  christos   } hardware;
    230  1.1.1.10  christos #define CPU_CGEN_HW(cpu) (& CRIS_SIM_CPU (cpu)->cpu_data.hardware)
    231       1.1  christos } CRISV32F_CPU_DATA;
    232       1.1  christos 
    233       1.1  christos /* Virtual regs.  */
    234       1.1  christos 
    235       1.1  christos #define GET_H_V32_V32() 1
    236       1.1  christos #define SET_H_V32_V32(x) \
    237       1.1  christos do { \
    238       1.1  christos cgen_rtx_error (current_cpu, "Can't set h-v32");\
    239       1.1  christos ;} while (0)
    240       1.1  christos #define GET_H_GR(index) CPU (h_gr_acr[index])
    241       1.1  christos #define SET_H_GR(index, x) \
    242       1.1  christos do { \
    243       1.1  christos CPU (h_gr_acr[(index)]) = (x);\
    244       1.1  christos ;} while (0)
    245       1.1  christos #define GET_H_RAW_GR_ACR(index) CPU (h_gr_acr[index])
    246       1.1  christos #define SET_H_RAW_GR_ACR(index, x) \
    247       1.1  christos do { \
    248       1.1  christos CPU (h_gr_acr[(index)]) = (x);\
    249       1.1  christos ;} while (0)
    250       1.1  christos #define GET_H_SR(index) GET_H_SR_V32 (index)
    251       1.1  christos #define SET_H_SR(index, x) \
    252       1.1  christos do { \
    253       1.1  christos SET_H_SR_V32 ((index), (x));\
    254       1.1  christos ;} while (0)
    255       1.1  christos #define GET_H_SUPR(index) crisv32f_read_supr (current_cpu, index)
    256       1.1  christos #define SET_H_SUPR(index, x) \
    257       1.1  christos do { \
    258       1.1  christos crisv32f_write_supr (current_cpu, (index), (x));\
    259       1.1  christos ;} while (0)
    260       1.1  christos #define GET_H_CBIT_MOVE() GET_H_CBIT_MOVE_V32 ()
    261       1.1  christos #define SET_H_CBIT_MOVE(x) \
    262       1.1  christos do { \
    263       1.1  christos SET_H_CBIT_MOVE_V32 ((x));\
    264       1.1  christos ;} while (0)
    265       1.1  christos #define GET_H_CBIT_MOVE_V32() (cgen_rtx_error (current_cpu, "Can't get h-cbit-move on CRISv32"), 0)
    266       1.1  christos #define SET_H_CBIT_MOVE_V32(x) \
    267       1.1  christos do { \
    268       1.1  christos ((void) 0); /*nop*/\
    269       1.1  christos ;} while (0)
    270       1.1  christos #define GET_H_VBIT_MOVE() GET_H_VBIT_MOVE_V32 ()
    271       1.1  christos #define SET_H_VBIT_MOVE(x) \
    272       1.1  christos do { \
    273       1.1  christos SET_H_VBIT_MOVE_V32 ((x));\
    274       1.1  christos ;} while (0)
    275       1.1  christos #define GET_H_VBIT_MOVE_V32() (cgen_rtx_error (current_cpu, "Can't get h-vbit-move on CRISv32"), 0)
    276       1.1  christos #define SET_H_VBIT_MOVE_V32(x) \
    277       1.1  christos do { \
    278       1.1  christos ((void) 0); /*nop*/\
    279       1.1  christos ;} while (0)
    280       1.1  christos #define GET_H_ZBIT_MOVE() GET_H_ZBIT_MOVE_V32 ()
    281       1.1  christos #define SET_H_ZBIT_MOVE(x) \
    282       1.1  christos do { \
    283       1.1  christos SET_H_ZBIT_MOVE_V32 ((x));\
    284       1.1  christos ;} while (0)
    285       1.1  christos #define GET_H_ZBIT_MOVE_V32() (cgen_rtx_error (current_cpu, "Can't get h-zbit-move on CRISv32"), 0)
    286       1.1  christos #define SET_H_ZBIT_MOVE_V32(x) \
    287       1.1  christos do { \
    288       1.1  christos ((void) 0); /*nop*/\
    289       1.1  christos ;} while (0)
    290       1.1  christos #define GET_H_NBIT_MOVE() GET_H_NBIT_MOVE_V32 ()
    291       1.1  christos #define SET_H_NBIT_MOVE(x) \
    292       1.1  christos do { \
    293       1.1  christos SET_H_NBIT_MOVE_V32 ((x));\
    294       1.1  christos ;} while (0)
    295       1.1  christos #define GET_H_NBIT_MOVE_V32() (cgen_rtx_error (current_cpu, "Can't get h-nbit-move on CRISv32"), 0)
    296       1.1  christos #define SET_H_NBIT_MOVE_V32(x) \
    297       1.1  christos do { \
    298       1.1  christos ((void) 0); /*nop*/\
    299       1.1  christos ;} while (0)
    300       1.1  christos #define GET_H_IBIT() CPU (h_ibit_v32)
    301       1.1  christos #define SET_H_IBIT(x) \
    302       1.1  christos do { \
    303       1.1  christos SET_H_IBIT_V32 ((x));\
    304       1.1  christos ;} while (0)
    305       1.1  christos #define GET_H_UBIT() CPU (h_ubit_v32)
    306       1.1  christos #define SET_H_UBIT(x) \
    307       1.1  christos do { \
    308       1.1  christos SET_H_UBIT_V32 ((x));\
    309       1.1  christos ;} while (0)
    310       1.1  christos #define GET_H_INSN_PREFIXED_P() GET_H_INSN_PREFIXED_P_V32 ()
    311       1.1  christos #define SET_H_INSN_PREFIXED_P(x) \
    312       1.1  christos do { \
    313       1.1  christos SET_H_INSN_PREFIXED_P_V32 ((x));\
    314       1.1  christos ;} while (0)
    315       1.1  christos #define GET_H_INSN_PREFIXED_P_V32() 0
    316       1.1  christos #define SET_H_INSN_PREFIXED_P_V32(x) \
    317       1.1  christos do { \
    318       1.1  christos ((void) 0); /*nop*/\
    319       1.1  christos ;} while (0)
    320       1.1  christos #define GET_H_PREFIXREG_V32() GET_H_GR (((UINT) 15))
    321       1.1  christos #define SET_H_PREFIXREG_V32(x) \
    322       1.1  christos do { \
    323       1.1  christos SET_H_GR (((UINT) 15), (x));\
    324       1.1  christos ;} while (0)
    325       1.1  christos 
    326       1.1  christos /* Cover fns for register access.  */
    327       1.1  christos BI crisv32f_h_v32_v32_get (SIM_CPU *);
    328       1.1  christos void crisv32f_h_v32_v32_set (SIM_CPU *, BI);
    329       1.1  christos USI crisv32f_h_pc_get (SIM_CPU *);
    330       1.1  christos void crisv32f_h_pc_set (SIM_CPU *, USI);
    331       1.1  christos SI crisv32f_h_gr_get (SIM_CPU *, UINT);
    332       1.1  christos void crisv32f_h_gr_set (SIM_CPU *, UINT, SI);
    333       1.1  christos SI crisv32f_h_gr_acr_get (SIM_CPU *, UINT);
    334       1.1  christos void crisv32f_h_gr_acr_set (SIM_CPU *, UINT, SI);
    335       1.1  christos SI crisv32f_h_raw_gr_acr_get (SIM_CPU *, UINT);
    336       1.1  christos void crisv32f_h_raw_gr_acr_set (SIM_CPU *, UINT, SI);
    337       1.1  christos SI crisv32f_h_sr_get (SIM_CPU *, UINT);
    338       1.1  christos void crisv32f_h_sr_set (SIM_CPU *, UINT, SI);
    339       1.1  christos SI crisv32f_h_sr_v32_get (SIM_CPU *, UINT);
    340       1.1  christos void crisv32f_h_sr_v32_set (SIM_CPU *, UINT, SI);
    341       1.1  christos SI crisv32f_h_supr_get (SIM_CPU *, UINT);
    342       1.1  christos void crisv32f_h_supr_set (SIM_CPU *, UINT, SI);
    343       1.1  christos BI crisv32f_h_cbit_get (SIM_CPU *);
    344       1.1  christos void crisv32f_h_cbit_set (SIM_CPU *, BI);
    345       1.1  christos BI crisv32f_h_cbit_move_get (SIM_CPU *);
    346       1.1  christos void crisv32f_h_cbit_move_set (SIM_CPU *, BI);
    347       1.1  christos BI crisv32f_h_cbit_move_v32_get (SIM_CPU *);
    348       1.1  christos void crisv32f_h_cbit_move_v32_set (SIM_CPU *, BI);
    349       1.1  christos BI crisv32f_h_vbit_get (SIM_CPU *);
    350       1.1  christos void crisv32f_h_vbit_set (SIM_CPU *, BI);
    351       1.1  christos BI crisv32f_h_vbit_move_get (SIM_CPU *);
    352       1.1  christos void crisv32f_h_vbit_move_set (SIM_CPU *, BI);
    353       1.1  christos BI crisv32f_h_vbit_move_v32_get (SIM_CPU *);
    354       1.1  christos void crisv32f_h_vbit_move_v32_set (SIM_CPU *, BI);
    355       1.1  christos BI crisv32f_h_zbit_get (SIM_CPU *);
    356       1.1  christos void crisv32f_h_zbit_set (SIM_CPU *, BI);
    357       1.1  christos BI crisv32f_h_zbit_move_get (SIM_CPU *);
    358       1.1  christos void crisv32f_h_zbit_move_set (SIM_CPU *, BI);
    359       1.1  christos BI crisv32f_h_zbit_move_v32_get (SIM_CPU *);
    360       1.1  christos void crisv32f_h_zbit_move_v32_set (SIM_CPU *, BI);
    361       1.1  christos BI crisv32f_h_nbit_get (SIM_CPU *);
    362       1.1  christos void crisv32f_h_nbit_set (SIM_CPU *, BI);
    363       1.1  christos BI crisv32f_h_nbit_move_get (SIM_CPU *);
    364       1.1  christos void crisv32f_h_nbit_move_set (SIM_CPU *, BI);
    365       1.1  christos BI crisv32f_h_nbit_move_v32_get (SIM_CPU *);
    366       1.1  christos void crisv32f_h_nbit_move_v32_set (SIM_CPU *, BI);
    367       1.1  christos BI crisv32f_h_xbit_get (SIM_CPU *);
    368       1.1  christos void crisv32f_h_xbit_set (SIM_CPU *, BI);
    369       1.1  christos BI crisv32f_h_ibit_get (SIM_CPU *);
    370       1.1  christos void crisv32f_h_ibit_set (SIM_CPU *, BI);
    371       1.1  christos BI crisv32f_h_pbit_get (SIM_CPU *);
    372       1.1  christos void crisv32f_h_pbit_set (SIM_CPU *, BI);
    373       1.1  christos BI crisv32f_h_rbit_get (SIM_CPU *);
    374       1.1  christos void crisv32f_h_rbit_set (SIM_CPU *, BI);
    375       1.1  christos BI crisv32f_h_ubit_get (SIM_CPU *);
    376       1.1  christos void crisv32f_h_ubit_set (SIM_CPU *, BI);
    377       1.1  christos BI crisv32f_h_gbit_get (SIM_CPU *);
    378       1.1  christos void crisv32f_h_gbit_set (SIM_CPU *, BI);
    379       1.1  christos SI crisv32f_h_kernel_sp_get (SIM_CPU *);
    380       1.1  christos void crisv32f_h_kernel_sp_set (SIM_CPU *, SI);
    381       1.1  christos BI crisv32f_h_ubit_v32_get (SIM_CPU *);
    382       1.1  christos void crisv32f_h_ubit_v32_set (SIM_CPU *, BI);
    383       1.1  christos BI crisv32f_h_ibit_v32_get (SIM_CPU *);
    384       1.1  christos void crisv32f_h_ibit_v32_set (SIM_CPU *, BI);
    385       1.1  christos BI crisv32f_h_mbit_get (SIM_CPU *);
    386       1.1  christos void crisv32f_h_mbit_set (SIM_CPU *, BI);
    387       1.1  christos BI crisv32f_h_qbit_get (SIM_CPU *);
    388       1.1  christos void crisv32f_h_qbit_set (SIM_CPU *, BI);
    389       1.1  christos BI crisv32f_h_sbit_get (SIM_CPU *);
    390       1.1  christos void crisv32f_h_sbit_set (SIM_CPU *, BI);
    391       1.1  christos BI crisv32f_h_insn_prefixed_p_get (SIM_CPU *);
    392       1.1  christos void crisv32f_h_insn_prefixed_p_set (SIM_CPU *, BI);
    393       1.1  christos BI crisv32f_h_insn_prefixed_p_v32_get (SIM_CPU *);
    394       1.1  christos void crisv32f_h_insn_prefixed_p_v32_set (SIM_CPU *, BI);
    395       1.1  christos SI crisv32f_h_prefixreg_v32_get (SIM_CPU *);
    396       1.1  christos void crisv32f_h_prefixreg_v32_set (SIM_CPU *, SI);
    397       1.1  christos 
    398       1.1  christos /* These must be hand-written.  */
    399       1.1  christos extern CPUREG_FETCH_FN crisv32f_fetch_register;
    400       1.1  christos extern CPUREG_STORE_FN crisv32f_store_register;
    401       1.1  christos 
    402       1.1  christos typedef struct {
    403       1.1  christos   UINT prev_prev_prev_modf_regs;
    404       1.1  christos   UINT prev_prev_modf_regs;
    405       1.1  christos   UINT prev_modf_regs;
    406       1.1  christos   UINT modf_regs;
    407       1.1  christos   UINT prev_prev_prev_movem_dest_regs;
    408       1.1  christos   UINT prev_prev_movem_dest_regs;
    409       1.1  christos   UINT prev_movem_dest_regs;
    410       1.1  christos   UINT movem_dest_regs;
    411       1.1  christos } MODEL_CRISV32_DATA;
    412       1.1  christos 
    413       1.1  christos /* Instruction argument buffer.  */
    414       1.1  christos 
    415       1.1  christos union sem_fields {
    416       1.1  christos   struct { /* no operands */
    417       1.1  christos     int empty;
    418       1.1  christos   } sfmt_empty;
    419       1.1  christos   struct { /*  */
    420       1.1  christos     UINT f_u4;
    421       1.1  christos   } sfmt_break;
    422       1.1  christos   struct { /*  */
    423       1.1  christos     UINT f_dstsrc;
    424       1.1  christos   } sfmt_setf;
    425       1.1  christos   struct { /*  */
    426       1.1  christos     IADDR i_o_word_pcrel;
    427       1.1  christos     UINT f_operand2;
    428       1.1  christos   } sfmt_bcc_w;
    429       1.1  christos   struct { /*  */
    430       1.1  christos     IADDR i_o_pcrel;
    431       1.1  christos     UINT f_operand2;
    432       1.1  christos   } sfmt_bcc_b;
    433       1.1  christos   struct { /*  */
    434       1.1  christos     unsigned char in_h_sr_SI_13;
    435       1.1  christos     unsigned char out_h_sr_SI_13;
    436       1.1  christos   } sfmt_rfe;
    437       1.1  christos   struct { /*  */
    438       1.1  christos     INT f_s8;
    439       1.1  christos     UINT f_operand2;
    440       1.1  christos     unsigned char in_Rd;
    441       1.1  christos   } sfmt_addoq;
    442       1.1  christos   struct { /*  */
    443       1.1  christos     ADDR i_const32_pcrel;
    444       1.1  christos     UINT f_operand2;
    445       1.1  christos     unsigned char out_Pd;
    446       1.1  christos   } sfmt_bas_c;
    447       1.1  christos   struct { /*  */
    448       1.1  christos     ADDR i_qo;
    449       1.1  christos     UINT f_operand2;
    450       1.1  christos     unsigned char out_Rd;
    451       1.1  christos   } sfmt_lapcq;
    452       1.1  christos   struct { /*  */
    453       1.1  christos     ADDR i_const32_pcrel;
    454       1.1  christos     UINT f_operand2;
    455       1.1  christos     unsigned char out_Rd;
    456       1.1  christos   } sfmt_lapc_d;
    457       1.1  christos   struct { /*  */
    458       1.1  christos     INT f_indir_pc__dword;
    459       1.1  christos     UINT f_operand2;
    460       1.1  christos     unsigned char out_Pd;
    461       1.1  christos   } sfmt_move_c_sprv32_p2;
    462       1.1  christos   struct { /*  */
    463       1.1  christos     INT f_s6;
    464       1.1  christos     UINT f_operand2;
    465       1.1  christos     unsigned char out_Rd;
    466       1.1  christos   } sfmt_moveq;
    467       1.1  christos   struct { /*  */
    468       1.1  christos     INT f_indir_pc__dword;
    469       1.1  christos     UINT f_operand2;
    470       1.1  christos     unsigned char in_Rd;
    471       1.1  christos     unsigned char out_Rd;
    472       1.1  christos   } sfmt_bound_cd;
    473       1.1  christos   struct { /*  */
    474       1.1  christos     INT f_indir_pc__word;
    475       1.1  christos     UINT f_operand2;
    476       1.1  christos     unsigned char in_Rd;
    477       1.1  christos     unsigned char out_Rd;
    478       1.1  christos   } sfmt_bound_cw;
    479       1.1  christos   struct { /*  */
    480       1.1  christos     INT f_indir_pc__byte;
    481       1.1  christos     UINT f_operand2;
    482       1.1  christos     unsigned char in_Rd;
    483       1.1  christos     unsigned char out_Rd;
    484       1.1  christos   } sfmt_bound_cb;
    485       1.1  christos   struct { /*  */
    486       1.1  christos     UINT f_operand2;
    487       1.1  christos     UINT f_u5;
    488       1.1  christos     unsigned char in_Rd;
    489       1.1  christos     unsigned char out_Rd;
    490       1.1  christos   } sfmt_asrq;
    491       1.1  christos   struct { /*  */
    492       1.1  christos     INT f_s6;
    493       1.1  christos     UINT f_operand2;
    494       1.1  christos     unsigned char in_Rd;
    495       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rd;
    496       1.1  christos   } sfmt_andq;
    497       1.1  christos   struct { /*  */
    498       1.1  christos     INT f_indir_pc__dword;
    499       1.1  christos     UINT f_operand2;
    500       1.1  christos     unsigned char in_Rd;
    501       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rd;
    502       1.1  christos   } sfmt_addcdr;
    503       1.1  christos   struct { /*  */
    504       1.1  christos     INT f_indir_pc__word;
    505       1.1  christos     UINT f_operand2;
    506       1.1  christos     unsigned char in_Rd;
    507       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rd;
    508       1.1  christos   } sfmt_addcwr;
    509       1.1  christos   struct { /*  */
    510       1.1  christos     INT f_indir_pc__byte;
    511       1.1  christos     UINT f_operand2;
    512       1.1  christos     unsigned char in_Rd;
    513       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rd;
    514       1.1  christos   } sfmt_addcbr;
    515       1.1  christos   struct { /*  */
    516       1.1  christos     UINT f_operand2;
    517       1.1  christos     UINT f_u6;
    518       1.1  christos     unsigned char in_Rd;
    519       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rd;
    520       1.1  christos   } sfmt_addq;
    521       1.1  christos   struct { /*  */
    522       1.1  christos     UINT f_operand1;
    523       1.1  christos     UINT f_operand2;
    524       1.1  christos     unsigned char in_Ps;
    525       1.1  christos     unsigned char in_Rs;
    526       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rs;
    527       1.1  christos   } sfmt_mcp;
    528       1.1  christos   struct { /*  */
    529       1.1  christos     UINT f_operand1;
    530       1.1  christos     UINT f_operand2;
    531       1.1  christos     unsigned char in_Rd;
    532       1.1  christos     unsigned char in_Rs;
    533       1.1  christos     unsigned char out_Rd;
    534       1.1  christos     unsigned char out_h_sr_SI_7;
    535       1.1  christos   } sfmt_muls_b;
    536       1.1  christos   struct { /*  */
    537       1.1  christos     UINT f_memmode;
    538       1.1  christos     UINT f_operand1;
    539       1.1  christos     UINT f_operand2;
    540       1.1  christos     unsigned char in_Ps;
    541       1.1  christos     unsigned char in_Rs;
    542       1.1  christos     unsigned char out_Rs;
    543       1.1  christos   } sfmt_move_spr_mv32;
    544       1.1  christos   struct { /*  */
    545       1.1  christos     UINT f_memmode;
    546       1.1  christos     UINT f_operand1;
    547       1.1  christos     UINT f_operand2;
    548       1.1  christos     unsigned char in_Rs;
    549       1.1  christos     unsigned char out_Pd;
    550       1.1  christos     unsigned char out_Rs;
    551       1.1  christos   } sfmt_move_m_sprv32;
    552       1.1  christos   struct { /*  */
    553       1.1  christos     UINT f_memmode;
    554       1.1  christos     UINT f_operand1;
    555       1.1  christos     UINT f_operand2;
    556       1.1  christos     unsigned char in_Rs;
    557       1.1  christos     unsigned char out_Rd;
    558       1.1  christos     unsigned char out_Rs;
    559       1.1  christos   } sfmt_movs_m_b_m;
    560       1.1  christos   struct { /*  */
    561       1.1  christos     UINT f_memmode;
    562       1.1  christos     UINT f_operand1;
    563       1.1  christos     UINT f_operand2;
    564       1.1  christos     unsigned char in_Rd;
    565       1.1  christos     unsigned char in_Rs;
    566       1.1  christos     unsigned char out_Rs;
    567       1.1  christos     unsigned char out_h_gr_SI_index_of__INT_Rd;
    568       1.1  christos   } sfmt_addc_m;
    569       1.1  christos   struct { /*  */
    570       1.1  christos     UINT f_memmode;
    571       1.1  christos     UINT f_operand1;
    572       1.1  christos     UINT f_operand2;
    573       1.1  christos     unsigned char in_Rd;
    574       1.1  christos     unsigned char in_Rs;
    575       1.1  christos     unsigned char out_Rs;
    576       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;
    577       1.1  christos   } sfmt_add_m_b_m;
    578       1.1  christos   struct { /*  */
    579       1.1  christos     UINT f_memmode;
    580       1.1  christos     UINT f_operand1;
    581       1.1  christos     UINT f_operand2;
    582       1.1  christos     unsigned char in_Rd;
    583       1.1  christos     unsigned char in_Rs;
    584       1.1  christos     unsigned char out_Rs;
    585       1.1  christos     unsigned char out_h_gr_SI_0;
    586       1.1  christos     unsigned char out_h_gr_SI_1;
    587       1.1  christos     unsigned char out_h_gr_SI_10;
    588       1.1  christos     unsigned char out_h_gr_SI_11;
    589       1.1  christos     unsigned char out_h_gr_SI_12;
    590       1.1  christos     unsigned char out_h_gr_SI_13;
    591       1.1  christos     unsigned char out_h_gr_SI_14;
    592       1.1  christos     unsigned char out_h_gr_SI_15;
    593       1.1  christos     unsigned char out_h_gr_SI_2;
    594       1.1  christos     unsigned char out_h_gr_SI_3;
    595       1.1  christos     unsigned char out_h_gr_SI_4;
    596       1.1  christos     unsigned char out_h_gr_SI_5;
    597       1.1  christos     unsigned char out_h_gr_SI_6;
    598       1.1  christos     unsigned char out_h_gr_SI_7;
    599       1.1  christos     unsigned char out_h_gr_SI_8;
    600       1.1  christos     unsigned char out_h_gr_SI_9;
    601       1.1  christos   } sfmt_movem_m_r_v32;
    602       1.1  christos   struct { /*  */
    603       1.1  christos     UINT f_memmode;
    604       1.1  christos     UINT f_operand1;
    605       1.1  christos     UINT f_operand2;
    606       1.1  christos     unsigned char in_Rd;
    607       1.1  christos     unsigned char in_Rs;
    608       1.1  christos     unsigned char in_h_gr_SI_0;
    609       1.1  christos     unsigned char in_h_gr_SI_1;
    610       1.1  christos     unsigned char in_h_gr_SI_10;
    611       1.1  christos     unsigned char in_h_gr_SI_11;
    612       1.1  christos     unsigned char in_h_gr_SI_12;
    613       1.1  christos     unsigned char in_h_gr_SI_13;
    614       1.1  christos     unsigned char in_h_gr_SI_14;
    615       1.1  christos     unsigned char in_h_gr_SI_15;
    616       1.1  christos     unsigned char in_h_gr_SI_2;
    617       1.1  christos     unsigned char in_h_gr_SI_3;
    618       1.1  christos     unsigned char in_h_gr_SI_4;
    619       1.1  christos     unsigned char in_h_gr_SI_5;
    620       1.1  christos     unsigned char in_h_gr_SI_6;
    621       1.1  christos     unsigned char in_h_gr_SI_7;
    622       1.1  christos     unsigned char in_h_gr_SI_8;
    623       1.1  christos     unsigned char in_h_gr_SI_9;
    624       1.1  christos     unsigned char out_Rs;
    625       1.1  christos   } sfmt_movem_r_m_v32;
    626       1.1  christos #if WITH_SCACHE_PBB
    627       1.1  christos   /* Writeback handler.  */
    628       1.1  christos   struct {
    629       1.1  christos     /* Pointer to argbuf entry for insn whose results need writing back.  */
    630       1.1  christos     const struct argbuf *abuf;
    631       1.1  christos   } write;
    632       1.1  christos   /* x-before handler */
    633       1.1  christos   struct {
    634       1.1  christos     /*const SCACHE *insns[MAX_PARALLEL_INSNS];*/
    635       1.1  christos     int first_p;
    636       1.1  christos   } before;
    637       1.1  christos   /* x-after handler */
    638       1.1  christos   struct {
    639       1.1  christos     int empty;
    640       1.1  christos   } after;
    641       1.1  christos   /* This entry is used to terminate each pbb.  */
    642       1.1  christos   struct {
    643       1.1  christos     /* Number of insns in pbb.  */
    644       1.1  christos     int insn_count;
    645       1.1  christos     /* Next pbb to execute.  */
    646       1.1  christos     SCACHE *next;
    647       1.1  christos     SCACHE *branch_target;
    648       1.1  christos   } chain;
    649       1.1  christos #endif
    650       1.1  christos };
    651       1.1  christos 
    652       1.1  christos /* The ARGBUF struct.  */
    653       1.1  christos struct argbuf {
    654       1.1  christos   /* These are the baseclass definitions.  */
    655       1.1  christos   IADDR addr;
    656       1.1  christos   const IDESC *idesc;
    657       1.1  christos   char trace_p;
    658       1.1  christos   char profile_p;
    659       1.1  christos   /* ??? Temporary hack for skip insns.  */
    660       1.1  christos   char skip_count;
    661       1.1  christos   char unused;
    662       1.1  christos   /* cpu specific data follows */
    663       1.1  christos   union sem semantic;
    664       1.1  christos   int written;
    665       1.1  christos   union sem_fields fields;
    666       1.1  christos };
    667       1.1  christos 
    668       1.1  christos /* A cached insn.
    669       1.1  christos 
    670       1.1  christos    ??? SCACHE used to contain more than just argbuf.  We could delete the
    671       1.1  christos    type entirely and always just use ARGBUF, but for future concerns and as
    672       1.1  christos    a level of abstraction it is left in.  */
    673       1.1  christos 
    674       1.1  christos struct scache {
    675       1.1  christos   struct argbuf argbuf;
    676       1.1  christos };
    677       1.1  christos 
    678       1.1  christos /* Macros to simplify extraction, reading and semantic code.
    679       1.1  christos    These define and assign the local vars that contain the insn's fields.  */
    680       1.1  christos 
    681       1.1  christos #define EXTRACT_IFMT_EMPTY_VARS \
    682       1.1  christos   unsigned int length;
    683       1.1  christos #define EXTRACT_IFMT_EMPTY_CODE \
    684       1.1  christos   length = 0; \
    685       1.1  christos 
    686       1.1  christos #define EXTRACT_IFMT_MOVE_B_R_VARS \
    687       1.1  christos   UINT f_operand2; \
    688       1.1  christos   UINT f_mode; \
    689       1.1  christos   UINT f_opcode; \
    690       1.1  christos   UINT f_size; \
    691       1.1  christos   UINT f_operand1; \
    692       1.1  christos   unsigned int length;
    693       1.1  christos #define EXTRACT_IFMT_MOVE_B_R_CODE \
    694       1.1  christos   length = 2; \
    695       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    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_MOVEQ_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   INT f_s6; \
    706       1.1  christos   unsigned int length;
    707       1.1  christos #define EXTRACT_IFMT_MOVEQ_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_s6 = EXTRACT_LSB0_SINT (insn, 16, 5, 6); \
    713       1.1  christos 
    714       1.1  christos #define EXTRACT_IFMT_MOVECBR_VARS \
    715       1.1  christos   UINT f_operand2; \
    716       1.1  christos   INT f_indir_pc__byte; \
    717       1.1  christos   UINT f_mode; \
    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   /* Contents of trailing part of insn.  */ \
    722       1.1  christos   UINT word_1; \
    723       1.1  christos   unsigned int length;
    724       1.1  christos #define EXTRACT_IFMT_MOVECBR_CODE \
    725       1.1  christos   length = 4; \
    726       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    727       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    728       1.1  christos   f_indir_pc__byte = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \
    729       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    730       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    731       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    732       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    733       1.1  christos 
    734       1.1  christos #define EXTRACT_IFMT_MOVECWR_VARS \
    735       1.1  christos   UINT f_operand2; \
    736       1.1  christos   INT f_indir_pc__word; \
    737       1.1  christos   UINT f_mode; \
    738       1.1  christos   UINT f_opcode; \
    739       1.1  christos   UINT f_size; \
    740       1.1  christos   UINT f_operand1; \
    741       1.1  christos   /* Contents of trailing part of insn.  */ \
    742       1.1  christos   UINT word_1; \
    743       1.1  christos   unsigned int length;
    744       1.1  christos #define EXTRACT_IFMT_MOVECWR_CODE \
    745       1.1  christos   length = 4; \
    746       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    747       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    748       1.1  christos   f_indir_pc__word = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \
    749       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    750       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    751       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    752       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    753       1.1  christos 
    754       1.1  christos #define EXTRACT_IFMT_MOVECDR_VARS \
    755       1.1  christos   INT f_indir_pc__dword; \
    756       1.1  christos   UINT f_operand2; \
    757       1.1  christos   UINT f_mode; \
    758       1.1  christos   UINT f_opcode; \
    759       1.1  christos   UINT f_size; \
    760       1.1  christos   UINT f_operand1; \
    761       1.1  christos   /* Contents of trailing part of insn.  */ \
    762       1.1  christos   UINT word_1; \
    763       1.1  christos   unsigned int length;
    764       1.1  christos #define EXTRACT_IFMT_MOVECDR_CODE \
    765       1.1  christos   length = 6; \
    766       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    767       1.1  christos   f_indir_pc__dword = (0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)); \
    768       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    769       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    770       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    771       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    772       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    773       1.1  christos 
    774       1.1  christos #define EXTRACT_IFMT_MOVUCBR_VARS \
    775       1.1  christos   UINT f_operand2; \
    776       1.1  christos   INT f_indir_pc__byte; \
    777       1.1  christos   UINT f_mode; \
    778       1.1  christos   UINT f_opcode; \
    779       1.1  christos   UINT f_size; \
    780       1.1  christos   UINT f_operand1; \
    781       1.1  christos   /* Contents of trailing part of insn.  */ \
    782       1.1  christos   UINT word_1; \
    783       1.1  christos   unsigned int length;
    784       1.1  christos #define EXTRACT_IFMT_MOVUCBR_CODE \
    785       1.1  christos   length = 4; \
    786       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    787       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    788       1.1  christos   f_indir_pc__byte = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \
    789       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    790       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    791       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    792       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    793       1.1  christos 
    794       1.1  christos #define EXTRACT_IFMT_MOVUCWR_VARS \
    795       1.1  christos   UINT f_operand2; \
    796       1.1  christos   INT f_indir_pc__word; \
    797       1.1  christos   UINT f_mode; \
    798       1.1  christos   UINT f_opcode; \
    799       1.1  christos   UINT f_size; \
    800       1.1  christos   UINT f_operand1; \
    801       1.1  christos   /* Contents of trailing part of insn.  */ \
    802       1.1  christos   UINT word_1; \
    803       1.1  christos   unsigned int length;
    804       1.1  christos #define EXTRACT_IFMT_MOVUCWR_CODE \
    805       1.1  christos   length = 4; \
    806       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    807       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    808       1.1  christos   f_indir_pc__word = (0|(EXTRACT_LSB0_UINT (word_1, 32, 15, 16) << 0)); \
    809       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    810       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    811       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    812       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    813       1.1  christos 
    814       1.1  christos #define EXTRACT_IFMT_ADDQ_VARS \
    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_u6; \
    819       1.1  christos   unsigned int length;
    820       1.1  christos #define EXTRACT_IFMT_ADDQ_CODE \
    821       1.1  christos   length = 2; \
    822       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    823       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    824       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    825       1.1  christos   f_u6 = EXTRACT_LSB0_UINT (insn, 16, 5, 6); \
    826       1.1  christos 
    827       1.1  christos #define EXTRACT_IFMT_CMP_M_B_M_VARS \
    828       1.1  christos   UINT f_operand2; \
    829       1.1  christos   UINT f_membit; \
    830       1.1  christos   UINT f_memmode; \
    831       1.1  christos   UINT f_opcode; \
    832       1.1  christos   UINT f_size; \
    833       1.1  christos   UINT f_operand1; \
    834       1.1  christos   unsigned int length;
    835       1.1  christos #define EXTRACT_IFMT_CMP_M_B_M_CODE \
    836       1.1  christos   length = 2; \
    837       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    838       1.1  christos   f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \
    839       1.1  christos   f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \
    840       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    841       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    842       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    843       1.1  christos 
    844       1.1  christos #define EXTRACT_IFMT_MOVE_R_SPRV32_VARS \
    845       1.1  christos   UINT f_operand2; \
    846       1.1  christos   UINT f_mode; \
    847       1.1  christos   UINT f_opcode; \
    848       1.1  christos   UINT f_size; \
    849       1.1  christos   UINT f_operand1; \
    850       1.1  christos   unsigned int length;
    851       1.1  christos #define EXTRACT_IFMT_MOVE_R_SPRV32_CODE \
    852       1.1  christos   length = 2; \
    853       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    854       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    855       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    856       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    857       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    858       1.1  christos 
    859       1.1  christos #define EXTRACT_IFMT_MOVE_SPR_RV32_VARS \
    860       1.1  christos   UINT f_operand2; \
    861       1.1  christos   UINT f_mode; \
    862       1.1  christos   UINT f_opcode; \
    863       1.1  christos   UINT f_size; \
    864       1.1  christos   UINT f_operand1; \
    865       1.1  christos   unsigned int length;
    866       1.1  christos #define EXTRACT_IFMT_MOVE_SPR_RV32_CODE \
    867       1.1  christos   length = 2; \
    868       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    869       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    870       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    871       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    872       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    873       1.1  christos 
    874       1.1  christos #define EXTRACT_IFMT_MOVE_M_SPRV32_VARS \
    875       1.1  christos   UINT f_operand2; \
    876       1.1  christos   UINT f_membit; \
    877       1.1  christos   UINT f_memmode; \
    878       1.1  christos   UINT f_opcode; \
    879       1.1  christos   UINT f_size; \
    880       1.1  christos   UINT f_operand1; \
    881       1.1  christos   unsigned int length;
    882       1.1  christos #define EXTRACT_IFMT_MOVE_M_SPRV32_CODE \
    883       1.1  christos   length = 2; \
    884       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    885       1.1  christos   f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \
    886       1.1  christos   f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \
    887       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    888       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    889       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    890       1.1  christos 
    891       1.1  christos #define EXTRACT_IFMT_MOVE_C_SPRV32_P2_VARS \
    892       1.1  christos   INT f_indir_pc__dword; \
    893       1.1  christos   UINT f_operand2; \
    894       1.1  christos   UINT f_mode; \
    895       1.1  christos   UINT f_opcode; \
    896       1.1  christos   UINT f_size; \
    897       1.1  christos   UINT f_operand1; \
    898       1.1  christos   /* Contents of trailing part of insn.  */ \
    899       1.1  christos   UINT word_1; \
    900       1.1  christos   unsigned int length;
    901       1.1  christos #define EXTRACT_IFMT_MOVE_C_SPRV32_P2_CODE \
    902       1.1  christos   length = 6; \
    903       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    904       1.1  christos   f_indir_pc__dword = (0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)); \
    905       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    906       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    907       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    908       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    909       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    910       1.1  christos 
    911       1.1  christos #define EXTRACT_IFMT_MOVE_SPR_MV32_VARS \
    912       1.1  christos   UINT f_operand2; \
    913       1.1  christos   UINT f_membit; \
    914       1.1  christos   UINT f_memmode; \
    915       1.1  christos   UINT f_opcode; \
    916       1.1  christos   UINT f_size; \
    917       1.1  christos   UINT f_operand1; \
    918       1.1  christos   unsigned int length;
    919       1.1  christos #define EXTRACT_IFMT_MOVE_SPR_MV32_CODE \
    920       1.1  christos   length = 2; \
    921       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    922       1.1  christos   f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \
    923       1.1  christos   f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \
    924       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    925       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    926       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    927       1.1  christos 
    928       1.1  christos #define EXTRACT_IFMT_MOVE_SS_R_VARS \
    929       1.1  christos   UINT f_operand2; \
    930       1.1  christos   UINT f_mode; \
    931       1.1  christos   UINT f_opcode; \
    932       1.1  christos   UINT f_size; \
    933       1.1  christos   UINT f_operand1; \
    934       1.1  christos   unsigned int length;
    935       1.1  christos #define EXTRACT_IFMT_MOVE_SS_R_CODE \
    936       1.1  christos   length = 2; \
    937       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    938       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    939       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    940       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    941       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    942       1.1  christos 
    943       1.1  christos #define EXTRACT_IFMT_MOVE_R_SS_VARS \
    944       1.1  christos   UINT f_operand2; \
    945       1.1  christos   UINT f_mode; \
    946       1.1  christos   UINT f_opcode; \
    947       1.1  christos   UINT f_size; \
    948       1.1  christos   UINT f_operand1; \
    949       1.1  christos   unsigned int length;
    950       1.1  christos #define EXTRACT_IFMT_MOVE_R_SS_CODE \
    951       1.1  christos   length = 2; \
    952       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    953       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    954       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    955       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    956       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    957       1.1  christos 
    958       1.1  christos #define EXTRACT_IFMT_LAPC_D_VARS \
    959       1.1  christos   SI f_indir_pc__dword_pcrel; \
    960       1.1  christos   UINT f_operand2; \
    961       1.1  christos   UINT f_mode; \
    962       1.1  christos   UINT f_opcode; \
    963       1.1  christos   UINT f_size; \
    964       1.1  christos   UINT f_operand1; \
    965       1.1  christos   /* Contents of trailing part of insn.  */ \
    966       1.1  christos   UINT word_1; \
    967       1.1  christos   unsigned int length;
    968       1.1  christos #define EXTRACT_IFMT_LAPC_D_CODE \
    969       1.1  christos   length = 6; \
    970       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
    971       1.1  christos   f_indir_pc__dword_pcrel = ((pc) + ((0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)))); \
    972       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    973       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    974       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    975       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    976       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
    977       1.1  christos 
    978       1.1  christos #define EXTRACT_IFMT_LAPCQ_VARS \
    979       1.1  christos   UINT f_operand2; \
    980       1.1  christos   UINT f_mode; \
    981       1.1  christos   UINT f_opcode; \
    982       1.1  christos   UINT f_size; \
    983       1.1  christos   SI f_qo; \
    984       1.1  christos   unsigned int length;
    985       1.1  christos #define EXTRACT_IFMT_LAPCQ_CODE \
    986       1.1  christos   length = 2; \
    987       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
    988       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
    989       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
    990       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
    991       1.1  christos   f_qo = ((pc) + (((EXTRACT_LSB0_UINT (insn, 16, 3, 4)) << (1)))); \
    992       1.1  christos 
    993       1.1  christos #define EXTRACT_IFMT_TEST_M_B_M_VARS \
    994       1.1  christos   UINT f_operand2; \
    995       1.1  christos   UINT f_membit; \
    996       1.1  christos   UINT f_memmode; \
    997       1.1  christos   UINT f_opcode; \
    998       1.1  christos   UINT f_size; \
    999       1.1  christos   UINT f_operand1; \
   1000       1.1  christos   unsigned int length;
   1001       1.1  christos #define EXTRACT_IFMT_TEST_M_B_M_CODE \
   1002       1.1  christos   length = 2; \
   1003       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1004       1.1  christos   f_membit = EXTRACT_LSB0_UINT (insn, 16, 11, 1); \
   1005       1.1  christos   f_memmode = EXTRACT_LSB0_UINT (insn, 16, 10, 1); \
   1006       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1007       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1008       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1009       1.1  christos 
   1010       1.1  christos #define EXTRACT_IFMT_SWAP_VARS \
   1011       1.1  christos   UINT f_operand2; \
   1012       1.1  christos   UINT f_mode; \
   1013       1.1  christos   UINT f_opcode; \
   1014       1.1  christos   UINT f_size; \
   1015       1.1  christos   UINT f_operand1; \
   1016       1.1  christos   unsigned int length;
   1017       1.1  christos #define EXTRACT_IFMT_SWAP_CODE \
   1018       1.1  christos   length = 2; \
   1019       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1020       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1021       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1022       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1023       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1024       1.1  christos 
   1025       1.1  christos #define EXTRACT_IFMT_ASRQ_VARS \
   1026       1.1  christos   UINT f_operand2; \
   1027       1.1  christos   UINT f_mode; \
   1028       1.1  christos   UINT f_opcode; \
   1029       1.1  christos   UINT f_b5; \
   1030       1.1  christos   UINT f_u5; \
   1031       1.1  christos   unsigned int length;
   1032       1.1  christos #define EXTRACT_IFMT_ASRQ_CODE \
   1033       1.1  christos   length = 2; \
   1034       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1035       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1036       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1037       1.1  christos   f_b5 = EXTRACT_LSB0_UINT (insn, 16, 5, 1); \
   1038       1.1  christos   f_u5 = EXTRACT_LSB0_UINT (insn, 16, 4, 5); \
   1039       1.1  christos 
   1040       1.1  christos #define EXTRACT_IFMT_SETF_VARS \
   1041       1.1  christos   UINT f_mode; \
   1042       1.1  christos   UINT f_opcode; \
   1043       1.1  christos   UINT f_size; \
   1044       1.1  christos   UINT f_operand2; \
   1045       1.1  christos   UINT f_operand1; \
   1046       1.1  christos   UINT f_dstsrc; \
   1047       1.1  christos   unsigned int length;
   1048       1.1  christos #define EXTRACT_IFMT_SETF_CODE \
   1049       1.1  christos   length = 2; \
   1050       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1051       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1052       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1053       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1054       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1055       1.1  christos   f_dstsrc = ((((f_operand1) | (((f_operand2) << (4))))) & (255));\
   1056       1.1  christos 
   1057       1.1  christos #define EXTRACT_IFMT_RFE_VARS \
   1058       1.1  christos   UINT f_operand2; \
   1059       1.1  christos   UINT f_mode; \
   1060       1.1  christos   UINT f_opcode; \
   1061       1.1  christos   UINT f_size; \
   1062       1.1  christos   UINT f_operand1; \
   1063       1.1  christos   unsigned int length;
   1064       1.1  christos #define EXTRACT_IFMT_RFE_CODE \
   1065       1.1  christos   length = 2; \
   1066       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1067       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1068       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1069       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1070       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1071       1.1  christos 
   1072       1.1  christos #define EXTRACT_IFMT_BCC_B_VARS \
   1073       1.1  christos   UINT f_operand2; \
   1074       1.1  christos   UINT f_mode; \
   1075       1.1  christos   UINT f_opcode_hi; \
   1076       1.1  christos   INT f_disp9_hi; \
   1077       1.1  christos   UINT f_disp9_lo; \
   1078       1.1  christos   INT f_disp9; \
   1079       1.1  christos   unsigned int length;
   1080       1.1  christos #define EXTRACT_IFMT_BCC_B_CODE \
   1081       1.1  christos   length = 2; \
   1082       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1083       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1084       1.1  christos   f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \
   1085       1.1  christos   f_disp9_hi = EXTRACT_LSB0_SINT (insn, 16, 0, 1); \
   1086       1.1  christos   f_disp9_lo = EXTRACT_LSB0_UINT (insn, 16, 7, 7); \
   1087       1.1  christos {\
   1088       1.1  christos   SI tmp_abslo;\
   1089       1.1  christos   SI tmp_absval;\
   1090       1.1  christos   tmp_abslo = ((f_disp9_lo) << (1));\
   1091       1.1  christos   tmp_absval = ((((((f_disp9_hi) != (0))) ? ((~ (255))) : (0))) | (tmp_abslo));\
   1092       1.1  christos   f_disp9 = ((((pc) + (tmp_absval))) + (((GET_H_V32_V32 ()) ? (0) : (2))));\
   1093       1.1  christos }\
   1094       1.1  christos 
   1095       1.1  christos #define EXTRACT_IFMT_BA_B_VARS \
   1096       1.1  christos   UINT f_operand2; \
   1097       1.1  christos   UINT f_mode; \
   1098       1.1  christos   UINT f_opcode_hi; \
   1099       1.1  christos   INT f_disp9_hi; \
   1100       1.1  christos   UINT f_disp9_lo; \
   1101       1.1  christos   INT f_disp9; \
   1102       1.1  christos   unsigned int length;
   1103       1.1  christos #define EXTRACT_IFMT_BA_B_CODE \
   1104       1.1  christos   length = 2; \
   1105       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1106       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1107       1.1  christos   f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \
   1108       1.1  christos   f_disp9_hi = EXTRACT_LSB0_SINT (insn, 16, 0, 1); \
   1109       1.1  christos   f_disp9_lo = EXTRACT_LSB0_UINT (insn, 16, 7, 7); \
   1110       1.1  christos {\
   1111       1.1  christos   SI tmp_abslo;\
   1112       1.1  christos   SI tmp_absval;\
   1113       1.1  christos   tmp_abslo = ((f_disp9_lo) << (1));\
   1114       1.1  christos   tmp_absval = ((((((f_disp9_hi) != (0))) ? ((~ (255))) : (0))) | (tmp_abslo));\
   1115       1.1  christos   f_disp9 = ((((pc) + (tmp_absval))) + (((GET_H_V32_V32 ()) ? (0) : (2))));\
   1116       1.1  christos }\
   1117       1.1  christos 
   1118       1.1  christos #define EXTRACT_IFMT_BCC_W_VARS \
   1119       1.1  christos   UINT f_operand2; \
   1120       1.1  christos   SI f_indir_pc__word_pcrel; \
   1121       1.1  christos   UINT f_mode; \
   1122       1.1  christos   UINT f_opcode; \
   1123       1.1  christos   UINT f_size; \
   1124       1.1  christos   UINT f_operand1; \
   1125       1.1  christos   /* Contents of trailing part of insn.  */ \
   1126       1.1  christos   UINT word_1; \
   1127       1.1  christos   unsigned int length;
   1128       1.1  christos #define EXTRACT_IFMT_BCC_W_CODE \
   1129       1.1  christos   length = 4; \
   1130       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
   1131       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1132       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_V32 ()) ? (0) : (4)))))); \
   1133       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1134       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1135       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1136       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1137       1.1  christos 
   1138       1.1  christos #define EXTRACT_IFMT_BA_W_VARS \
   1139       1.1  christos   UINT f_operand2; \
   1140       1.1  christos   SI f_indir_pc__word_pcrel; \
   1141       1.1  christos   UINT f_mode; \
   1142       1.1  christos   UINT f_opcode; \
   1143       1.1  christos   UINT f_size; \
   1144       1.1  christos   UINT f_operand1; \
   1145       1.1  christos   /* Contents of trailing part of insn.  */ \
   1146       1.1  christos   UINT word_1; \
   1147       1.1  christos   unsigned int length;
   1148       1.1  christos #define EXTRACT_IFMT_BA_W_CODE \
   1149       1.1  christos   length = 4; \
   1150       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
   1151       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1152       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_V32 ()) ? (0) : (4)))))); \
   1153       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1154       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1155       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1156       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1157       1.1  christos 
   1158       1.1  christos #define EXTRACT_IFMT_JAS_C_VARS \
   1159       1.1  christos   INT f_indir_pc__dword; \
   1160       1.1  christos   UINT f_operand2; \
   1161       1.1  christos   UINT f_mode; \
   1162       1.1  christos   UINT f_opcode; \
   1163       1.1  christos   UINT f_size; \
   1164       1.1  christos   UINT f_operand1; \
   1165       1.1  christos   /* Contents of trailing part of insn.  */ \
   1166       1.1  christos   UINT word_1; \
   1167       1.1  christos   unsigned int length;
   1168       1.1  christos #define EXTRACT_IFMT_JAS_C_CODE \
   1169       1.1  christos   length = 6; \
   1170       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
   1171       1.1  christos   f_indir_pc__dword = (0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)); \
   1172       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1173       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1174       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1175       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1176       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1177       1.1  christos 
   1178       1.1  christos #define EXTRACT_IFMT_JUMP_P_VARS \
   1179       1.1  christos   UINT f_operand2; \
   1180       1.1  christos   UINT f_mode; \
   1181       1.1  christos   UINT f_opcode; \
   1182       1.1  christos   UINT f_size; \
   1183       1.1  christos   UINT f_operand1; \
   1184       1.1  christos   unsigned int length;
   1185       1.1  christos #define EXTRACT_IFMT_JUMP_P_CODE \
   1186       1.1  christos   length = 2; \
   1187       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1188       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1189       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1190       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1191       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1192       1.1  christos 
   1193       1.1  christos #define EXTRACT_IFMT_BAS_C_VARS \
   1194       1.1  christos   SI f_indir_pc__dword_pcrel; \
   1195       1.1  christos   UINT f_operand2; \
   1196       1.1  christos   UINT f_mode; \
   1197       1.1  christos   UINT f_opcode; \
   1198       1.1  christos   UINT f_size; \
   1199       1.1  christos   UINT f_operand1; \
   1200       1.1  christos   /* Contents of trailing part of insn.  */ \
   1201       1.1  christos   UINT word_1; \
   1202       1.1  christos   unsigned int length;
   1203       1.1  christos #define EXTRACT_IFMT_BAS_C_CODE \
   1204       1.1  christos   length = 6; \
   1205       1.1  christos   word_1 = GETIMEMUSI (current_cpu, pc + 2); \
   1206       1.1  christos   f_indir_pc__dword_pcrel = ((pc) + ((0|(EXTRACT_LSB0_UINT (word_1, 32, 31, 32) << 0)))); \
   1207       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1208       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1209       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1210       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1211       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1212       1.1  christos 
   1213       1.1  christos #define EXTRACT_IFMT_BREAK_VARS \
   1214       1.1  christos   UINT f_operand2; \
   1215       1.1  christos   UINT f_mode; \
   1216       1.1  christos   UINT f_opcode; \
   1217       1.1  christos   UINT f_size; \
   1218       1.1  christos   UINT f_u4; \
   1219       1.1  christos   unsigned int length;
   1220       1.1  christos #define EXTRACT_IFMT_BREAK_CODE \
   1221       1.1  christos   length = 2; \
   1222       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1223       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1224       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1225       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1226       1.1  christos   f_u4 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1227       1.1  christos 
   1228       1.1  christos #define EXTRACT_IFMT_SCC_VARS \
   1229       1.1  christos   UINT f_operand2; \
   1230       1.1  christos   UINT f_mode; \
   1231       1.1  christos   UINT f_opcode; \
   1232       1.1  christos   UINT f_size; \
   1233       1.1  christos   UINT f_operand1; \
   1234       1.1  christos   unsigned int length;
   1235       1.1  christos #define EXTRACT_IFMT_SCC_CODE \
   1236       1.1  christos   length = 2; \
   1237       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1238       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1239       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1240       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1241       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1242       1.1  christos 
   1243       1.1  christos #define EXTRACT_IFMT_ADDOQ_VARS \
   1244       1.1  christos   UINT f_operand2; \
   1245       1.1  christos   UINT f_mode; \
   1246       1.1  christos   UINT f_opcode_hi; \
   1247       1.1  christos   INT f_s8; \
   1248       1.1  christos   unsigned int length;
   1249       1.1  christos #define EXTRACT_IFMT_ADDOQ_CODE \
   1250       1.1  christos   length = 2; \
   1251       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1252       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1253       1.1  christos   f_opcode_hi = EXTRACT_LSB0_UINT (insn, 16, 9, 2); \
   1254       1.1  christos   f_s8 = EXTRACT_LSB0_SINT (insn, 16, 7, 8); \
   1255       1.1  christos 
   1256       1.1  christos #define EXTRACT_IFMT_FIDXI_VARS \
   1257       1.1  christos   UINT f_operand2; \
   1258       1.1  christos   UINT f_mode; \
   1259       1.1  christos   UINT f_opcode; \
   1260       1.1  christos   UINT f_size; \
   1261       1.1  christos   UINT f_operand1; \
   1262       1.1  christos   unsigned int length;
   1263       1.1  christos #define EXTRACT_IFMT_FIDXI_CODE \
   1264       1.1  christos   length = 2; \
   1265       1.1  christos   f_operand2 = EXTRACT_LSB0_UINT (insn, 16, 15, 4); \
   1266       1.1  christos   f_mode = EXTRACT_LSB0_UINT (insn, 16, 11, 2); \
   1267       1.1  christos   f_opcode = EXTRACT_LSB0_UINT (insn, 16, 9, 4); \
   1268       1.1  christos   f_size = EXTRACT_LSB0_UINT (insn, 16, 5, 2); \
   1269       1.1  christos   f_operand1 = EXTRACT_LSB0_UINT (insn, 16, 3, 4); \
   1270       1.1  christos 
   1271       1.1  christos /* Collection of various things for the trace handler to use.  */
   1272       1.1  christos 
   1273       1.1  christos typedef struct trace_record {
   1274       1.1  christos   IADDR pc;
   1275       1.1  christos   /* FIXME:wip */
   1276       1.1  christos } TRACE_RECORD;
   1277       1.1  christos 
   1278       1.1  christos #endif /* CPU_CRISV32F_H */
   1279