2019-12-04 00:47:19 +00:00
|
|
|
/*
|
|
|
|
Copyright 2019 Blue Liang, liangkangnan@163.com
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
`include "defines.v"
|
|
|
|
|
2020-04-18 12:14:37 +00:00
|
|
|
// 执行模块
|
|
|
|
// 纯组合逻辑电路
|
2020-03-29 15:19:14 +00:00
|
|
|
module ex(
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
input wire rst,
|
|
|
|
|
|
|
|
// from id
|
2020-04-18 12:14:37 +00:00
|
|
|
input wire[`InstBus] inst_i, // 指令内容
|
|
|
|
input wire[`InstAddrBus] inst_addr_i, // 指令地址
|
|
|
|
input wire reg_we_i, // 是否写通用寄存器
|
|
|
|
input wire[`RegAddrBus] reg_waddr_i, // 写通用寄存器地址
|
|
|
|
input wire[`RegBus] reg1_rdata_i, // 通用寄存器1输入数据
|
|
|
|
input wire[`RegBus] reg2_rdata_i, // 通用寄存器2输入数据
|
|
|
|
input wire csr_we_i, // 是否写CSR寄存器
|
|
|
|
input wire[`MemAddrBus] csr_waddr_i, // 写CSR寄存器地址
|
|
|
|
input wire[`RegBus] csr_rdata_i, // CSR寄存器输入数据
|
|
|
|
input wire int_assert_i, // 中断发生标志
|
|
|
|
input wire[`InstAddrBus] int_addr_i, // 中断跳转地址
|
2019-12-04 00:47:19 +00:00
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
// from mem
|
2020-04-18 12:14:37 +00:00
|
|
|
input wire[`MemBus] mem_rdata_i, // 内存输入数据
|
2019-12-04 00:47:19 +00:00
|
|
|
|
2020-01-13 00:26:41 +00:00
|
|
|
// from div
|
2020-04-18 12:14:37 +00:00
|
|
|
input wire div_ready_i, // 除法运算完成标志
|
|
|
|
input wire[`DoubleRegBus] div_result_i, // 除法运算结果
|
|
|
|
input wire div_busy_i, // 除法运算忙标志
|
|
|
|
input wire[2:0] div_op_i, // 具体是哪一条除法指令
|
|
|
|
input wire[`RegAddrBus] div_reg_waddr_i,// 除法运算结束后要写的寄存器地址
|
2020-03-29 15:19:14 +00:00
|
|
|
|
|
|
|
// to mem
|
2020-04-18 12:14:37 +00:00
|
|
|
output reg[`MemBus] mem_wdata_o, // 写内存数据
|
|
|
|
output reg[`MemAddrBus] mem_raddr_o, // 读内存地址
|
|
|
|
output reg[`MemAddrBus] mem_waddr_o, // 写内存地址
|
|
|
|
output wire mem_we_o, // 是否要写内存
|
|
|
|
output wire mem_req_o, // 请求访问内存标志
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
// to regs
|
2020-04-18 12:14:37 +00:00
|
|
|
output wire[`RegBus] reg_wdata_o, // 写寄存器数据
|
|
|
|
output wire reg_we_o, // 是否要写通用寄存器
|
|
|
|
output wire[`RegAddrBus] reg_waddr_o, // 写通用寄存器地址
|
2020-01-13 00:26:41 +00:00
|
|
|
|
2020-04-05 14:22:34 +00:00
|
|
|
// to csr reg
|
2020-04-18 12:14:37 +00:00
|
|
|
output reg[`RegBus] csr_wdata_o, // 写CSR寄存器数据
|
|
|
|
output wire csr_we_o, // 是否要写CSR寄存器
|
|
|
|
output wire[`MemAddrBus] csr_waddr_o, // 写CSR寄存器地址
|
2020-04-05 14:22:34 +00:00
|
|
|
|
2020-01-13 00:26:41 +00:00
|
|
|
// to div
|
2020-04-25 09:04:44 +00:00
|
|
|
output wire div_start_o, // 开始除法运算标志
|
2020-04-18 12:14:37 +00:00
|
|
|
output reg[`RegBus] div_dividend_o, // 被除数
|
|
|
|
output reg[`RegBus] div_divisor_o, // 除数
|
|
|
|
output reg[2:0] div_op_o, // 具体是哪一条除法指令
|
|
|
|
output reg[`RegAddrBus] div_reg_waddr_o,// 除法运算结束后要写的寄存器地址
|
2020-01-13 00:26:41 +00:00
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
// to ctrl
|
2020-04-18 12:14:37 +00:00
|
|
|
output wire hold_flag_o, // 是否暂停标志
|
|
|
|
output wire jump_flag_o, // 是否跳转标志
|
|
|
|
output wire[`InstAddrBus] jump_addr_o // 跳转目的地址
|
2019-12-04 00:47:19 +00:00
|
|
|
|
2020-02-23 09:01:45 +00:00
|
|
|
);
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
wire[31:0] sign_extend_tmp;
|
|
|
|
wire[4:0] shift_bits;
|
2020-03-29 15:19:14 +00:00
|
|
|
wire[1:0] mem_raddr_index;
|
|
|
|
wire[1:0] mem_waddr_index;
|
2020-01-02 08:12:13 +00:00
|
|
|
wire[`DoubleRegBus] mul_temp;
|
2020-03-29 15:19:14 +00:00
|
|
|
wire[`DoubleRegBus] mul_temp_invert;
|
|
|
|
reg[`RegBus] mul_op1;
|
|
|
|
reg[`RegBus] mul_op2;
|
2020-02-22 07:24:10 +00:00
|
|
|
wire[6:0] opcode;
|
|
|
|
wire[2:0] funct3;
|
|
|
|
wire[6:0] funct7;
|
|
|
|
wire[4:0] rd;
|
2020-04-05 14:22:34 +00:00
|
|
|
wire[4:0] uimm;
|
2020-03-29 15:19:14 +00:00
|
|
|
reg[`RegBus] reg_wdata;
|
|
|
|
reg reg_we;
|
|
|
|
reg[`RegAddrBus] reg_waddr;
|
|
|
|
reg[`RegBus] div_wdata;
|
|
|
|
reg div_we;
|
|
|
|
reg[`RegAddrBus] div_waddr;
|
|
|
|
reg div_hold_flag;
|
|
|
|
reg div_jump_flag;
|
|
|
|
reg[`InstAddrBus] div_jump_addr;
|
|
|
|
reg hold_flag;
|
|
|
|
reg jump_flag;
|
|
|
|
reg[`InstAddrBus] jump_addr;
|
2020-04-11 11:03:49 +00:00
|
|
|
reg mem_we;
|
|
|
|
reg mem_req;
|
2020-04-25 09:04:44 +00:00
|
|
|
reg div_start;
|
2019-12-04 00:47:19 +00:00
|
|
|
|
2020-02-22 07:24:10 +00:00
|
|
|
assign opcode = inst_i[6:0];
|
|
|
|
assign funct3 = inst_i[14:12];
|
|
|
|
assign funct7 = inst_i[31:25];
|
|
|
|
assign rd = inst_i[11:7];
|
2020-04-05 14:22:34 +00:00
|
|
|
assign uimm = inst_i[19:15];
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
assign sign_extend_tmp = {{20{inst_i[31]}}, inst_i[31:20]};
|
|
|
|
assign shift_bits = inst_i[24:20];
|
2020-01-02 08:12:13 +00:00
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
assign mul_temp = mul_op1 * mul_op2;
|
|
|
|
assign mul_temp_invert = ~mul_temp + 1;
|
|
|
|
|
|
|
|
assign mem_raddr_index = ((reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]}) - ((reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]}) & 32'hfffffffc)) & 2'b11;
|
|
|
|
assign mem_waddr_index = ((reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]}) - (reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]} & 32'hfffffffc)) & 2'b11;
|
2020-02-16 13:27:11 +00:00
|
|
|
|
2020-04-25 09:04:44 +00:00
|
|
|
assign div_start_o = (int_assert_i == `INT_ASSERT)? `DivStop: div_start;
|
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
assign reg_wdata_o = reg_wdata | div_wdata;
|
2020-04-18 12:14:37 +00:00
|
|
|
// 响应中断时不写通用寄存器
|
2020-04-11 11:03:49 +00:00
|
|
|
assign reg_we_o = (int_assert_i == `INT_ASSERT)? `WriteDisable: (reg_we || div_we);
|
2020-03-29 15:19:14 +00:00
|
|
|
assign reg_waddr_o = reg_waddr | div_waddr;
|
2019-12-04 00:47:19 +00:00
|
|
|
|
2020-04-18 12:14:37 +00:00
|
|
|
// 响应中断时不写内存
|
2020-04-11 11:03:49 +00:00
|
|
|
assign mem_we_o = (int_assert_i == `INT_ASSERT)? `WriteDisable: mem_we;
|
|
|
|
|
2020-04-18 12:14:37 +00:00
|
|
|
// 响应中断时不向总线请求访问内存
|
2020-04-11 11:03:49 +00:00
|
|
|
assign mem_req_o = (int_assert_i == `INT_ASSERT)? `RIB_NREQ: mem_req;
|
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
assign hold_flag_o = hold_flag || div_hold_flag;
|
2020-04-11 11:03:49 +00:00
|
|
|
assign jump_flag_o = jump_flag || div_jump_flag || ((int_assert_i == `INT_ASSERT)? `JumpEnable: `JumpDisable);
|
|
|
|
assign jump_addr_o = (int_assert_i == `INT_ASSERT)? int_addr_i: (jump_addr | div_jump_addr);
|
2020-01-13 00:26:41 +00:00
|
|
|
|
2020-04-18 12:14:37 +00:00
|
|
|
// 响应中断时不写CSR寄存器
|
2020-04-11 11:03:49 +00:00
|
|
|
assign csr_we_o = (int_assert_i == `INT_ASSERT)? `WriteDisable: csr_we_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
assign csr_waddr_o = csr_waddr_i;
|
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
|
2020-04-25 09:04:44 +00:00
|
|
|
// 处理乘法指令
|
2020-03-29 15:19:14 +00:00
|
|
|
always @ (*) begin
|
|
|
|
if (rst == `RstEnable) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mul_op1 = `ZeroWord;
|
|
|
|
mul_op2 = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
|
|
|
if ((opcode == `INST_TYPE_R_M) && (funct7 == 7'b0000001)) begin
|
2020-04-18 03:23:46 +00:00
|
|
|
case (funct3)
|
2020-05-02 03:58:44 +00:00
|
|
|
`INST_MUL, `INST_MULHU: begin
|
|
|
|
mul_op1 = reg1_rdata_i;
|
|
|
|
mul_op2 = reg2_rdata_i;
|
2020-04-18 03:23:46 +00:00
|
|
|
end
|
|
|
|
`INST_MULHSU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mul_op1 = (reg1_rdata_i[31] == 1'b1)? (~reg1_rdata_i + 1): reg1_rdata_i;
|
|
|
|
mul_op2 = reg2_rdata_i;
|
2020-04-18 03:23:46 +00:00
|
|
|
end
|
|
|
|
`INST_MULH: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mul_op1 = (reg1_rdata_i[31] == 1'b1)? (~reg1_rdata_i + 1): reg1_rdata_i;
|
|
|
|
mul_op2 = (reg2_rdata_i[31] == 1'b1)? (~reg2_rdata_i + 1): reg2_rdata_i;
|
2020-04-18 03:23:46 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mul_op1 = reg1_rdata_i;
|
|
|
|
mul_op2 = reg2_rdata_i;
|
2020-04-18 03:23:46 +00:00
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mul_op1 = reg1_rdata_i;
|
|
|
|
mul_op2 = reg2_rdata_i;
|
2020-03-08 07:09:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-25 09:04:44 +00:00
|
|
|
// 处理除法指令
|
2020-01-13 00:26:41 +00:00
|
|
|
always @ (*) begin
|
2020-02-22 07:24:10 +00:00
|
|
|
if (rst == `RstEnable) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_dividend_o = `ZeroWord;
|
|
|
|
div_divisor_o = `ZeroWord;
|
|
|
|
div_op_o = 3'b0;
|
|
|
|
div_reg_waddr_o = `ZeroWord;
|
|
|
|
div_waddr = `ZeroWord;
|
|
|
|
div_hold_flag = `HoldDisable;
|
|
|
|
div_we = `WriteDisable;
|
|
|
|
div_wdata = `ZeroWord;
|
|
|
|
div_start = `DivStop;
|
|
|
|
div_jump_flag = `JumpDisable;
|
|
|
|
div_jump_addr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_dividend_o = reg1_rdata_i;
|
|
|
|
div_divisor_o = reg2_rdata_i;
|
|
|
|
div_op_o = funct3;
|
|
|
|
div_reg_waddr_o = reg_waddr_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
if ((opcode == `INST_TYPE_R_M) && (funct7 == 7'b0000001)) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_we = `WriteDisable;
|
|
|
|
div_wdata = `ZeroWord;
|
|
|
|
div_waddr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
case (funct3)
|
2020-05-02 03:58:44 +00:00
|
|
|
`INST_DIV, `INST_DIVU, `INST_REM, `INST_REMU: begin
|
|
|
|
div_start = `DivStart;
|
|
|
|
div_jump_flag = `JumpEnable;
|
|
|
|
div_hold_flag = `HoldEnable;
|
|
|
|
div_jump_addr = inst_addr_i + 4'h4;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_start = `DivStop;
|
|
|
|
div_jump_flag = `JumpDisable;
|
|
|
|
div_hold_flag = `HoldDisable;
|
|
|
|
div_jump_addr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_jump_flag = `JumpDisable;
|
|
|
|
div_jump_addr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (div_busy_i == `True) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_start = `DivStart;
|
|
|
|
div_we = `WriteDisable;
|
|
|
|
div_wdata = `ZeroWord;
|
|
|
|
div_waddr = `ZeroWord;
|
|
|
|
div_hold_flag = `HoldEnable;
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_start = `DivStop;
|
|
|
|
div_hold_flag = `HoldDisable;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (div_ready_i == `DivResultReady) begin
|
|
|
|
case (div_op_i)
|
2020-05-02 03:58:44 +00:00
|
|
|
`INST_DIV, `INST_DIVU: begin
|
|
|
|
div_wdata = div_result_i[31:0];
|
|
|
|
div_waddr = div_reg_waddr_i;
|
|
|
|
div_we = `WriteEnable;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
`INST_REM, `INST_REMU: begin
|
|
|
|
div_wdata = div_result_i[63:32];
|
|
|
|
div_waddr = div_reg_waddr_i;
|
|
|
|
div_we = `WriteEnable;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_wdata = `ZeroWord;
|
|
|
|
div_waddr = `ZeroWord;
|
|
|
|
div_we = `WriteDisable;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
div_we = `WriteDisable;
|
|
|
|
div_wdata = `ZeroWord;
|
|
|
|
div_waddr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-02 03:58:44 +00:00
|
|
|
// 执行
|
2020-03-29 15:19:14 +00:00
|
|
|
always @ (*) begin
|
|
|
|
if (rst == `RstEnable) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
mem_req = `RIB_NREQ;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
reg_we = `WriteDisable;
|
|
|
|
reg_waddr = `ZeroReg;
|
|
|
|
csr_wdata_o = `ZeroWord;
|
2020-02-22 07:24:10 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_we = reg_we_i;
|
|
|
|
reg_waddr = reg_waddr_i;
|
|
|
|
mem_req = `RIB_NREQ;
|
|
|
|
csr_wdata_o = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
|
|
|
|
case (opcode)
|
|
|
|
`INST_TYPE_I: begin
|
|
|
|
case (funct3)
|
|
|
|
`INST_ADDI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]};
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_SLTI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
case ({reg1_rdata_i[31], sign_extend_tmp[31]})
|
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i < sign_extend_tmp) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = 32'h00000001;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b01: begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
if (reg1_rdata_i < sign_extend_tmp) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endcase
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_SLTIU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
case ({reg1_rdata_i[31], sign_extend_tmp[31]})
|
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i < sign_extend_tmp) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = 32'h00000000;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b01: begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
if (reg1_rdata_i < sign_extend_tmp) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_XORI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i ^ {{20{inst_i[31]}}, inst_i[31:20]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_ORI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i | {{20{inst_i[31]}}, inst_i[31:20]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_ANDI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i & {{20{inst_i[31]}}, inst_i[31:20]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_SLLI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i << shift_bits;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_SRI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (inst_i[30] == 1'b1) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = ({32{reg1_rdata_i[31]}} << (6'd32 - {1'b0, shift_bits})) | (reg1_rdata_i >> shift_bits);
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = reg1_rdata_i >> shift_bits;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_TYPE_R_M: begin
|
|
|
|
if ((funct7 == 7'b0000000) || (funct7 == 7'b0100000)) begin
|
2020-01-02 08:12:13 +00:00
|
|
|
case (funct3)
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_ADD_SUB: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (inst_i[30] == 1'b0) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = reg1_rdata_i + reg2_rdata_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = reg1_rdata_i - reg2_rdata_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
`INST_SLL: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i << reg2_rdata_i[4:0];
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_SLT: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
2020-01-02 08:12:13 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = 32'h00000001;
|
2020-01-02 08:12:13 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b01: begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endcase
|
2020-01-02 08:12:13 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_SLTU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
2020-01-02 08:12:13 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = 32'h00000000;
|
2020-01-02 08:12:13 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b01: begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
reg_wdata = 32'h00000001;
|
|
|
|
end else begin
|
|
|
|
reg_wdata = 32'h00000000;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endcase
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_XOR: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i ^ reg2_rdata_i;
|
2020-01-02 08:12:13 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_SR: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
2020-02-22 07:24:10 +00:00
|
|
|
if (inst_i[30] == 1'b1) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = ({32{reg1_rdata_i[31]}} << (6'd32 - {1'b0, reg2_rdata_i[4:0]})) | (reg1_rdata_i >> reg2_rdata_i[4:0]);
|
2019-12-04 00:47:19 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = reg1_rdata_i >> reg2_rdata_i[4:0];
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
`INST_OR: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i | reg2_rdata_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_AND: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = reg1_rdata_i & reg2_rdata_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-02-22 07:24:10 +00:00
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end else if (funct7 == 7'b0000001) begin
|
|
|
|
case (funct3)
|
|
|
|
`INST_MUL: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = mul_temp[31:0];
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_MULHU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = mul_temp[63:32];
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_MULH: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b00: begin
|
|
|
|
reg_wdata = mul_temp[63:32];
|
|
|
|
end
|
|
|
|
2'b11: begin
|
|
|
|
reg_wdata = mul_temp[63:32];
|
|
|
|
end
|
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = mul_temp_invert[63:32];
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
reg_wdata = mul_temp_invert[63:32];
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_MULHSU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (reg1_rdata_i[31] == 1'b1) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = mul_temp_invert[63:32];
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = mul_temp[63:32];
|
2020-02-22 07:24:10 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-02-22 07:24:10 +00:00
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-02-22 07:24:10 +00:00
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_TYPE_L: begin
|
|
|
|
case (funct3)
|
|
|
|
`INST_LB: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]};
|
|
|
|
case (mem_raddr_index)
|
|
|
|
2'b00: begin
|
|
|
|
reg_wdata = {{24{mem_rdata_i[7]}}, mem_rdata_i[7:0]};
|
|
|
|
end
|
|
|
|
2'b01: begin
|
|
|
|
reg_wdata = {{24{mem_rdata_i[15]}}, mem_rdata_i[15:8]};
|
|
|
|
end
|
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = {{24{mem_rdata_i[23]}}, mem_rdata_i[23:16]};
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
reg_wdata = {{24{mem_rdata_i[31]}}, mem_rdata_i[31:24]};
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_LH: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]};
|
2020-03-29 15:19:14 +00:00
|
|
|
if (mem_raddr_index == 2'b0) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = {{16{mem_rdata_i[15]}}, mem_rdata_i[15:0]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = {{16{mem_rdata_i[31]}}, mem_rdata_i[31:16]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
`INST_LW: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]};
|
|
|
|
reg_wdata = mem_rdata_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_LBU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]};
|
|
|
|
case (mem_raddr_index)
|
|
|
|
2'b00: begin
|
|
|
|
reg_wdata = {24'h0, mem_rdata_i[7:0]};
|
|
|
|
end
|
|
|
|
2'b01: begin
|
|
|
|
reg_wdata = {24'h0, mem_rdata_i[15:8]};
|
|
|
|
end
|
|
|
|
2'b10: begin
|
|
|
|
reg_wdata = {24'h0, mem_rdata_i[23:16]};
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
reg_wdata = {24'h0, mem_rdata_i[31:24]};
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_LHU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]};
|
2020-03-29 15:19:14 +00:00
|
|
|
if (mem_raddr_index == 2'b0) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = {16'h0, mem_rdata_i[15:0]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
reg_wdata = {16'h0, mem_rdata_i[31:16]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
`INST_TYPE_S: begin
|
|
|
|
case (funct3)
|
|
|
|
`INST_SB: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
mem_we = `WriteEnable;
|
|
|
|
mem_req = `RIB_REQ;
|
|
|
|
mem_waddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]};
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]};
|
|
|
|
case (mem_waddr_index)
|
|
|
|
2'b00: begin
|
|
|
|
mem_wdata_o = {mem_rdata_i[31:8], reg2_rdata_i[7:0]};
|
|
|
|
end
|
|
|
|
2'b01: begin
|
|
|
|
mem_wdata_o = {mem_rdata_i[31:16], reg2_rdata_i[7:0], mem_rdata_i[7:0]};
|
|
|
|
end
|
|
|
|
2'b10: begin
|
|
|
|
mem_wdata_o = {mem_rdata_i[31:24], reg2_rdata_i[7:0], mem_rdata_i[15:0]};
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
mem_wdata_o = {reg2_rdata_i[7:0], mem_rdata_i[23:0]};
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_SH: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
mem_we = `WriteEnable;
|
|
|
|
mem_req = `RIB_REQ;
|
|
|
|
mem_waddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]};
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]};
|
2020-03-29 15:19:14 +00:00
|
|
|
if (mem_waddr_index == 2'b00) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mem_wdata_o = {mem_rdata_i[31:16], reg2_rdata_i[15:0]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
mem_wdata_o = {reg2_rdata_i[15:0], mem_rdata_i[15:0]};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
`INST_SW: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
mem_we = `WriteEnable;
|
|
|
|
mem_req = `RIB_REQ;
|
|
|
|
mem_waddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]};
|
|
|
|
mem_raddr_o = reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:25], inst_i[11:7]};
|
|
|
|
mem_wdata_o = reg2_rdata_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
`INST_TYPE_B: begin
|
|
|
|
case (funct3)
|
|
|
|
`INST_BEQ: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (reg1_rdata_i == reg2_rdata_i) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
`INST_BNE: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
if (reg1_rdata_i != reg2_rdata_i) begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
2020-03-29 15:19:14 +00:00
|
|
|
end else begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
`INST_BLT: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b10: begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i >= reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b00: begin
|
|
|
|
if (reg1_rdata_i >= reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_BGE: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b01: begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
2020-02-22 07:24:10 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b00: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_BLTU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b10: begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i >= reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b00: begin
|
|
|
|
if (reg1_rdata_i >= reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_BGEU: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
case ({reg1_rdata_i[31], reg2_rdata_i[31]})
|
|
|
|
2'b01: begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b11: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-05-02 03:58:44 +00:00
|
|
|
2'b00: begin
|
|
|
|
if (reg1_rdata_i < reg2_rdata_i) begin
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
end else begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
|
|
|
end
|
|
|
|
default: begin
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{20{inst_i[31]}}, inst_i[7], inst_i[30:25], inst_i[11:8], 1'b0};
|
|
|
|
end
|
|
|
|
endcase
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
`INST_JAL: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + {{12{inst_i[31]}}, inst_i[19:12], inst_i[20], inst_i[30:21], 1'b0};
|
|
|
|
reg_wdata = inst_addr_i + 4'h4;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_JALR: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = (reg1_rdata_i + {{20{inst_i[31]}}, inst_i[31:20]}) & (32'hfffffffe);
|
|
|
|
reg_wdata = inst_addr_i + 4'h4;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_LUI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
reg_wdata = {inst_i[31:12], 12'b0};
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_AUIPC: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
reg_wdata = {inst_i[31:12], 12'b0} + inst_addr_i;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_NOP: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
`INST_FENCE: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
|
|
|
jump_flag = `JumpEnable;
|
|
|
|
jump_addr = inst_addr_i + 4'h4;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
2020-04-05 14:22:34 +00:00
|
|
|
`INST_CSR: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
2020-04-05 14:22:34 +00:00
|
|
|
case (funct3)
|
|
|
|
`INST_CSRRW: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
csr_wdata_o = reg1_rdata_i;
|
|
|
|
reg_wdata = csr_rdata_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
`INST_CSRRS: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
csr_wdata_o = reg1_rdata_i | csr_rdata_i;
|
|
|
|
reg_wdata = csr_rdata_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
`INST_CSRRC: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
csr_wdata_o = csr_rdata_i & (~reg1_rdata_i);
|
|
|
|
reg_wdata = csr_rdata_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
`INST_CSRRWI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
csr_wdata_o = {27'h0, uimm};
|
|
|
|
reg_wdata = csr_rdata_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
`INST_CSRRSI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
csr_wdata_o = {27'h0, uimm} | csr_rdata_i;
|
|
|
|
reg_wdata = csr_rdata_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
`INST_CSRRCI: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
csr_wdata_o = (~{27'h0, uimm}) & csr_rdata_i;
|
|
|
|
reg_wdata = csr_rdata_i;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-04-05 14:22:34 +00:00
|
|
|
end
|
|
|
|
endcase
|
|
|
|
end
|
2020-03-29 15:19:14 +00:00
|
|
|
default: begin
|
2020-05-02 03:58:44 +00:00
|
|
|
jump_flag = `JumpDisable;
|
|
|
|
hold_flag = `HoldDisable;
|
|
|
|
jump_addr = `ZeroWord;
|
|
|
|
mem_wdata_o = `ZeroWord;
|
|
|
|
mem_raddr_o = `ZeroWord;
|
|
|
|
mem_waddr_o = `ZeroWord;
|
|
|
|
mem_we = `WriteDisable;
|
|
|
|
reg_wdata = `ZeroWord;
|
2020-03-29 15:19:14 +00:00
|
|
|
end
|
|
|
|
endcase
|
2019-12-04 00:47:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
endmodule
|