From 723488d0c81ffdbced0143570c04d8e37dd384f7 Mon Sep 17 00:00:00 2001 From: canxin121 Date: Sun, 26 Oct 2025 00:21:46 +0800 Subject: [PATCH] Fix DCache store_data for AMO operations For AMO instructions, store_data should return the computed result (pstore1_storegen_data) instead of the input data (pstore1_data). Use Mux to select based on operation type: AMO result vs input data. --- src/main/scala/rocket/DCache.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/rocket/DCache.scala b/src/main/scala/rocket/DCache.scala index 4e456d785c..046576a5e1 100644 --- a/src/main/scala/rocket/DCache.scala +++ b/src/main/scala/rocket/DCache.scala @@ -972,7 +972,7 @@ class DCacheModule(outer: DCache) extends HellaCacheModule(outer) { io.cpu.resp.bits.data := loadgen.data | s2_sc_fail io.cpu.resp.bits.data_word_bypass := loadgen.wordData io.cpu.resp.bits.data_raw := s2_data_word - io.cpu.resp.bits.store_data := pstore1_data + io.cpu.resp.bits.store_data := Mux(isAMO(pstore1_cmd), pstore1_storegen_data, pstore1_data) // AMOs if (usingRMW) {