📄 instr.hh
字号:
#ifndef koala_instr_hh_included#define koala_instr_hh_included#include <mips64/types.hh>typedef MIPS64Types::Instr Instr;// Instruction decoder functions.// I-Type (Immediate)inline Instr opcode(Instr instr) { return bits(instr, 31, 26); }inline Instr rs(Instr instr) { return bits(instr, 25, 21); }inline Instr rt(Instr instr) { return bits(instr, 20, 16); }inline Instr rd(Instr instr) { return bits(instr, 15, 11); }inline Instr immediate(Instr instr) { return bits(instr, 15, 0); }// Some aliases for the above.inline Instr base(Instr instr) { return bits(instr, 25, 21); }inline Instr offset(Instr instr) { return bits(instr, 15, 0); }// J-Type (Jump)inline Instr target(Instr instr) { return bits(instr, 25, 0); }// R-Type (Register)inline Instr shamt(Instr instr) { return bits(instr, 10, 6); }inline Instr funct(Instr instr) { return bits(instr, 5, 0); }// COP1 (Floating Point)inline Instr fmt(Instr instr) { return bits(instr, 25, 21); }inline Instr ft(Instr instr) { return bits(instr, 20, 16); }inline Instr fs(Instr instr) { return bits(instr, 15, 11); }inline Instr fd(Instr instr) { return bits(instr, 10, 6); }inline Instr function(Instr instr) { return bits(instr, 5, 0); }inline Instr cond(Instr instr) { return bits(instr, 3, 0); }// COPz (Coprocessor)inline Instr cofun(Instr instr) { return bits(instr, 24, 0); } // The (op) field.enum { SPECIAL = 000, REGIMM = 001, J = 002, JAL = 003, BEQ = 004, BNE = 005, BLEZ = 006, BGTZ = 007, ADDI = 010, ADDIU = 011, SLTI = 012, SLTIU = 013, ANDI = 014, ORI = 015, XORI = 016, LUI = 017, COP0 = 020, COP1 = 021, COP2 = 022, // reserved = 023, BEQL = 024, BNEL = 025, BLEZL = 026, BGTZL = 027, DADDI = 030, DADDIU = 031, LDL = 032, LDR = 033, // reserved = 034, // reserved = 035, // reserved = 036, // reserved = 037, LB = 040, LH = 041, LWL = 042, LW = 043, LBU = 044, LHU = 045, LWR = 046, LWU = 047, SB = 050, SH = 051, SWL = 052, SW = 053, SDL = 054, SDR = 055, SWR = 056, CACHE = 057, LL = 060, LWC1 = 061, LWC2 = 062, // reserved = 063, LLD = 064, LDC1 = 065, LDC2 = 066, LD = 067, SC = 070, SWC1 = 071, SWC2 = 072, // reserved = 073, SCD = 074, SDC1 = 075, SDC2 = 076, SD = 077};// The (function) field when (op == SPECIAL)enum { SLL = 000, // reserved = 001, SRL = 002, SRA = 003, SLLV = 004, // reserved = 005, SRLV = 006, SRAV = 007, JR = 010, JALR = 011, // reserved = 012, // reserved = 013, SYSCALL = 014, BREAK = 015, // reserved = 016, SYNC = 017, MFHI = 020, MTHI = 021, MFLO = 022, MTLO = 023, DSLLV = 024, // reserved = 025, DSRLV = 026, DSRAV = 027, MULT = 030, MULTU = 031, DIV = 032, DIVU = 033, DMULT = 034, DMULTU = 035, DDIV = 036, DDIVU = 037, ADD = 040, ADDU = 041, SUB = 042, SUBU = 043, AND = 044, OR = 045, XOR = 046, NOR = 047, // reserved = 050, // reserved = 051, SLT = 052, SLTU = 053, DADD = 054, DADDU = 055, DSUB = 056, DSUBU = 057, TGE = 060, TGEU = 061, TLT = 062, TLTU = 063, TEQ = 064, // reserved = 065, TNE = 066, // reserved = 067, DSLL = 070, // reserved = 071, DSRL = 072, DSRA = 073, DSLL32 = 074, // reserved = 075, DSRL32 = 076, DSRA32 = 077};// The (rt) field when (op == REGIMM)enum { BLTZ = 000, BGEZ = 001, BLTZL = 002, BGEZL = 003, // reserved = 004, // reserved = 005, // reserved = 006, // reserved = 007, TGEI = 010, TGEIU = 011, TLTI = 012, TLTIU = 013, TEQI = 014, // reserved = 015, TNEI = 016, // reserved = 017, BLTZAL = 020, BGEZAL = 021, BLTZALL = 022, BGEZALL = 023 // reserved = 024, // reserved = 025, // reserved = 026, // reserved = 027, // reserved = 030, // reserved = 031, // reserved = 032, // reserved = 033, // reserved = 034, // reserved = 035, // reserved = 036, // reserved = 037};// The (rs) field of COPz rs instructions.enum { MFCz = 000, DMFCz = 001, CFCz = 002, // reserved = 003, MTCz = 004, DMTCz = 005, CTCz = 006, // reserved = 007, BCz = 010};// The (rt) field of COPz rt instructions.enum { BCzF = 000, BCzT = 001, BCzFL = 002, BCzTL = 003};// CP0 (function) field.enum { TLBR = 001, TLBWI = 002, TLBWR = 006, TLBP = 010, ERET = 030, WAIT = 040};// The (function) field.enum { FADD = 000, FSUB = 001, FMUL = 002, FDIV = 003, SQRT = 004, ABS = 005, MOV = 006, NEG = 007, ROUND_L = 010, TRUNC_L = 011, CEIL_L = 012, FLOOR_L = 013, ROUND_W = 014, TRUNC_W = 015, CEIL_W = 016, FLOOR_W = 017, // reserved = 020, // reserved = 021, // reserved = 022, // reserved = 023, // reserved = 024, // reserved = 025, // reserved = 026, // reserved = 027, // reserved = 030, // reserved = 031, // reserved = 032, // reserved = 033, // reserved = 034, // reserved = 035, // reserved = 036, // reserved = 037, CVT_S = 040, CVT_D = 041, // reserved = 042, // reserved = 043, CVT_W = 044, CVT_L = 045, // reserved = 046, // reserved = 047, // reserved = 050, // reserved = 051, // reserved = 052, // reserved = 053, // reserved = 054, // reserved = 055, // reserved = 056, // reserved = 057, C_F = 060, C_UN = 061, C_EQ = 062, C_UEQ = 063, C_OLT = 064, C_ULT = 065, C_OLE = 066, C_ULE = 067, C_SF = 070, C_NGLE = 071, C_SEQ = 072, C_NGL = 073, C_LT = 074, C_NGE = 075, C_LE = 076, C_NGT = 077};// The (mt) field.enum { // 0-15 // Reserved S = 16, // IEEE 754 single-precision floating-point D = 17, // IEEE 754 double-precision floating-point // 18-19 // Reserved W = 20, // 32-bit binary fixed-point L = 21 // 64-bit binary fixed-point // 22-31 // Reserved};// The floating-point condition codes.enum { unordered = 0, equal = 1, less = 2, signalling = 3};#endif // koala_instr_hh_included
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -