summaryrefslogtreecommitdiff
path: root/src/mem/protocol/MOESI_hammer-dir.sm
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/protocol/MOESI_hammer-dir.sm')
-rw-r--r--src/mem/protocol/MOESI_hammer-dir.sm12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mem/protocol/MOESI_hammer-dir.sm b/src/mem/protocol/MOESI_hammer-dir.sm
index a4f4bf17a..a20619d46 100644
--- a/src/mem/protocol/MOESI_hammer-dir.sm
+++ b/src/mem/protocol/MOESI_hammer-dir.sm
@@ -186,8 +186,16 @@ machine(Directory, "AMD Hammer-like protocol")
TBETable TBEs, template_hack="<Directory_TBE>";
- Entry getDirectoryEntry(Address addr), return_by_ref="yes" {
- return static_cast(Entry, directory[addr]);
+ Entry getDirectoryEntry(Address addr), return_by_pointer="yes" {
+ Entry dir_entry := static_cast(Entry, "pointer", directory[addr]);
+
+ if (is_valid(dir_entry)) {
+ return dir_entry;
+ }
+
+ dir_entry := static_cast(Entry, "pointer",
+ directory.allocate(addr, new Entry));
+ return dir_entry;
}
DataBlock getDataBlock(Address addr), return_by_ref="yes" {