Skip to content
Snippets Groups Projects
Commit 82d5abd9 authored by Alban Gruin's avatar Alban Gruin
Browse files

frontend: disable branch prediction, mkI


Signed-off-by: default avatarAlban Gruin <alban.gruin@irit.fr>
parent 33682980
No related branches found
No related tags found
No related merge requests found
......@@ -281,6 +281,7 @@ module ariane import ariane_pkg::*; #(
.fetch_entry_ready_i ( fetch_ready_id_if ),
.has_mem_access_o ( has_mem_access_if_verif ),
.branch_speculation_o( bsp_if_perf ),
.enable_bp_i ( 1'b0 ),
.*
);
......
......@@ -46,7 +46,9 @@ module frontend import ariane_pkg::*; #(
input logic fetch_entry_ready_i, // ID acknowledged this instruction
output logic has_mem_access_o,
output logic branch_speculation_o
output logic branch_speculation_o,
input logic enable_bp_i
);
// Instruction Cache Registers, from I$
logic [FETCH_WIDTH-1:0] icache_data_q;
......@@ -179,7 +181,7 @@ module frontend import ariane_pkg::*; #(
4'b0001: begin
ras_pop = 1'b0;
ras_push = 1'b0;
if (btb_prediction_shifted[i].valid) begin
if (btb_prediction_shifted[i].valid & enable_bp_i) begin
predict_address = btb_prediction_shifted[i].target_address;
cf_type[i] = ariane_pkg::JumpR;
end
......@@ -195,26 +197,30 @@ module frontend import ariane_pkg::*; #(
// return
4'b0100: begin
// make sure to only alter the RAS if we actually consumed the instruction
ras_pop = ras_predict.valid & instr_queue_consumed[i];
ras_push = 1'b0;
predict_address = ras_predict.ra;
cf_type[i] = ariane_pkg::Return;
ras_pop = ras_predict.valid & instr_queue_consumed[i];
if (enable_bp_i) begin
predict_address = ras_predict.ra;
cf_type[i] = ariane_pkg::Return;
end
end
// branch prediction
4'b1000: begin
ras_pop = 1'b0;
ras_push = 1'b0;
// if we have a valid dynamic prediction use it
if (bht_prediction_shifted[i].valid) begin
taken_rvi_cf[i] = rvi_branch[i] & bht_prediction_shifted[i].taken;
taken_rvc_cf[i] = rvc_branch[i] & bht_prediction_shifted[i].taken;
// otherwise default to static prediction
end else begin
// set if immediate is negative - static prediction
taken_rvi_cf[i] = rvi_branch[i] & rvi_imm[i][riscv::VLEN-1];
taken_rvc_cf[i] = rvc_branch[i] & rvc_imm[i][riscv::VLEN-1];
if (enable_bp_i) begin
// if we have a valid dynamic prediction use it
if (bht_prediction_shifted[i].valid) begin
taken_rvi_cf[i] = rvi_branch[i] & bht_prediction_shifted[i].taken;
taken_rvc_cf[i] = rvc_branch[i] & bht_prediction_shifted[i].taken;
// otherwise default to static prediction
end else begin
// set if immediate is negative - static prediction
taken_rvi_cf[i] = rvi_branch[i] & rvi_imm[i][riscv::VLEN-1];
taken_rvc_cf[i] = rvc_branch[i] & rvc_imm[i][riscv::VLEN-1];
end
if (taken_rvi_cf[i] || taken_rvc_cf[i]) cf_type[i] = ariane_pkg::Branch;
end
if (taken_rvi_cf[i] || taken_rvc_cf[i]) cf_type[i] = ariane_pkg::Branch;
end
default:;
// default: $error("Decoded more than one control flow");
......@@ -227,7 +233,9 @@ module frontend import ariane_pkg::*; #(
end
// calculate the jump target address
if (taken_rvc_cf[i] || taken_rvi_cf[i]) begin
predict_address = addr[i] + (taken_rvc_cf[i] ? rvc_imm[i] : rvi_imm[i]);
if (rvi_jump[i] || rvc_jump[i] || enable_bp_i) begin
predict_address = addr[i] + (taken_rvc_cf[i] ? rvc_imm[i] : rvi_imm[i]);
end
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment