首页 > 代码库 > MIPS rev.1 指令参数

MIPS rev.1 指令参数

由于MIPS各个版本之间的操作数会变,如果出现无法识别的情况

需要根据官方的MIPS instruction手册逐条核对,此处的版本为Rev.1

 

        //******MIPS-55*********//    parameter   //SPECIAL OP LIST   5-0                ADDU    =   6b100001,                SUBU    =   6b100011,                ADD     =   6b100000,                SUB     =   6b100010,                AND     =   6b100100,                OR      =   6b100101,                XOR     =   6b100110,                NOR     =   6b100111,                SLT     =   6b101010,                SLTU    =   6b101011,                SRL     =   6b000010,                SRA     =   6b000011,                SLL     =   6b000000,                SLLV    =   6b000100,                SRLV    =   6b000110,                SRAV    =   6b000111,                JR      =   6b001000,                JALR    =   6b001001,                MULT    =    6b011000,                MULTU   =   6b011001,                DIV     =   6b011010,                DIVU    =   6b011011,                MFHI    =   6b010000,                MFLO    =   6b010010,                MTHI    =   6b010001,                MTLO    =   6b010011,                BREAK   =   6b001101,                SYSCALL =   6b001100,                TEQ     =   6b110100,                //SPECIAL 2 func                CLZ        =   6b100000,                MUL        =   6b000010,                //REGIMM OP LIST 20-16                BLTZ    =   5b00000,                BGEZ    =   5b00001,                //COP0 OP LIST                 ERET    =   6b011000,  //5-0&&25TH=1                MFC0    =   5b00000,   //20-16                MTC0    =   5b00100,                //OPCODE FIELD  31-26                ADDI    =   6b001000,                ADDIU   =   6b001001,                ANDI    =   6b001100,                ORI     =   6b001101,                XORI    =   6b001110,                LW      =   6b100011,                SW      =   6b101011,                BEQ     =   6b000100,                BNE     =   6b000101,                BLEZ    =   6b000110,                BGTZ    =   6b000111,                SLTI    =   6b001010,                SLTIU   =   6b001011,                LUI     =   6b001111,                J       =   6b000010,                JAL     =   6b000011,                LB      =   6b100000,//    Load Byte Function=6h24                    LBU     =   6b100100,//    1Load Byte Unsigned                 LH      =   6b100001,//    Load high                 LHU     =   6b100101,//    Load High Unsigned                SB      =   6b101000,//    Send Byte                SH      =   6b101001,//    Send High                                SPECIAL =   6b000000,                SPECIAL2=    6b011100,                REGIMM  =   6b000001,                COP0    =   6b010000;      //ALU OPCODE                    parameter   _ADDU   =   4b0000;    //r=a+b unsigned    parameter   _ADD    =   4b0010;    //r=a+b signed    parameter   _SUBU   =   4b0001;    //r=a-b unsigned    parameter   _SUB    =   4b0011;    //r=a-b signed    parameter   _AND    =   4b0100;    //r=a&b    parameter   _OR     =   4b0101;    //r=a|b    parameter   _XOR    =   4b0110;    //r=a^b    parameter   _NOR    =   4b0111;    //r=~(a|b)        parameter   _LUI    =   4b1000;    //r={b[15:0],16b0}    parameter   _SLT    =   4b1011;    //r=(a-b<0)?1:0 signed    parameter   _SLTU   =   4b1010;    //r=(a-b<0)?1:0 unsigned    parameter   _SRA    =   4b1100;    //r=b>>>a     parameter   _SLL    =   4b1110;    //r=b<<a    parameter   _SRL    =   4b1101;    //r=b>>a        parameter    _SYSCALL =   4b1000,                _BREAK    =   4b1001,                _TEQ      =   4b1101;                wire [5:0]  op        =  instr[31:26];    assign      rs        =  instr[25:21];    assign      rt        =  instr[20:16];    assign      rd        =  instr[15:11];    wire [5:0]  func      =  instr[5:0];        wire [4:0]  shamt     =  instr[10:6];    wire [15:0] imm       =  instr[15:0];    wire [25:0] addr      =  instr[25:0];        parameter   SIGN      =   1b1;    parameter   UNSIGN    =   1b0;    wire     imm_sign     =   (op==ANDI||op==ORI||op==XORI)?UNSIGN:SIGN;        wire [31:0] shamt_ext =   {27b0,shamt};    wire [31:0] imm_ext   =   imm_sign?{{(16){imm[15]}},imm}:{16b0,imm};    reg  [31:0] load_data,clz_data;        assign    waddr    =    (op==SPECIAL||op==SPECIAL2)?    rd:    (op==JAL)    ?5b11111:rt;    

 

MIPS rev.1 指令参数