mem-ruby,sim-se: Fix functional reads for MESI protocols

This commit fixes three issues in MESI_Three_Level and MESI_Two_Level
implementations (MEI_Three_Level_HTM might still have issues).

1) Define functional read priorities for the cache controllers which
have states with Maybe_Stale access permission (L1 > L2 > Directory).

2) Fix incorrect access permissions in MESI_Three_Level-L1cache:
* S_IL0 is Read_Only, it is waiting for L0 to acknowledge the
  invalidation request before moving to SS, also a Read_Only state.
* E_IL0 is Maybe_Stale, its contents might be valid, since there is a
  transition (E_IL0, L0_Ack, EE) with no writeback data.
* M_IL0 is Maybe_Stale, its contents might be valid, since there is a
  transition (M_IL0, L0_Ack, MM) with no writeback data.

3) Add missing message types carrying valid data in functional reads:
* INV_DATA is a writeback from L0 to L1.
* DATA is a response to GET_S, but there are scenarios where it might
  be the only place with valid data (e.g. during L2 replacement).

Change-Id: Ie44fa317027f9ede272967e7461d337e14355eec
This commit is contained in:
Marleson Graf
2024-08-21 16:47:45 -03:00
committed by Bobby R. Bruce
parent 63d110fb7a
commit c31bc284a8
4 changed files with 17 additions and 3 deletions

View File

@@ -90,9 +90,9 @@ machine(MachineType:L1Cache, "MESI Directory L1 Cache CMP")
// For all of the following states, invalidate
// message has been sent to L0 cache. The response
// from the L0 cache has not been seen yet.
S_IL0, AccessPermission:Busy, desc="Shared in L1, invalidation sent to L0, have not seen response yet";
E_IL0, AccessPermission:Busy, desc="Exclusive in L1, invalidation sent to L0, have not seen response yet";
M_IL0, AccessPermission:Busy, desc="Modified in L1, invalidation sent to L0, have not seen response yet";
S_IL0, AccessPermission:Read_Only, desc="Shared in L1, invalidation sent to L0, have not seen response yet";
E_IL0, AccessPermission:Maybe_Stale, desc="Exclusive in L1, invalidation sent to L0, have not seen response yet";
M_IL0, AccessPermission:Maybe_Stale, desc="Modified in L1, invalidation sent to L0, have not seen response yet";
MM_IL0, AccessPermission:Read_Write, desc="Invalidation sent to L0, have not seen response yet";
SM_IL0, AccessPermission:Busy, desc="Invalidation sent to L0, have not seen response yet";
}
@@ -231,6 +231,10 @@ machine(MachineType:L1Cache, "MESI Directory L1 Cache CMP")
}
}
int functionalReadPriority() {
return 10;
}
int functionalWrite(Addr addr, Packet *pkt) {
int num_functional_writes := 0;

View File

@@ -83,6 +83,8 @@ structure(CoherenceMsg, desc="...", interface="Message") {
bool functionalRead(Packet *pkt) {
// Valid data block is only present in message with following types
if (Class == CoherenceClass:PUTX ||
Class == CoherenceClass:INV_DATA ||
Class == CoherenceClass:DATA ||
Class == CoherenceClass:DATA_EXCLUSIVE) {
return testAndRead(addr, DataBlk, pkt);
}

View File

@@ -238,6 +238,10 @@ machine(MachineType:L2Cache, "MESI Directory L2 Cache CMP")
}
}
int functionalReadPriority() {
return 20;
}
int functionalWrite(Addr addr, Packet *pkt) {
int num_functional_writes := 0;

View File

@@ -163,6 +163,10 @@ machine(MachineType:Directory, "MESI Two Level directory protocol")
}
}
int functionalReadPriority() {
return 30;
}
int functionalWrite(Addr addr, Packet *pkt) {
int num_functional_writes := 0;