mips/include/mips.h

492 lines
12 KiB
C
Raw Normal View History

/* Copyright (c) 2024 Freya Murphy */
#ifndef __MIPS_H__
#define __MIPS_H__
2024-09-11 16:06:09 +00:00
#include <mlimits.h>
#include <stdint.h>
2024-09-11 16:06:09 +00:00
/* all mips registers $0-$31 */
enum mips_register {
MIPS_REG_ZERO = 0,
MIPS_REG_AT = 1,
MIPS_REG_V0 = 2,
MIPS_REG_V1 = 3,
MIPS_REG_A0 = 4,
MIPS_REG_A1 = 5,
MIPS_REG_A2 = 6,
MIPS_REG_A3 = 7,
MIPS_REG_T0 = 8,
MIPS_REG_T1 = 9,
MIPS_REG_T2 = 10,
MIPS_REG_T3 = 11,
MIPS_REG_T4 = 12,
MIPS_REG_T5 = 13,
MIPS_REG_T6 = 14,
MIPS_REG_T7 = 15,
MIPS_REG_S0 = 16,
MIPS_REG_S1 = 17,
MIPS_REG_S2 = 18,
MIPS_REG_S3 = 19,
MIPS_REG_S4 = 20,
MIPS_REG_S5 = 21,
MIPS_REG_S6 = 22,
MIPS_REG_S7 = 23,
MIPS_REG_T8 = 24,
MIPS_REG_T9 = 25,
MIPS_REG_K0 = 26,
MIPS_REG_K1 = 27,
MIPS_REG_GP = 28,
MIPS_REG_SP = 29,
MIPS_REG_FP = 30,
MIPS_REG_RA = 31,
2024-09-10 22:23:46 +00:00
};
2024-09-11 16:06:09 +00:00
/* mips instructions */
enum mips_instruction_type {
MIPS_INS_ADD,
MIPS_INS_ADDI,
MIPS_INS_ADDIU,
MIPS_INS_ADDU,
MIPS_INS_AND,
MIPS_INS_ANDI,
MIPS_INS_BAL,
MIPS_INS_BALC,
MIPS_INS_BC,
MIPS_INS_BEQ,
MIPS_INS_BEQL,
MIPS_INS_BGEZ,
MIPS_INS_BGEZAL,
MIPS_INS_BGEZALL,
MIPS_INS_BGEZL,
MIPS_INS_BGTZ,
MIPS_INS_BGTZL,
MIPS_INS_BLEZ,
MIPS_INS_BLEZL,
MIPS_INS_BLTZ,
MIPS_INS_BLTZAL,
MIPS_INS_BLTZALL,
MIPS_INS_BLTZL,
MIPS_INS_BNE,
MIPS_INS_BNEL,
MIPS_INS_DIV,
2024-09-13 15:11:18 +00:00
MIPS_INS_MOD,
2024-09-11 16:06:09 +00:00
MIPS_INS_DIVU,
2024-09-13 15:11:18 +00:00
MIPS_INS_MODU,
2024-09-11 16:06:09 +00:00
MIPS_INS_J,
MIPS_INS_JAL,
MIPS_INS_JALR,
MIPS_INS_JALX,
MIPS_INS_JR,
MIPS_INS_LB,
MIPS_INS_LBU,
MIPS_INS_LH,
MIPS_INS_LHU,
MIPS_INS_LUI,
MIPS_INS_LW,
MIPS_INS_LWL,
MIPS_INS_LWR,
MIPS_INS_MFHI,
MIPS_INS_MFLO,
MIPS_INS_MTHI,
MIPS_INS_MTLO,
2024-09-13 15:11:18 +00:00
MIPS_INS_MUL,
MIPS_INS_MUH,
MIPS_INS_MULU,
MIPS_INS_MUHU,
2024-09-11 16:06:09 +00:00
MIPS_INS_MULT,
MIPS_INS_SB,
MIPS_INS_SH,
MIPS_INS_SW,
MIPS_INS_SWL,
MIPS_INS_SWR,
MIPS_INS_SLL,
MIPS_INS_SLLV,
MIPS_INS_SLT,
MIPS_INS_SLTI,
MIPS_INS_SLTIU,
MIPS_INS_SLTU,
MIPS_INS_SRA,
MIPS_INS_SRAV,
MIPS_INS_SRL,
MIPS_INS_SRLV,
MIPS_INS_SUB,
MIPS_INS_SUBU,
MIPS_INS_SYSCALL,
MIPS_INS_OR,
MIPS_INS_ORI,
MIPS_INS_NOR,
MIPS_INS_XOR,
MIPS_INS_XORI,
// gets the size of the enum
__MIPS_INS_LEN,
};
2024-09-12 12:37:46 +00:00
union mips_instruction_data {
2024-09-13 15:11:18 +00:00
/* raw ins */
uint32_t raw : 32;
/* register type */
struct {
uint32_t funct : 6;
uint32_t shamt : 5;
uint32_t rd : 5;
uint32_t rt : 5;
uint32_t rs : 5;
uint32_t op : 6;
};
/* immediate type */
struct {
uint32_t immd : 16;
uint32_t : 16;
};
/* jump type */
struct {
uint32_t target : 26;
uint32_t : 6;
};
/* branch compact */
struct {
int32_t offs26 : 26;
uint32_t : 6;
};
/* branch */
struct {
int32_t offset : 16;
uint32_t bfunct : 5;
uint32_t : 11;
};
2024-09-12 12:37:46 +00:00
} __attribute__((packed));
2024-09-11 16:06:09 +00:00
/* mips instruction information */
struct mips_instruction {
// metadata
enum mips_instruction_type type;
const char *name;
// data
2024-09-12 12:37:46 +00:00
union mips_instruction_data data;
2024-09-11 16:06:09 +00:00
};
2024-09-13 15:11:18 +00:00
#define MIPS_INS(ins, ...) \
2024-09-11 16:06:09 +00:00
[MIPS_INS_ ##ins] = { \
MIPS_INS_ ##ins, \
#ins, \
2024-09-13 15:11:18 +00:00
.data = { __VA_ARGS__ } \
2024-09-11 16:06:09 +00:00
}, \
static const struct mips_instruction mips_instructions[] = {
/* ADD - add */
#define MIPS_OP_SPECIAL 0b000000
#define MIPS_FUNCT_ADD 0b100000
2024-09-13 15:11:18 +00:00
MIPS_INS(ADD, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_ADD)
2024-09-11 16:06:09 +00:00
/* ADDI - add immediate */
#define MIPS_OP_ADDI 0b001000
2024-09-13 15:11:18 +00:00
MIPS_INS(ADDI, .op = MIPS_OP_ADDI)
2024-09-11 16:06:09 +00:00
/* ADDIU - add immediate unsigned */
#define MIPS_OP_ADDIU 0b001001
2024-09-13 15:11:18 +00:00
MIPS_INS(ADDIU, .op = MIPS_OP_ADDIU)
2024-09-11 16:06:09 +00:00
/* ADDU - add unsigned */
#define MIPS_FUNCT_ADDU 0b100001
2024-09-13 15:11:18 +00:00
MIPS_INS(ADDU, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_ADDU)
2024-09-11 16:06:09 +00:00
/* AND - and */
#define MIPS_FUNCT_AND 0b100100
2024-09-13 15:11:18 +00:00
MIPS_INS(AND, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_AND)
2024-09-11 16:06:09 +00:00
/* ANDI - and immediate */
#define MIPS_OP_ANDI 0b001100
2024-09-13 15:11:18 +00:00
MIPS_INS(ANDI, .op = MIPS_OP_ANDI)
2024-09-11 16:06:09 +00:00
/* BAL - branch and link */
#define MIPS_OP_REGIMM 0b000001
#define MIPS_FUNCT_BAL 0b10001
2024-09-13 15:11:18 +00:00
MIPS_INS(BAL, .op = MIPS_OP_REGIMM, .funct = MIPS_FUNCT_BAL)
2024-09-11 16:06:09 +00:00
/* BALC - branch and link, compact */
#define MIPS_OP_BALC 0b111010
2024-09-13 15:11:18 +00:00
MIPS_INS(BALC, .op = MIPS_OP_BALC)
2024-09-11 16:06:09 +00:00
/* BC - branch, compact */
#define MIPS_OP_BC 0b110010
2024-09-13 15:11:18 +00:00
MIPS_INS(BC, .op = MIPS_OP_BC)
2024-09-11 16:06:09 +00:00
/* BEQ - branch on equal */
#define MIPS_OP_BEQ 0b000100
2024-09-13 15:11:18 +00:00
MIPS_INS(BEQ, .op = MIPS_OP_BEQ)
2024-09-11 16:06:09 +00:00
/* BEQL - branch on equal likely */
#define MIPS_OP_BEQL 0b010100
2024-09-13 15:11:18 +00:00
MIPS_INS(BEQL, .op = MIPS_OP_BEQL)
2024-09-11 16:06:09 +00:00
/* BGEZ - branch on greater than or equal to zero */
#define MIPS_FUNCT_BGEZ 0b00001
2024-09-13 15:11:18 +00:00
MIPS_INS(BGEZ, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BGEZ)
2024-09-11 16:06:09 +00:00
/* BGEZAL - branch on greater than or equal to zero and link */
#define MIPS_FUNCT_BGEZAL 0b10001
2024-09-13 15:11:18 +00:00
MIPS_INS(BGEZAL, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BGEZAL)
2024-09-11 16:06:09 +00:00
/* BGEZAL - branch on greater than or equal to zero and link likely */
#define MIPS_FUNCT_BGEZALL 0b10011
2024-09-13 15:11:18 +00:00
MIPS_INS(BGEZALL, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BGEZALL)
2024-09-11 16:06:09 +00:00
/* BGEZL - branch on greater than or equal to zero likely */
#define MIPS_FUNCT_BGEZL 0b00011
2024-09-13 15:11:18 +00:00
MIPS_INS(BGEZL, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BGEZL)
2024-09-11 16:06:09 +00:00
/* BGTZ - branch on greater than zero */
#define MIPS_OP_BGTZ 0b000111
2024-09-13 15:11:18 +00:00
MIPS_INS(BGTZ, .op = MIPS_OP_BGTZ)
2024-09-11 16:06:09 +00:00
/* BGTZL - branch on greater than zero likely */
#define MIPS_OP_BGTZL 0b010111
2024-09-13 15:11:18 +00:00
MIPS_INS(BGTZL, .op = MIPS_OP_BGTZL)
2024-09-11 16:06:09 +00:00
/* BLEZ - branch on less than or equal to zero */
#define MIPS_OP_BLEZ 0b000110
2024-09-13 15:11:18 +00:00
MIPS_INS(BLEZ, .op = MIPS_OP_BLEZ)
2024-09-11 16:06:09 +00:00
/* BLEZL - branch on less than or equal to zero likely */
#define MIPS_OP_BLEZL 0b010110
2024-09-13 15:11:18 +00:00
MIPS_INS(BLEZL, .op = MIPS_OP_BLEZL)
2024-09-11 16:06:09 +00:00
/* BLTZ - branch on less than zero */
#define MIPS_FUNCT_BLTZ 0b00000
2024-09-13 15:11:18 +00:00
MIPS_INS(BLTZ, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BLTZ)
2024-09-11 16:06:09 +00:00
/* BLTZAL - branch on less than zero and link */
#define MIPS_FUNCT_BLTZAL 0b10000
2024-09-13 15:11:18 +00:00
MIPS_INS(BLTZAL, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BLTZAL)
2024-09-11 16:06:09 +00:00
/* BLTZALL - branch on less than zero and link likely */
#define MIPS_FUNCT_BLTZALL 0b10010
2024-09-13 15:11:18 +00:00
MIPS_INS(BLTZALL, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BLTZALL)
2024-09-11 16:06:09 +00:00
/* BLTZL - branch on less than zero likely */
#define MIPS_FUNCT_BLTZL 0b00010
2024-09-13 15:11:18 +00:00
MIPS_INS(BLTZL, .op = MIPS_OP_REGIMM, .bfunct = MIPS_FUNCT_BLTZL)
2024-09-11 16:06:09 +00:00
/* BNE - branch on not equal */
#define MIPS_OP_BNE 0b000101
2024-09-13 15:11:18 +00:00
MIPS_INS(BNE, .op = MIPS_OP_BNE)
2024-09-11 16:06:09 +00:00
/* BNEL - branch on not equal likely */
#define MIPS_OP_BNEL 0b010101
2024-09-13 15:11:18 +00:00
MIPS_INS(BNEL, .op = MIPS_OP_BNEL)
2024-09-11 16:06:09 +00:00
/* DIV - divide */
2024-09-13 15:11:18 +00:00
#define MIPS_FUNCT_SOP32 0b011010
#define MIPS_SOP32_DIV 0b00010
MIPS_INS(DIV, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP32_DIV,
.funct = MIPS_FUNCT_SOP32)
/* MOD - modulo */
#define MIPS_SOP32_MOD 0b00011
MIPS_INS(MOD, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP32_MOD,
.funct = MIPS_FUNCT_SOP32)
2024-09-11 16:06:09 +00:00
/* DIVU - divide unsigned */
2024-09-13 15:11:18 +00:00
#define MIPS_FUNCT_SOP33 0b011011
#define MIPS_SOP33_DIVU 0b00010
MIPS_INS(DIVU, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP33_DIVU,
.funct = MIPS_FUNCT_SOP33)
/* MODU - modulo unsigned */
#define MIPS_SOP33_MODU 0b00011
MIPS_INS(MODU, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP33_MODU,
.funct = MIPS_FUNCT_SOP33)
2024-09-11 16:06:09 +00:00
/* J - jump */
#define MIPS_OP_J 0b000010
2024-09-13 15:11:18 +00:00
MIPS_INS(J, .op = MIPS_OP_J)
2024-09-11 16:06:09 +00:00
/* JAL - jump and link */
#define MIPS_OP_JAL 0b000011
2024-09-13 15:11:18 +00:00
MIPS_INS(JAL, .op = MIPS_OP_JAL)
2024-09-11 16:06:09 +00:00
/* JALR - jump and link register */
#define MIPS_FUNCT_JALR 0b001001
2024-09-13 15:11:18 +00:00
MIPS_INS(JALR, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_JALR)
2024-09-11 16:06:09 +00:00
/* JALX - jump and link exchange */
#define MIPS_OP_JALX 0b011101
2024-09-13 15:11:18 +00:00
MIPS_INS(JALX, .op = MIPS_OP_JALX)
2024-09-11 16:06:09 +00:00
/* JR - jump register */
#define MIPS_FUNCT_JR 0b001000
2024-09-13 15:11:18 +00:00
MIPS_INS(JR, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_JR)
2024-09-11 16:06:09 +00:00
/* LB - load byte */
#define MIPS_OP_LB 0b100000
2024-09-13 15:11:18 +00:00
MIPS_INS(LB, .op = MIPS_OP_LB)
2024-09-11 16:06:09 +00:00
/* LBU - load byte unsigned */
#define MIPS_OP_LBU 0b100100
2024-09-13 15:11:18 +00:00
MIPS_INS(LBU, .op = MIPS_OP_LBU)
2024-09-11 16:06:09 +00:00
/* LH - load half */
#define MIPS_OP_LH 0b100001
2024-09-13 15:11:18 +00:00
MIPS_INS(LH, .op = MIPS_OP_LH)
2024-09-11 16:06:09 +00:00
/* LHU - load half unsigned */
#define MIPS_OP_LHU 0b100101
2024-09-13 15:11:18 +00:00
MIPS_INS(LHU, .op = MIPS_OP_LHU)
2024-09-11 16:06:09 +00:00
/* LUI - load upper immediate */
#define MIPS_OP_LUI 0b001111
2024-09-13 15:11:18 +00:00
MIPS_INS(LUI, .op = MIPS_OP_LUI)
2024-09-11 16:06:09 +00:00
/* LW - load word */
#define MIPS_OP_LW 0b100011
2024-09-13 15:11:18 +00:00
MIPS_INS(LW, .op = MIPS_OP_LW)
2024-09-11 16:06:09 +00:00
/* LWL - load word left */
#define MIPS_OP_LWL 0b100010
2024-09-13 15:11:18 +00:00
MIPS_INS(LWL, .op = MIPS_OP_LWL)
2024-09-11 16:06:09 +00:00
/* LWR - load word right */
#define MIPS_OP_LWR 0b100110
2024-09-13 15:11:18 +00:00
MIPS_INS(LWR, .op = MIPS_OP_LWR)
2024-09-11 16:06:09 +00:00
/* MFHI - move from hi */
#define MIPS_FUNCT_MFHI 0b010000
2024-09-13 15:11:18 +00:00
MIPS_INS(MFHI, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_MFHI)
2024-09-11 16:06:09 +00:00
/* MFLO - move from hi */
#define MIPS_FUNCT_MFLO 0b010010
2024-09-13 15:11:18 +00:00
MIPS_INS(MFLO, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_MFLO)
2024-09-11 16:06:09 +00:00
/* MTHI - move from hi */
#define MIPS_FUNCT_MTHI 0b010001
2024-09-13 15:11:18 +00:00
MIPS_INS(MTHI, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_MTHI)
2024-09-11 16:06:09 +00:00
/* MTLO - move from hi */
#define MIPS_FUNCT_MTLO 0b010011
2024-09-13 15:11:18 +00:00
MIPS_INS(MTLO, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_MTLO)
/* MUL - multiply low word */
#define MIPS_FUNCT_SOP30 0b011000
#define MIPS_SOP30_MUL 0b00010
MIPS_INS(MUL, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP30_MUL,
.funct = MIPS_FUNCT_SOP30)
/* MUH - multiply high word */
#define MIPS_SOP30_MUH 0b00011
MIPS_INS(MUH, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP30_MUH,
.funct = MIPS_FUNCT_SOP30)
/* MULU - multiply low word unsigned */
#define MIPS_FUNCT_SOP31 0b011001
#define MIPS_SOP31_MULU 0b00010
MIPS_INS(MULU, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP31_MULU,
.funct = MIPS_FUNCT_SOP31)
/* MUHU - multiply high word unsgined */
#define MIPS_SOP31_MUHU 0b00011
MIPS_INS(MUHU, .op = MIPS_OP_SPECIAL, .shamt = MIPS_SOP31_MUHU,
.funct = MIPS_FUNCT_SOP31)
/* MULT - multiply (OLD) */
2024-09-11 16:06:09 +00:00
#define MIPS_FUNCT_MULT 0b011000
2024-09-13 15:11:18 +00:00
MIPS_INS(MULT, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_MULT)
2024-09-11 16:06:09 +00:00
/* SB - store byte */
#define MIPS_OP_SB 0b101000
2024-09-13 15:11:18 +00:00
MIPS_INS(SB, .op = MIPS_OP_SB)
2024-09-11 16:06:09 +00:00
/* SH - store half */
#define MIPS_OP_SH 0b101001
2024-09-13 15:11:18 +00:00
MIPS_INS(SH, .op = MIPS_OP_SH)
2024-09-11 16:06:09 +00:00
/* SW - store word */
#define MIPS_OP_SW 0b101011
2024-09-13 15:11:18 +00:00
MIPS_INS(SW, .op = MIPS_OP_SW)
2024-09-11 16:06:09 +00:00
/* SWL - store word left */
#define MIPS_OP_SWL 0b101010
2024-09-13 15:11:18 +00:00
MIPS_INS(SWL, .op = MIPS_OP_SWL)
2024-09-11 16:06:09 +00:00
/* SWR - store word right */
#define MIPS_OP_SWR 0b101110
2024-09-13 15:11:18 +00:00
MIPS_INS(SWR, .op = MIPS_OP_SWR)
2024-09-11 16:06:09 +00:00
/* SLL - shift left logical */
#define MIPS_FUNCT_SLL 0b000000
2024-09-13 15:11:18 +00:00
MIPS_INS(SLL, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SLL)
2024-09-11 16:06:09 +00:00
/* SLLV - shift left logical variable */
#define MIPS_FUNCT_SLLV 0b000100
2024-09-13 15:11:18 +00:00
MIPS_INS(SLLV, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SLLV)
2024-09-11 16:06:09 +00:00
/* SLT - set less then */
#define MIPS_FUNCT_SLT 0b101010
2024-09-13 15:11:18 +00:00
MIPS_INS(SLT, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SLT)
2024-09-11 16:06:09 +00:00
/* SLTI - set less then immediate */
#define MIPS_OP_SLTI 0b001010
2024-09-13 15:11:18 +00:00
MIPS_INS(SLTI, .op = MIPS_OP_SLTI)
2024-09-11 16:06:09 +00:00
/* SLTIU - set less then imemdiate unsigned */
#define MIPS_OP_SLTIU 0b001011
2024-09-13 15:11:18 +00:00
MIPS_INS(SLTIU, .op = MIPS_OP_SLTIU)
2024-09-11 16:06:09 +00:00
/* SLTU - set less than unsigned */
#define MIPS_FUNCT_SLTU 0b101011
2024-09-13 15:11:18 +00:00
MIPS_INS(SLTU, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SLTU)
2024-09-11 16:06:09 +00:00
/* SRA - shift right arithmetic */
#define MIPS_FUNCT_SRA 0b000011
2024-09-13 15:11:18 +00:00
MIPS_INS(SRA, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SRA)
2024-09-11 16:06:09 +00:00
/* SRAV - shift right arithmetic variable */
#define MIPS_FUNCT_SRAV 0b000111
2024-09-13 15:11:18 +00:00
MIPS_INS(SRAV, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SRAV)
2024-09-11 16:06:09 +00:00
/* SRL - shift right logical */
#define MIPS_FUNCT_SRL 0b000010
2024-09-13 15:11:18 +00:00
MIPS_INS(SRL, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SRL)
2024-09-11 16:06:09 +00:00
/* SRLV - shift right logical variable */
#define MIPS_FUNCT_SRLV 0b000110
2024-09-13 15:11:18 +00:00
MIPS_INS(SRLV, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SRLV)
2024-09-11 16:06:09 +00:00
/* SUB - subtract */
#define MIPS_FUNCT_SUB 0b100010
2024-09-13 15:11:18 +00:00
MIPS_INS(SUB, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SUB)
2024-09-11 16:06:09 +00:00
/* SUBU - subtract unsigned */
#define MIPS_FUNCT_SUBU 0b100011
2024-09-13 15:11:18 +00:00
MIPS_INS(SUBU, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SUBU)
2024-09-11 16:06:09 +00:00
/* SYSCALL - syscall */
#define MIPS_FUNCT_SYSCALL 0b001100
2024-09-13 15:11:18 +00:00
MIPS_INS(SYSCALL, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_SYSCALL)
2024-09-11 16:06:09 +00:00
/* OR - or */
#define MIPS_FUNCT_OR 0b100101
2024-09-13 15:11:18 +00:00
MIPS_INS(OR, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_OR)
2024-09-11 16:06:09 +00:00
/* ORI - or imemdiate */
#define MIPS_OP_ORI 0b001101
2024-09-13 15:11:18 +00:00
MIPS_INS(ORI, .op = MIPS_OP_ORI)
2024-09-11 16:06:09 +00:00
/* NOR - not or */
#define MIPS_FUNCT_NOR 0b100111
2024-09-13 15:11:18 +00:00
MIPS_INS(NOR, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_NOR)
2024-09-11 16:06:09 +00:00
/* XOR - exclusive or */
#define MIPS_FUNCT_XOR 0b100110
2024-09-13 15:11:18 +00:00
MIPS_INS(XOR, .op = MIPS_OP_SPECIAL, .funct = MIPS_FUNCT_XOR)
2024-09-11 16:06:09 +00:00
/* XORI - exclusive or immediate */
#define MIPS_OP_XORI 0b001110
2024-09-13 15:11:18 +00:00
MIPS_INS(XORI, .op = MIPS_OP_XORI)
2024-09-11 16:06:09 +00:00
};
#undef MIPS_INS
#endif /* __MIPS_H__ */