btb: Remove clear flag

In anticipation of cleaning up the branch-prediction a clear flag is no
longer needed. We know at prediction time whether the instruction is a
branch or not. This makes the effect of aliasing very unlikely.
This commit is contained in:
Florian Zaruba 2019-04-19 17:59:48 +02:00
parent 1ebca456ad
commit 6902d2e53b
4 changed files with 1 additions and 12 deletions

View file

@ -301,13 +301,12 @@ package ariane_pkg;
// this is the struct we get back from ex stage and we will use it to update
// all the necessary data structures
typedef struct packed {
logic valid; // prediction with all its values is valid
logic [63:0] pc; // pc of predict or mis-predict
logic [63:0] target_address; // target address at which to jump, or not
logic is_mispredict; // set if this was a mis-predict
logic is_taken; // branch is taken
// in the lower 16 bit of the word
logic valid; // prediction with all its values is valid
logic clear; // invalidate this entry
cf_t cf_type; // Type of control flow change
} bp_resolve_t;
@ -326,7 +325,6 @@ package ariane_pkg;
logic valid;
logic [63:0] pc; // update at PC
logic [63:0] target_address;
logic clear;
} btb_update_t;
typedef struct packed {

View file

@ -43,7 +43,6 @@ module branch_unit (
resolved_branch_o.is_taken = 1'b0;
resolved_branch_o.valid = branch_valid_i;
resolved_branch_o.is_mispredict = 1'b0;
resolved_branch_o.clear = 1'b0;
resolved_branch_o.cf_type = branch_predict_i.cf_type;
// calculate next PC, depending on whether the instruction is compressed or not this may be different
next_pc = pc_i + ((is_compressed_instr_i) ? 64'h2 : 64'h4);
@ -99,8 +98,6 @@ module branch_unit (
// re-set the branch to the next PC
resolved_branch_o.is_mispredict = 1'b1;
resolved_branch_o.target_address = next_pc;
// clear this entry so that we are not constantly mis-predicting
resolved_branch_o.clear = 1'b1;
resolved_branch_o.valid = 1'b1;
resolve_branch_o = 1'b1;
end

View file

@ -57,11 +57,6 @@ module btb #(
btb_d[update_pc].valid = 1'b1;
// the target address is simply updated
btb_d[update_pc].target_address = btb_update_i.target_address;
// check if we should invalidate this entry, this happens in case we predicted a branch
// where actually none-is (aliasing)
if (btb_update_i.clear) begin
btb_d[update_pc].valid = 1'b0;
end
end
end

View file

@ -279,7 +279,6 @@ module frontend #(
assign btb_update.valid = resolved_branch_i.valid & (resolved_branch_i.cf_type == BTB);
assign btb_update.pc = resolved_branch_i.pc;
assign btb_update.target_address = resolved_branch_i.target_address;
assign btb_update.clear = resolved_branch_i.clear;
// -------------------
// Next PC