📄 mc_opc.h
字号:
/* * Copyright (C) 1996-1998 by the Board of Trustees * of Leland Stanford Junior University. * * This file is part of the SimOS distribution. * See LICENSE file for terms of the license. * */ /* * mc_opc.h - Opcode definitions for the MXS compiler and simulator * * NOTE: When the opcode numbering below is modified, the * tables and routines in mc_opc.c should be checked to see * if they need changes. * * Jim Bennett * 1993, 1994, 1995 */ /* * INST - The format of all instructions for MXS */typedef struct { int op; /* Opcode */ int r2; short r1, r3; /* Register operands */ int imm; /* Immediate operand */ } INST; /* * Handy macros for checking out the type of instructions * * is_branch - Return true if opcode is a branch (=> not a call) * is_branch_imm - Return true if opcode is a branch to an * immediate destination */#define is_branch_imm(op) (((op) <= OPBC1TL) && ((op) >= OPJ))#define is_branch(op) (((op) <= OPJRET) && ((op) >= OPJ))#define is_call_imm(op) (((op) <= OPBGEZALL) && ((op) >= OPJAL))#define is_call(op) (((op) <= OPJALR) && ((op) >= OPJAL))#define is_conditional(op) ((((op) <= OPBGEZALL)&&((op) >= OPBLTZAL)) || \ (((op) <= OPBC1TL) && ((op) >= OPBEQ)) )#define is_indirect_branch(op) ((((op) <= OPJRET) && ((op) >= OPJR)) || \ ((op) == OPJALR) )#define is_sys(op) ((((op) <= OPBREAK) && ((op) >= OPSYSCALL) || \ ((op) == OPCP0) || ((op) == OPBDOOR) || \ ((op) == OPLDHACK)) || ((op) == OPSDHACK))#define is_load(op) ((((op) <= OPLDC1) && ((op) >= OPLB)) || \ ((op) == OPLL))#define is_store(op) ((((op) <= OPSDC1) && ((op) >= OPSB)) || \ ((op) == OPSC))#define is_prefetch(op) ((op) == OPPREF)#define is_ldst(op) ((((op) <= OPSDC1) && ((op) >= OPLB)) || \ ((op) == OPLL) || ((op) == OPSC) || ((op) == OPPREF))#define is_fp_ctl(op) ((op) == CTL_FPC)#define is_sc(op) ((op) == OPSC)#ifdef BRANCH_LIKELY#define is_likely(op) ((((op) <= OPBC1TL) && ((op) >= OPBEQL)) || \ (((op) <= OPBGEZALL) && ((op) >= OPBLTZALL)) )#else#define is_likely(op) (0)#endif /* * Opcode mnemonics * * Generally they follow the mnemonics in the Kane book * (MIPS RISC Architecture). */#define OPILL 0 /* Illegal opcode */#define OPJ 1 /* is_branch/is_branch_imm */#define OPBEQ 2 /* group */#define OPBNE 3#define OPBLEZ 4#define OPBGTZ 5#define OPBLTZ 6#define OPBGEZ 7#define OPBC1F 8#define OPBC1T 9#define OPBEQL 10#define OPBNEL 11#define OPBLEZL 12#define OPBGTZL 13#define OPBLTZL 14#define OPBGEZL 15#define OPBC1FL 16#define OPBC1TL 17#define OPJR 18#define OPJRET 19 /* Like JR, but used to */ /* indicate subroutine */ /* return */#define OPJAL 20 /* is_call/is_call_imm */#define OPBLTZAL 21 /* group */#define OPBGEZAL 22#define OPBLTZALL 23#define OPBGEZALL 24#define OPJALR 25#define OPSYSCALL 26 /* is_sys group */#define OPBREAK 27#define OPLB 28 /* is_load group */#define OPLH 29#define OPLWL 30#define OPLW 31#define OPLBU 32#define OPLHU 33#define OPLWR 34#define OPLWC1 35#define OPLDC1 36#define OPSB 37 /* is_store group */#define OPSH 38#define OPSWL 39#define OPSW 40#define OPSWR 41#define OPSWC1 42#define OPSDC1 43#define OPADDI 44 /* ALU operations */#define OPADDIU 45#define OPSLTI 46#define OPSLTIU 47#define OPANDI 48#define OPORI 49#define OPXORI 50#define OPHCPY 51 /* Specialized OPCPY */ /* for half a reg pair */#define OPSLL 52#define OPSRL 53#define OPSRA 54#define OPSLLV 55#define OPSRLV 56#define OPSRAV 57#define OPMULT 58#define OPMULTU 59#define OPDIV 60#define OPDIVU 61#define OPADD 62#define OPADDU 63#define OPSUB 64#define OPSUBU 65#define OPAND 66#define OPOR 67#define OPXOR 68#define OPNOR 69#define OPSLT 70#define OPSLTU 71#define OPCPY 72 /* Floating point operations */#define OPCVTSW 73 /* CVT.S.W */#define OPCVTDW 74 /* CVT.D.W */#define OPFADDS 75 /* Single */#define OPFSUBS 76 /* precision */#define OPFMULS 77 /* floating */#define OPFDIVS 78 /* point */#define OPFSQRTS 79 /* operations */#define OPFABSS 80#define OPFNEGS 81#define OPFROUNDS 82#define OPFTRUNCS 83#define OPFCEILS 84#define OPFFLOORS 85#define OPCVTDS 86#define OPCVTWS 87#define OPCFS 88 /* C.F.S */#define OPCUNS 89 /* C.UN.S */#define OPCEQS 90 /* etc. */#define OPCUEQS 91#define OPCOLTS 92#define OPCULTS 93#define OPCOLES 94#define OPCULES 95#define OPCSFS 96#define OPCNGLES 97#define OPCSEQS 98#define OPCNGLS 99#define OPCLTS 100#define OPCNGES 101#define OPCLES 102#define OPCNGTS 103#define OPFADDD 104 /* Double */#define OPFSUBD 105 /* precision */#define OPFMULD 106 /* floating */#define OPFDIVD 107 /* point */#define OPFSQRTD 108 /* operations */#define OPFABSD 109#define OPFMOVD 110#define OPFNEGD 111#define OPFROUNDD 112#define OPFTRUNCD 113#define OPFCEILD 114#define OPFFLOORD 115#define OPCVTSD 116#define OPCVTWD 117#define OPCEQD 118 /* C.EQ.D */#define OPCUEQD 119#define OPCOLTD 120#define OPCULTD 121#define OPCOLED 122#define OPCULED 123#define OPCSEQD 124#define OPCNGLD 125#define OPCLTD 126#define OPCNGED 127#define OPCLED 128#define OPCNGTD 129#define CTL_FPC 130 /* Update of floating */ /* point rounding mode */#define CTL_CFC 131 /* Read of FP control reg */#define CTL_DLY 132 /* Branch delay cycle */#define OPCP0 133#define OPBDOOR 134#define OPLL 135#define OPSC 136#define OPCPYC1 137 /* Copies to/from cop-1 */ #define OPHCPYC1 138#define OPCP0_SPEC 139 /* CP0 that can run speculatively */#define OPPREF 140#define OPLDHACK 141 /* Hacked LD opcode */#define OPSDHACK 142 /* Hacked SD opcode */#define MAX_OP 143 /* * Global tables and procedures defined in mc_opc.c */extern char *opcode_mnemonics[MAX_OP];extern int lat_tab [MAX_OP];extern int immediate_unconditional (INST *ip);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -