Handle branch_in_ex in case of splitted adder

This commit is contained in:
Markus Wegmann 2017-01-06 18:07:56 +01:00
parent 0ef801ae67
commit ca6fd4faad
2 changed files with 11 additions and 2 deletions

View file

@ -319,7 +319,12 @@ module riscv_controller
// decode and execute instructions only if the current conditional
// branch in the EX stage is either not taken, or there is no
// conditional branch in the EX stage
// CONFIG_REGION: SPLITTED_ADDER
`ifdef SPLITTED_ADDER
if (instr_valid_i && (~branch_taken_ex_i) && ex_valid_i)
`else
if (instr_valid_i && (~branch_taken_ex_i))
`endif
begin // now analyze the current instruction in the ID stage
is_decoding_o = 1'b1;
@ -431,7 +436,12 @@ module riscv_controller
// TODO: make sure this is not done multiple times in a row!!!
// maybe with an assertion?
// handle conditional branches
// CONFIG_REGION: SPLITTED_ADDER
`ifdef SPLITTED_ADDER
if (branch_taken_ex_i & ex_valid_i) begin
`else
if (branch_taken_ex_i) begin
`endif
// there is a branch in the EX stage that is taken
pc_mux_o = PC_BRANCH;
pc_set_o = 1'b1;

View file

@ -1578,13 +1578,12 @@ always_ff @(posedge clk, negedge rst_n)
if ((jump_in_id == BRANCH_COND) || data_load_event_id) begin
pc_ex_o <= pc_id_i;
end
branch_in_ex_o <= jump_in_id == BRANCH_COND;
`else
if ((jump_in_id == BRANCH_COND) || (jump_in_id == BRANCH_JAL) || (jump_in_id == BRANCH_JALR) || data_load_event_id) begin
pc_ex_o <= pc_id_i;
end
branch_in_ex_o <= (jump_in_id == BRANCH_COND) || (jump_in_id == BRANCH_JAL) || (jump_in_id == BRANCH_JALR);
`endif
branch_in_ex_o <= jump_in_id == BRANCH_COND;
end else if(ex_ready_i) begin
// EX stage is ready but we don't have a new instruction for it,