cva6/core/frontend
Bill94l 6d08ed1389
[Fix] fence.i fails to synchronize ICache/DCache flushes in write-back mode (#2971)
Fix fence.i synchronization issue with HPDCache write-back Data

Add [halt_frontend_o] signal to stall instruction fetch during fence.i
Introduce [fence_i_active] state to track ICache+DCache flush progress
Gate ICache requests and NPC updates when fence.i is active
Resolves stale instruction fetch in self-modifying code scenarios (riscv-tests/rv32ui/fence_i)
Enables Linux boot with HPDCache write-back data by ensuring ICache/DCache coherency
Note: This was not seen with [std_dcache] in standard [fence_i] tests, since it normally finishes write‑back before the ICache flush completes. However, for large self‑modifying code regions, the write‑back can lag behind the ICache flush, leading to stale instruction fetches even with [std_dcache].

Problem:
When executing self-modifying code or booting Linux with a write-back D$, fence.i flushes the ICache but allows the frontend to fetch new instructions before the DCache flush completes. This causes the core to execute stale instructions from the ICache that were modified in the DCache (Dirty data may not be written back because the DCache is still flushing).

Root Cause:
The frontend resumes fetching immediately after ICache flush, even if the DCache is still flushing.
NPC (Next PC) continues advancing after ICache flush, leading to incorrect instruction fetch.
Solution:

Introduce halt_frontend_o signal to freeze frontend during fence.i.
Add fence_i_active state in controller to track combined ICache+DCache flush.
Gate ICache requests (icache_dreq_o.req) and NPC updates (if_ready) during fence_i_active.
2025-05-21 13:30:28 +02:00
..
bht.sv Altera opt 2 (#2602) 2024-11-21 23:36:18 +01:00
bht2lvl.sv bp: add BHT with private history (#2793) 2025-03-06 09:45:45 +01:00
btb.sv Fixed btb for FPGA targets (#2521) 2024-10-02 23:31:40 +02:00
frontend.sv [Fix] fence.i fails to synchronize ICache/DCache flushes in write-back mode (#2971) 2025-05-21 13:30:28 +02:00
instr_queue.sv remove ifndef VERILATOR (#2686) 2025-01-08 09:08:44 +01:00
instr_scan.sv doc: fix description of signals in instr_scan.sv (#2752) 2025-01-31 05:44:24 +01:00
ras.sv Parametrization step 3 part 2 (#1939) 2024-03-18 12:06:55 +01:00