summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Blake Kongslie2023-01-22 14:27:12 -0800
committerJulian Blake Kongslie2023-01-22 14:27:12 -0800
commitd0208c8159e7e454e9d3eec8f65a7050afa0e8af (patch)
tree282fe11e0df49af44eecf776c364ffa589b57139
parentIgnore redundant fill responses in inline_cache. (diff)
downloadnanosim-d0208c8159e7e454e9d3eec8f65a7050afa0e8af.tar.xz
Add write-through store support in inline_cache.HEADmain
-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;