00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef D30V_H
00022 #define D30V_H
00023
00024 #define NOP 0x00F00000
00025
00026
00027 struct pd_reg
00028 {
00029 char *name;
00030 char *pname;
00031 int value;
00032 };
00033
00034 extern const struct pd_reg pre_defined_registers[];
00035 int reg_name_cnt (void);
00036
00037
00038 #define MAX_CONTROL_REG 64
00039
00040
00041 #define FM00 0
00042 #define FM01 0x80000000
00043 #define FM10 0x8000000000000000LL
00044 #define FM11 0x8000000080000000LL
00045
00046
00047 #define BRA 0
00048 #define LOGIC 1
00049 #define IMEM 2
00050 #define IALU1 4
00051 #define IALU2 5
00052
00053
00054 #define ECC_AL 0
00055 #define ECC_TX 1
00056 #define ECC_FX 2
00057 #define ECC_XT 3
00058 #define ECC_XF 4
00059 #define ECC_TT 5
00060 #define ECC_TF 6
00061 #define ECC_RESERVED 7
00062 #define ECC_MAX ECC_RESERVED
00063
00064 extern const char *d30v_ecc_names[];
00065
00066
00067 extern const char *d30v_cc_names[];
00068
00069
00070 struct d30v_opcode
00071 {
00072
00073 const char *name;
00074
00075
00076 int op1;
00077 int op2;
00078
00079
00080
00081 unsigned char format[4];
00082
00083 #define SHORT_M 1
00084 #define SHORT_M2 5
00085 #define SHORT_A 9
00086 #define SHORT_B1 11
00087 #define SHORT_B2 12
00088 #define SHORT_B2r 13
00089 #define SHORT_B3 14
00090 #define SHORT_B3r 16
00091 #define SHORT_B3b 18
00092 #define SHORT_B3br 20
00093 #define SHORT_D1r 22
00094 #define SHORT_D2 24
00095 #define SHORT_D2r 26
00096 #define SHORT_D2Br 28
00097 #define SHORT_U 30
00098 #define SHORT_F 31
00099 #define SHORT_AF 33
00100 #define SHORT_T 35
00101 #define SHORT_A5 36
00102 #define SHORT_CMP 38
00103 #define SHORT_CMPU 40
00104 #define SHORT_A1 42
00105 #define SHORT_AA 44
00106 #define SHORT_RA 46
00107 #define SHORT_MODINC 48
00108 #define SHORT_MODDEC 49
00109 #define SHORT_C1 50
00110 #define SHORT_C2 51
00111 #define SHORT_UF 52
00112 #define SHORT_A2 53
00113 #define SHORT_NONE 55
00114 #define SHORT_AR 56
00115 #define LONG 57
00116 #define LONG_U 58
00117 #define LONG_Ur 59
00118 #define LONG_CMP 60
00119 #define LONG_M 61
00120 #define LONG_M2 62
00121 #define LONG_2 63
00122 #define LONG_2r 64
00123 #define LONG_2b 65
00124 #define LONG_2br 66
00125 #define LONG_D 67
00126 #define LONG_Dr 68
00127 #define LONG_Dbr 69
00128
00129
00130 int unit;
00131 #define EITHER 0
00132 #define IU 1
00133 #define MU 2
00134 #define EITHER_BUT_PREFER_MU 3
00135
00136
00137
00138 long flags_used;
00139 long flags_set;
00140 #define FLAG_0 (1L<<0)
00141 #define FLAG_1 (1L<<1)
00142 #define FLAG_2 (1L<<2)
00143 #define FLAG_3 (1L<<3)
00144 #define FLAG_4 (1L<<4)
00145 #define FLAG_5 (1L<<5)
00146 #define FLAG_6 (1L<<6)
00147 #define FLAG_7 (1L<<7)
00148 #define FLAG_SM (1L<<8)
00149 #define FLAG_RP (1L<<9)
00150 #define FLAG_CONTROL (1L<<10)
00151 #define FLAG_A0 (1L<<11)
00152 #define FLAG_A1 (1L<<12)
00153 #define FLAG_JMP (1L<<13)
00154 #define FLAG_JSR (1L<<14)
00155 #define FLAG_MEM (1L<<15)
00156 #define FLAG_NOT_WITH_ADDSUBppp (1L<<16)
00157
00158
00159 #define FLAG_MUL16 (1L<<17)
00160 #define FLAG_MUL32 (1L<<18)
00161 #define FLAG_ADDSUBppp (1L<<19)
00162 #define FLAG_DELAY (1L<<20)
00163 #define FLAG_LKR (1L<<21)
00164 #define FLAG_CVVA (FLAG_5|FLAG_6|FLAG_7)
00165 #define FLAG_C FLAG_7
00166 #define FLAG_ALL (FLAG_0 | \
00167 FLAG_1 | \
00168 FLAG_2 | \
00169 FLAG_3 | \
00170 FLAG_4 | \
00171 FLAG_5 | \
00172 FLAG_6 | \
00173 FLAG_7 | \
00174 FLAG_SM | \
00175 FLAG_RP | \
00176 FLAG_CONTROL)
00177
00178 int reloc_flag;
00179 #define RELOC_PCREL 1
00180 #define RELOC_ABS 2
00181 };
00182
00183 extern const struct d30v_opcode d30v_opcode_table[];
00184 extern const int d30v_num_opcodes;
00185
00186
00187 struct d30v_operand
00188 {
00189
00190 int length;
00191
00192
00193 int bits;
00194
00195
00196 int position;
00197
00198
00199 long flags;
00200 };
00201 extern const struct d30v_operand d30v_operand_table[];
00202
00203
00204
00205
00206
00207 #define OPERAND_DEST (1)
00208
00209
00210 #define OPERAND_NUM (2)
00211
00212
00213 #define OPERAND_ADDR (4)
00214
00215
00216 #define OPERAND_REG (8)
00217
00218
00219 #define OPERAND_PLUS (0x10)
00220
00221
00222 #define OPERAND_MINUS (0x20)
00223
00224
00225 #define OPERAND_SIGNED (0x40)
00226
00227
00228 #define OPERAND_SHIFT (0x80)
00229
00230
00231 #define OPERAND_FLAG (0x100)
00232
00233
00234 #define OPERAND_CONTROL (0x200)
00235
00236
00237 #define OPERAND_ACC (0x400)
00238
00239
00240 #define OPERAND_ATSIGN (0x800)
00241
00242
00243 #define OPERAND_ATPAR (0x1000)
00244
00245
00246 #define OPERAND_ATMINUS (0x2000)
00247
00248
00249
00250 #define OPERAND_NAME (0x4000)
00251
00252
00253 #define OPERAND_SPECIAL (0x8000)
00254
00255
00256 #define OPERAND_2REG (0x10000)
00257
00258
00259
00260 #define OPERAND_PCREL (0x20000)
00261
00262
00263 struct d30v_format
00264 {
00265 int form;
00266 int modifier;
00267 unsigned char operands[5];
00268 };
00269 extern const struct d30v_format d30v_format_table[];
00270
00271
00272
00273
00274
00275 struct d30v_insn
00276 {
00277 struct d30v_opcode *op;
00278 struct d30v_format *form;
00279 int ecc;
00280 };
00281
00282
00283
00284 #define REGISTER_MASK 0xFF
00285
00286 #endif