Fix a half-valid valid address phase being left behind when taking a new path with the jump going straight to the bus. If left in place, this causes the next-next fetch to be marked as half valid, corrupting fetch data.

This commit is contained in:
Luke Wren 2022-06-16 01:42:28 +01:00
parent f8aad6d2f3
commit d9389fb23e
3 changed files with 5 additions and 3 deletions

View File

@ -146,8 +146,9 @@ always @ (posedge clk or negedge rst_n) begin
// branch, it *must* be a valid branch instruction, because executing
// the branch is how we recover from misprediction
`ifdef FORMAL
// This can be defeated if you branch backward halfway into a 32-bit instruction that immediately precedes the branch.
if (predicted_branch && !d_starved && !debug_mode) begin
// This can be defeated if you branch backward halfway into a 32-bit
// instruction that immediately precedes the branch.
if (predicted_branch && !d_starved && !debug_mode && !d_except_instr_bus_fault) begin
assert(!d_invalid);
assert(d_branchcond == BCOND_ZERO || d_branchcond == BCOND_NZERO);
end

View File

@ -348,6 +348,7 @@ always @ (posedge clk or negedge rst_n) begin
if (jump_now) begin
if (|EXTENSION_C) begin
if (mem_addr_rdy) begin
mem_aph_hwvld <= 2'b11;
mem_data_hwvld <= {1'b1, !jump_target[1]};
end else begin
mem_aph_hwvld <= {1'b1, !jump_target[1]};

View File

@ -35,7 +35,7 @@ SEPARATE_COMPILE=1
# You must also define below how to create an object file, and how to link.
OBJOUT = -o
LFLAGS = -T ../../common/memmap.ld
ASFLAGS = -c -march=rv32imc_zicsr
ASFLAGS = -c -march=rv32im_zicsr
OFLAG = -o
COUT = -c