Fix delete key handling and assembler crashes#3
Merged
Conversation
Gaok1
added a commit
that referenced
this pull request
Apr 3, 2026
## New instructions - **RV32A**: LR.W, SC.W, and all AMO variants (AMOSWAP, AMOADD, AMOXOR, AMOAND, AMOOR, AMOMAX, AMOMIN, AMOMAXU, AMOMINU) now route through the cache layer via `lr_w` / `sc_w` / `amo_w` on the `Bus` trait. LR/SC reservations are tracked per-hart inside `CacheController` (and per-hart in the CPU registers as a fallback for bypass mode). Any store to a reserved word cancels the reservation. - **FENCE**: forwards to `Bus::fence()` (was a no-op). - **FENCE.I**: implemented as `Bus::fence_i()`, invalidates the I-cache so self-modifying code picks up freshly written instructions. - Instruction panel type badges extended: `[A]` (atomic) and `[F]` (float). ## Cache coherence bug fixes (multi-level hierarchy) Four bugs that caused silent data corruption when L1 D-cache + L2 are both enabled (program crash at PC=0x00000000 with rust-to-raven.elf): 1. **Blanket L2 invalidation after write-back stores removed.** `dcache_store_bytes` was invalidating L2 after every store. On a write-allocate miss this sequence ran: fetch L2 → evict dirty D-cache line → writeback dirty data to L2 → then invalidate that same L2 line. Data ended up in neither cache level nor RAM (silent loss, corrupted stack return addresses → PC=0). 2. **Write-through stores now correctly invalidate L2.** Write-through keeps D-cache lines clean, so evictions never writeback to L2. After a write-through store, the L2 copy is stale and must be dropped so future misses re-read the updated value from RAM. 3. **`sync_to_ram` writeback order fixed.** Was: D-cache first, then L2. Now: L2 (reversed outer levels) first, then D-cache. D-cache is always authoritative; writing L2 last would overwrite correct D-cache data with stale L2 data in RAM. 4. **`flush_all` writeback order fixed** (same root cause as #3). Called when the user toggles the cache off; same reversal applied. ## Pipeline improvements - Per-FU (ALU, MUL, DIV, FPU, LSU, SYS) stall counters and configurable functional-unit counts. - Branch predictor extended: not-taken (default), always-taken, BTFNT, and 2-bit dynamic. - Per-hazard stall tag breakdown in the pipeline footer. - `.pcfg` config format updated: per-bypass-path flags replace single `forwarding` boolean; `fu.*` counts added. - Speculative Gantt: in-flight speculative instructions shown with distinct styling; flushed instructions marked. ## rust-to-raven - `raven_api` restructured: `hart.rs` moved to `hardware_thread/`, `atomic/` module added with `Arc`, `AtomicBool`, `AtomicU32`, etc. backed by LR.W/SC.W so they actually work on the simulator. - `main.rs` updated to use `HartTask` with a closure-based API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.