update mul slow

This commit is contained in:
Pasquale Davide Schiavone 2017-06-01 15:59:38 +02:00
parent 97ce216058
commit ced485cdfc
2 changed files with 10 additions and 8 deletions

View file

@ -68,7 +68,7 @@ module zeroriscy_ex_block
output logic ex_ready_o // EX stage gets new data
);
localparam MULT_TYPE = 1; //0 is SLOW
localparam MULT_TYPE = 0; //0 is SLOW
logic [31:0] alu_result, multdiv_result;
@ -136,7 +136,8 @@ end
(
.clk ( clk ),
.rst_n ( rst_n ),
.multdiv_en_i ( multdiv_en ),
.mult_en_i ( mult_en_i ),
.div_en_i ( div_en_i ),
.operator_i ( multdiv_operator_i ),
.signed_mode_i ( multdiv_signed_mode_i ),
.op_a_i ( multdiv_operand_a_i ),

View file

@ -29,7 +29,8 @@ module zeroriscy_multdiv_slow
(
input logic clk,
input logic rst_n,
input logic multdiv_en_i,
input logic mult_en_i,
input logic div_en_i,
input logic [1:0] operator_i,
input logic [1:0] signed_mode_i,
input logic [31:0] op_a_i,
@ -76,7 +77,7 @@ module zeroriscy_multdiv_slow
begin
alu_operand_a_o = accum_window_q;
multdiv_result_o = accum_window_q[31:0];
multdiv_result_o = div_en_i ? accum_window_q[31:0] : res_adder_l;
unique case(operator_i)
@ -174,7 +175,7 @@ module zeroriscy_multdiv_slow
curr_state_q <= MD_IDLE;
op_numerator_q <= '0;
end else begin
if(multdiv_en_i) begin
if(mult_en_i | div_en_i) begin
unique case(curr_state_q)
MD_IDLE: begin
@ -255,11 +256,11 @@ module zeroriscy_multdiv_slow
unique case(operator_i)
MD_OP_MULL: begin
accum_window_q <= res_adder_l;
curr_state_q <= MD_FINISH;
curr_state_q <= MD_IDLE;
end
MD_OP_MULH: begin
accum_window_q <= res_adder_l;
curr_state_q <= MD_FINISH;
curr_state_q <= MD_IDLE;
end
MD_OP_DIV: begin
//this time we save the quotient in accum_window_q since we do not need anymore the reminder
@ -295,7 +296,7 @@ module zeroriscy_multdiv_slow
end
assign ready_o = curr_state_q == MD_FINISH;
assign ready_o = (curr_state_q == MD_FINISH) | (curr_state_q == MD_LAST & (operator_i == MD_OP_MULL | operator_i == MD_OP_MULH));
endmodule // zeroriscy_mult