首页 > 代码库 > MIPS rev.1 指令参数
MIPS rev.1 指令参数
由于MIPS各个版本之间的操作数会变,如果出现无法识别的情况
需要根据官方的MIPS instruction手册逐条核对,此处的版本为Rev.1
//******MIPS-55*********// parameter //SPECIAL OP LIST 5-0 ADDU = 6‘b100001, SUBU = 6‘b100011, ADD = 6‘b100000, SUB = 6‘b100010, AND = 6‘b100100, OR = 6‘b100101, XOR = 6‘b100110, NOR = 6‘b100111, SLT = 6‘b101010, SLTU = 6‘b101011, SRL = 6‘b000010, SRA = 6‘b000011, SLL = 6‘b000000, SLLV = 6‘b000100, SRLV = 6‘b000110, SRAV = 6‘b000111, JR = 6‘b001000, JALR = 6‘b001001, MULT = 6‘b011000, MULTU = 6‘b011001, DIV = 6‘b011010, DIVU = 6‘b011011, MFHI = 6‘b010000, MFLO = 6‘b010010, MTHI = 6‘b010001, MTLO = 6‘b010011, BREAK = 6‘b001101, SYSCALL = 6‘b001100, TEQ = 6‘b110100, //SPECIAL 2 func CLZ = 6‘b100000, MUL = 6‘b000010, //REGIMM OP LIST 20-16 BLTZ = 5‘b00000, BGEZ = 5‘b00001, //COP0 OP LIST ERET = 6‘b011000, //5-0&&25TH=1 MFC0 = 5‘b00000, //20-16 MTC0 = 5‘b00100, //OPCODE FIELD 31-26 ADDI = 6‘b001000, ADDIU = 6‘b001001, ANDI = 6‘b001100, ORI = 6‘b001101, XORI = 6‘b001110, LW = 6‘b100011, SW = 6‘b101011, BEQ = 6‘b000100, BNE = 6‘b000101, BLEZ = 6‘b000110, BGTZ = 6‘b000111, SLTI = 6‘b001010, SLTIU = 6‘b001011, LUI = 6‘b001111, J = 6‘b000010, JAL = 6‘b000011, LB = 6‘b100000,// Load Byte Function=6‘h24 LBU = 6‘b100100,// 1Load Byte Unsigned LH = 6‘b100001,// Load high LHU = 6‘b100101,// Load High Unsigned SB = 6‘b101000,// Send Byte SH = 6‘b101001,// Send High SPECIAL = 6‘b000000, SPECIAL2= 6‘b011100, REGIMM = 6‘b000001, COP0 = 6‘b010000; //ALU OPCODE parameter _ADDU = 4‘b0000; //r=a+b unsigned parameter _ADD = 4‘b0010; //r=a+b signed parameter _SUBU = 4‘b0001; //r=a-b unsigned parameter _SUB = 4‘b0011; //r=a-b signed parameter _AND = 4‘b0100; //r=a&b parameter _OR = 4‘b0101; //r=a|b parameter _XOR = 4‘b0110; //r=a^b parameter _NOR = 4‘b0111; //r=~(a|b) parameter _LUI = 4‘b1000; //r={b[15:0],16‘b0} parameter _SLT = 4‘b1011; //r=(a-b<0)?1:0 signed parameter _SLTU = 4‘b1010; //r=(a-b<0)?1:0 unsigned parameter _SRA = 4‘b1100; //r=b>>>a parameter _SLL = 4‘b1110; //r=b<<a parameter _SRL = 4‘b1101; //r=b>>a parameter _SYSCALL = 4‘b1000, _BREAK = 4‘b1001, _TEQ = 4‘b1101; 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 = 1‘b1; parameter UNSIGN = 1‘b0; wire imm_sign = (op==ANDI||op==ORI||op==XORI)?UNSIGN:SIGN; wire [31:0] shamt_ext = {27‘b0,shamt}; wire [31:0] imm_ext = imm_sign?{{(16){imm[15]}},imm}:{16‘b0,imm}; reg [31:0] load_data,clz_data; assign waddr = (op==SPECIAL||op==SPECIAL2)? rd: (op==JAL) ?5‘b11111:rt;
MIPS rev.1 指令参数
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。