summaryrefslogtreecommitdiff
path: root/inc/cache.h
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-22 11:00:14 -0400
committerGitHub <noreply@github.com>2025-03-22 11:00:14 -0400
commitb73f7fbe952494e245c44fdd4b6123bac1b4ec97 (patch)
tree9386aa3ccd2302fceb9750858d74ab56f156b4e2 /inc/cache.h
parent45d63d831637ba9c4fb8cd8070dc7d2705fd3348 (diff)
parent544e764cd5a774c5d653771923b3ae8a28a618f7 (diff)
Merge pull request #29 from bdunahu/bdunahu
Small cleanups to up a lot of implementation details
Diffstat (limited to 'inc/cache.h')
-rw-r--r--inc/cache.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/inc/cache.h b/inc/cache.h
index 3b16ca1..ef9c9e4 100644
--- a/inc/cache.h
+++ b/inc/cache.h
@@ -42,6 +42,27 @@ class Cache : public Storage
private:
/**
+ * Helper for all access methods.
+ * Calls `request_handler` when `accessor` is allowed to complete its
+ * request cycle.
+ * @param the source making the request
+ * @param the address to write to
+ * @param the function to call when an access should be completed
+ */
+ Response process(
+ Accessor accessor,
+ int address,
+ std::function<void(int index, int offset)> request_handler);
+ /**
+ * Returns OK if `accessor` is allowed to complete its request this cycle.
+ * Handles cache misses, wait times, and setting the current accessor this
+ * storage is serving.
+ * @param the accessor asking for a resource
+ * @return whether or not the access can be carried out this function call.
+ */
+ Response is_access_cleared(Accessor accessor, int address);
+ /**
+ * Helper for access_cleared.
* Fetches `address` from a lower level of storage if it is not already
* present. If it is not, temporarily sets the is_blocked attribute of this
* cache level to true, and the victim line is chosen/written back.