mirror of
https://github.com/lowRISC/ibex.git
synced 2025-04-24 22:07:43 -04:00
only jump once even when there are stalls
This commit is contained in:
parent
1b98c11e12
commit
11ffa5630c
2 changed files with 15 additions and 4 deletions
|
@ -116,6 +116,8 @@ module riscv_controller
|
|||
FLUSH_EX, FLUSH_WB,
|
||||
DBG_WAIT_BRANCH, DBG_SIGNAL, DBG_WAIT } ctrl_fsm_cs, ctrl_fsm_ns;
|
||||
|
||||
logic jump_done, jump_done_q;
|
||||
|
||||
logic reg_d_ex_is_reg_a_id;
|
||||
logic reg_d_ex_is_reg_b_id;
|
||||
logic reg_d_ex_is_reg_c_id;
|
||||
|
@ -161,6 +163,7 @@ module riscv_controller
|
|||
|
||||
pc_mux_o = `PC_BOOT;
|
||||
pc_set_o = 1'b0;
|
||||
jump_done = jump_done_q;
|
||||
|
||||
ctrl_fsm_ns = ctrl_fsm_cs;
|
||||
|
||||
|
@ -245,8 +248,10 @@ module riscv_controller
|
|||
pc_mux_o = `PC_JUMP;
|
||||
|
||||
// if there is a jr stall, wait for it to be gone
|
||||
if (~jr_stall_o)
|
||||
if ((~jr_stall_o) && (~jump_done_q)) begin
|
||||
pc_set_o = 1'b1;
|
||||
jump_done = 1'b1;
|
||||
end
|
||||
|
||||
// we don't have to change our current state here as the prefetch
|
||||
// buffer is automatically invalidated, thus the next instruction
|
||||
|
@ -506,10 +511,14 @@ module riscv_controller
|
|||
if ( rst_n == 1'b0 )
|
||||
begin
|
||||
ctrl_fsm_cs <= RESET;
|
||||
jump_done_q <= 1'b0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
ctrl_fsm_cs <= ctrl_fsm_ns;
|
||||
|
||||
// clear when id is valid (no instruction incoming)
|
||||
jump_done_q <= jump_done & (~id_valid_i);
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -357,8 +357,6 @@ module riscv_if_stage
|
|||
end
|
||||
else
|
||||
begin
|
||||
if (clear_instr_valid_i)
|
||||
instr_valid_id_o <= 1'b0;
|
||||
|
||||
if (if_valid_o)
|
||||
begin
|
||||
|
@ -371,7 +369,11 @@ module riscv_if_stage
|
|||
|
||||
if (fetch_is_hwlp)
|
||||
hwlp_dec_cnt_id_o <= hwlp_dec_cnt_if;
|
||||
|
||||
end else if (clear_instr_valid_i) begin
|
||||
instr_valid_id_o <= 1'b0;
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue