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

frontend: remove the RAS


Signed-off-by: default avatarAlban Gruin <alban.gruin@irit.fr>
parent 549281aa
No related branches found
No related tags found
No related merge requests found
Pipeline #457 failed
...@@ -158,7 +158,7 @@ module frontend import ariane_pkg::*; #( ...@@ -158,7 +158,7 @@ module frontend import ariane_pkg::*; #(
// unconditional jumps with known target -> immediately resolved // unconditional jumps with known target -> immediately resolved
assign is_jump[i] = instruction_valid[i] & (rvi_jump[i] | rvc_jump[i]); assign is_jump[i] = instruction_valid[i] & (rvi_jump[i] | rvc_jump[i]);
// unconditional jumps with unknown target -> BTB // unconditional jumps with unknown target -> BTB
assign is_jalr[i] = instruction_valid[i] & ~is_return[i] & ~is_call[i] & (rvi_jalr[i] | rvc_jalr[i] | rvc_jr[i]); assign is_jalr[i] = instruction_valid[i] & (rvi_jalr[i] | rvc_jalr[i] | rvc_jr[i]);
// cf that needs a prediction // cf that needs a prediction
assign is_cf[i] = instruction_valid[i] & (rvi_branch[i] | rvc_branch[i] | rvi_jalr[i] | rvc_jalr[i] | rvc_jr[i]); assign is_cf[i] = instruction_valid[i] & (rvi_branch[i] | rvc_branch[i] | rvi_jalr[i] | rvc_jalr[i] | rvc_jr[i]);
...@@ -178,10 +178,10 @@ module frontend import ariane_pkg::*; #( ...@@ -178,10 +178,10 @@ module frontend import ariane_pkg::*; #(
// lower most prediction gets precedence // lower most prediction gets precedence
for (int i = INSTR_PER_FETCH - 1; i >= 0 ; i--) begin for (int i = INSTR_PER_FETCH - 1; i >= 0 ; i--) begin
unique case ({is_branch[i], is_return[i], is_jump[i], is_jalr[i]}) unique case ({is_branch[i], is_jump[i], is_jalr[i]})
4'b0000:; // regular instruction e.g.: no branch 3'b000:; // regular instruction e.g.: no branch
// unconditional jump to register, we need the BTB to resolve this // unconditional jump to register, we need the BTB to resolve this
4'b0001: begin 3'b001: begin
ras_pop = 1'b0; ras_pop = 1'b0;
ras_push = 1'b0; ras_push = 1'b0;
if (btb_prediction_shifted[i].valid) begin if (btb_prediction_shifted[i].valid) begin
...@@ -190,23 +190,15 @@ module frontend import ariane_pkg::*; #( ...@@ -190,23 +190,15 @@ module frontend import ariane_pkg::*; #(
end end
end end
// its an unconditional jump to an immediate // its an unconditional jump to an immediate
4'b0010: begin 3'b010: begin
ras_pop = 1'b0; ras_pop = 1'b0;
ras_push = 1'b0; ras_push = 1'b0;
taken_rvi_cf[i] = rvi_jump[i]; taken_rvi_cf[i] = rvi_jump[i];
taken_rvc_cf[i] = rvc_jump[i]; taken_rvc_cf[i] = rvc_jump[i];
cf_type[i] = ariane_pkg::Jump; cf_type[i] = ariane_pkg::Jump;
end end
// 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;
end
// branch prediction // branch prediction
4'b1000: begin 3'b100: begin
ras_pop = 1'b0; ras_pop = 1'b0;
ras_push = 1'b0; ras_push = 1'b0;
// if we have a valid dynamic prediction use it // if we have a valid dynamic prediction use it
...@@ -224,12 +216,6 @@ module frontend import ariane_pkg::*; #( ...@@ -224,12 +216,6 @@ module frontend import ariane_pkg::*; #(
default:; default:;
// default: $error("Decoded more than one control flow"); // default: $error("Decoded more than one control flow");
endcase endcase
// if this instruction, in addition, is a call, save the resulting address
// but only if we actually consumed the address
if (is_call[i]) begin
ras_push = instr_queue_consumed[i];
ras_update = addr[i] + (rvc_call[i] ? 2 : 4);
end
// calculate the jump target address // calculate the jump target address
if (taken_rvc_cf[i] || taken_rvi_cf[i]) begin if (taken_rvc_cf[i] || taken_rvi_cf[i]) begin
predict_address = addr[i] + (taken_rvc_cf[i] ? rvc_imm[i] : rvi_imm[i]); predict_address = addr[i] + (taken_rvc_cf[i] ? rvc_imm[i] : rvi_imm[i]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment