Skip to content

Commit 418350e

Browse files
authored
feat(refill-check): add mask to refill check (#723)
After OpenXiangShan/XiangShan#3051, we have supported low-power read (read only 5 out of 8 8B-banks) in ICacheDataArray, and in V3, it was further modified to dynamically compute the mask based on the taken branch location. Though, refill-check in difftest does not support masked comparison, instead it checks entire 512bit, so it will fail if we enable checks on cacheid >=3 (#712). As we're refactoring ICache recently, we need this check to ensure the refactored code is working properly. Therefore, this PR tries to introduce masked refill-check, each mask bit controls comparison of 8B data.
1 parent 105be59 commit 418350e

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/main/scala/Bundles.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ class L2TLBEvent extends DifftestBaseBundle with HasValid {
315315
class RefillEvent extends DifftestBaseBundle with HasValid {
316316
val addr = UInt(64.W)
317317
val data = Vec(8, UInt(64.W))
318+
val mask = UInt(8.W)
318319
}
319320

320321
class ScEvent extends DifftestBaseBundle with HasValid {

src/test/csrc/difftest/difftest.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -949,12 +949,8 @@ int Difftest::do_store_check() {
949949
// cacheid: 0 -> icache
950950
// 1 -> dcache
951951
// 2 -> pagecache
952-
// 3 -> icache PIQ refill ipf
953-
// 4 -> icache mainPipe port0 toIFU
954-
// 5 -> icache mainPipe port1 toIFU
955-
// 6 -> icache ipf refill cache
956-
// 7 -> icache mainPipe port0 read PIQ
957-
// 8 -> icache mainPipe port1 read PIQ
952+
// 3 -> icache mainPipe read cacheline 0 (masked)
953+
// 4 -> icache mainPipe read cacheline 1 (masked)
958954
int Difftest::do_refill_check(int cacheid) {
959955
#ifdef CONFIG_DIFFTEST_REFILLEVENT
960956
auto dut_refill = &(dut->refill[cacheid]);
@@ -980,7 +976,7 @@ int Difftest::do_refill_check(int cacheid) {
980976
}
981977
for (int i = 0; i < 8; i++) {
982978
read_goldenmem(dut_refill->addr + i * 8, &buf, 8, &flag_buf);
983-
if (dut_refill->data[i] != *((uint64_t *)buf)) {
979+
if ((dut_refill->mask & (1 << i)) && dut_refill->data[i] != *((uint64_t *)buf)) {
984980
#ifdef CONFIG_DIFFTEST_CMOINVALEVENT
985981
if (cmo_inval_event_set.find(dut_refill->addr) != cmo_inval_event_set.end()) {
986982
// If the data inconsistency occurs in the cache block operated by CBO.INVAL,
@@ -1022,7 +1018,7 @@ int Difftest::do_refill_check(int cacheid) {
10221018
return 0;
10231019
}
10241020
#endif // CONFIG_DIFFTEST_UNCACHEMMSTOREEVENT
1025-
Info("cacheid=%d,realpaddr=0x%lx: Refill test failed!\n", cacheid, realpaddr);
1021+
Info("cacheid=%d,mask=%x,realpaddr=0x%lx: Refill test failed!\n", cacheid, dut_refill->mask, realpaddr);
10261022
Info("addr: %lx\nGold: ", dut_refill->addr);
10271023
for (int j = 0; j < 8; j++) {
10281024
read_goldenmem(dut_refill->addr + j * 8, &buf, 8);

0 commit comments

Comments
 (0)