4 Star 0 Fork 0

王赛宇 / nscscc2020_final

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
instdec.v 4.18 KB
一键复制 编辑 原始数据 按行查看 历史
王赛宇 提交于 2020-08-08 20:42 . 初始代码,有错
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2018/08/06 15:21:16
// Design Name:
// Module Name: instdec
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
`timescale 1ns / 1ps
`include "defines.h"
module instdec(
input wire [31:0] instr,
output reg [39:0] ascii
);
always @(*)
begin
ascii<="N-R";
case(instr[31:26])
`NOP: // R-type
begin
case(instr[5:0])
/* logic instraction */
`AND: ascii<= "AND";
`OR: ascii<= "OR";
`XOR: ascii<= "XOR";
`NOR: ascii<= "NOR";
/* shift instraction */
`SLL: ascii<= "SLL";
`SRL: ascii<= "SRL";
`SRA: ascii<= "SRA";
`SLLV: ascii<= "SLLV";
`SRLV: ascii<= "SRLV";
`SRAV: ascii<= "SRAV";
/* move instraction */
`MFHI: ascii<= "MFHI";
`MTHI: ascii<= "MTHI";
`MFLO: ascii<= "MFLO";
`MTLO: ascii<= "MTLO";
/* arithemtic instraction */
`ADD: ascii<= "ADD";
`ADDU: ascii<= "ADDU";
`SUB: ascii<= "SUB";
`SUBU: ascii<= "SUBU";
`SLT: ascii<= "SLT";
`SLTU: ascii<= "SLTU";
`MULT: ascii<= "MULT";
`MULTU: ascii<= "MULTU";
`DIV: ascii<= "DIV";
`DIVU: ascii<= "DIVU";
/* jump instraction */
`JR: ascii<= "JR";
`JALR: ascii<= "JALR";
`SYSCALL: ascii<= "SYSC";
`BREAK: ascii<= "BRE";
default: ascii<="N-R";
endcase
end
`ANDI: ascii<= "ANDI";
`XORI: ascii<= "XORI";
`LUI: ascii<= "LUI";
`ORI: ascii<= "ORI";
`ADDI: ascii<= "ADDI";
`ADDIU: ascii<= "ADDIU";
`SLTI: ascii<= "SLTI";
`SLTIU: ascii<= "SLTIU";
`J: ascii<= "J";
`JAL: ascii<= "JAL";
`LB: ascii<= "LB";
`LBU: ascii<= "LBU";
`LH: ascii<= "LH";
`LHU: ascii<= "LHU";
`LW: ascii<= "LW";
`LWL: ascii <= "LWL";
`LWR: ascii <= "LWR";
`SB: ascii<= "SB";
`SH: ascii<= "SH";
`SW: ascii<= "SW";
`SWL: ascii <= "SWL";
`SWR: ascii <= "SWR";
`BEQ: ascii<= "BEQ";
`BGTZ: ascii<= "BGTZ";
`BLEZ: ascii<= "BLEZ";
`BNE: ascii<= "BNE";
`BEQL:ascii<= "BEQL";
6'b000001: begin
case (instr[20:16])
`BGEZ: ascii<= "BGEZ";
`BGEZAL: ascii<= "BGEZAL";
`BLTZ: ascii<= "BLTZ";
`BLTZAL: ascii<= "BLTZAL";
default : ascii<= " ";
endcase
end
6'b010000: begin
case(instr[25:21])
`MTC0: ascii <= "MTC0";
`MFC0: ascii <= "MFC0";
5'b10000:
begin
case(instr[5:0])
`ERET: ascii <= "ERET";
`TLBP: ascii <= "TLBP";
`TLBR: ascii <= "TLBR";
`TLBWI : ascii <= "TLBWI";
endcase
end
endcase
end
default: ascii<= "N-R";
endcase
end
endmodule
Verilog
1
https://gitee.com/saiyuwang/nscscc2020_final.git
git@gitee.com:saiyuwang/nscscc2020_final.git
saiyuwang
nscscc2020_final
nscscc2020_final
master

搜索帮助