diff options
author | bd <bdunahu@operationnull.com> | 2025-03-21 16:42:16 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-21 16:42:16 -0400 |
commit | 58ca44a7a02426ff493c60323241d40f084c6362 (patch) | |
tree | 9386aa3ccd2302fceb9750858d74ab56f156b4e2 /inc | |
parent | 75f78c215131499165101a499197313ba77ea230 (diff) |
add 'process' function to handle boilerplate on every request
Diffstat (limited to 'inc')
-rw-r--r-- | inc/cache.h | 12 | ||||
-rw-r--r-- | inc/dram.h | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/inc/cache.h b/inc/cache.h index a5fa16e..ef9c9e4 100644 --- a/inc/cache.h +++ b/inc/cache.h @@ -42,6 +42,18 @@ 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. @@ -32,6 +32,18 @@ class Dram : 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 line, int word)> request_handler); + /** * Returns OK if `accessor` is allowed to complete its request this cycle. * Handles wait times, side door, and setting the current accessor this * storage is serving. |