home *** CD-ROM | disk | FTP | other *** search
- /*
- * See optab.c.
- */
- #define OP(a,b,c,d) {a,b,c,d}
-
- /*
- * An entry in the table of instructions
- * each of which describes the known
- * info. about the instruction's arguments
- * - see optab.c.
- */
- typedef struct instrn instrn;
- struct instrn
- {
- char *i_name; /* Printable name. */
- int i_format; /* Instruction format -- see p.A-3. */
- #define IF_U 0 /* undefined */
- #define IF_I 1 /* immediate */
- #define IF_J 2 /* jump */
- #define IF_R 3 /* register */
- /* See p.B-2 and foll. */
- #define IF_I1 4 /* immediate(cop1) */
- #define IF_M1 5 /* move (cop1) */
- #define IF_C1 6 /* control (cop1) */
- #define IF_R1 7 /* register (cop1) */
- dinstrn *(*i_handler)(); /* Routine that performs the instn's fn.*/
- char *i_pageno; /* The "mips RISC ARCHITECTURE" book. */
- };
-
- /*
- * Floating point register formats.
- */
- #define FMT_SINGLE 0
- #define FMT_DOUBLE 1
- #define FMT_FIXED 4
-
- /*
- * Extract subfields from an instruction.
- */
- #define i_to_op(i) (((i) >> 26) & 0x3F)
- #define i_to_rs(i) (((i) >> 21) & 0x1F)
- #define i_to_rt(i) (((i) >> 16) & 0x1F)
- #define i_to_immediate(i) (((i) >> 0) & 0xFFFF)
- #define i_to_target(i) (((i) >> 0) & 0x3FFFFFF)
- #define i_to_rd(i) (((i) >> 11) & 0x1F)
- #define i_to_shamt(i) (((i) >> 6) & 0x1F)
- #define i_to_funct(i) (((i) >> 0) & 0x3F)
- #define is_cop1_group1(i) ((((i) >> 25) & 0x1) == 0)
- #define i_to_cop1_group1(i) ((((i) >> 16) & 0x1) | (((i) >> 21) & (0x7 << 1)))
- #define i_to_cop1_group2(i) i_to_funct(i)
- #define i_to_fmt(i) (i_to_rs(i) & 0xF)
- #define i_to_ft(i) i_to_rt(i)
- #define i_to_fs(i) i_to_rd(i)
- #define i_to_fd(i) i_to_shamt(i)
-