summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--memory/cache.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/memory/cache.h b/memory/cache.h
index c7fb602..4c3b3d9 100644
--- a/memory/cache.h
+++ b/memory/cache.h
@@ -59,6 +59,20 @@ namespace memory {
59 d = r.data; 59 d = r.data;
60 } 60 }
61 61
62 void opportunistic_store(std::uint64_t address, unsigned int d) {
63 auto line_address = address >> LINE_BYTES_LOG2;
64 auto set_address = line_address & LINE_SET_OFFSET_MASK;
65 auto &stags = tags[set_address];
66 auto &sdata = data[set_address];
67 for (unsigned int i = 0; i < WAYS; ++i) {
68 auto &stag = stags[i];
69 if (stag.serial && stag.line_address == line_address) {
70 sdata[i][address & LINE_BYTE_OFFSET_MASK] = d;
71 return;
72 }
73 }
74 }
75
62 std::optional<tag> probe(std::uint64_t address) { 76 std::optional<tag> probe(std::uint64_t address) {
63 auto line_address = address >> LINE_BYTES_LOG2; 77 auto line_address = address >> LINE_BYTES_LOG2;
64 auto set_address = line_address & LINE_SET_OFFSET_MASK; 78 auto set_address = line_address & LINE_SET_OFFSET_MASK;