mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-24 06:07:19 -04:00
frontend: Prevent prediction on invalid RAS entry (#475)
* bp_valid = 0 if ras_predict.valid = 0 Signed-off-by: Massimiliano Giacometti <massimiliano.giacometti@hensoldt-cyber.com> * Update src/frontend/frontend.sv Co-authored-by: Florian Zaruba <zarubaf@iis.ee.ethz.ch> Signed-off-by: Massimiliano Giacometti <massimiliano.giacometti@hensoldt-cyber.com> Co-authored-by: Florian Zaruba <zarubaf@iis.ee.ethz.ch>
This commit is contained in:
parent
1b65b8865a
commit
c57b275df5
1 changed files with 4 additions and 1 deletions
|
@ -230,7 +230,10 @@ module frontend #(
|
|||
// or reduce struct
|
||||
always_comb begin
|
||||
bp_valid = 1'b0;
|
||||
for (int i = 0; i < INSTR_PER_FETCH; i++) bp_valid |= (cf_type[i] != NoCF);
|
||||
// BP cannot be valid if we have a return instruction and the RAS is not giving a valid address
|
||||
// Check that we encountered a control flow and that for a return the RAS
|
||||
// contains a valid prediction.
|
||||
for (int i = 0; i < INSTR_PER_FETCH; i++) bp_valid |= ((cf_type[i] != NoCF & cf_type[i] != Return) | ((cf_type[i] == Return) & ras_predict.valid));
|
||||
end
|
||||
assign is_mispredict = resolved_branch_i.valid & resolved_branch_i.is_mispredict;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue