From 58ca44a7a02426ff493c60323241d40f084c6362 Mon Sep 17 00:00:00 2001 From: bd Date: Fri, 21 Mar 2025 16:42:16 -0400 Subject: add 'process' function to handle boilerplate on every request --- inc/cache.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'inc/cache.h') diff --git a/inc/cache.h b/inc/cache.h index a5fa16e..ef9c9e4 100644 --- a/inc/cache.h +++ b/inc/cache.h @@ -41,6 +41,18 @@ class Cache : public Storage std::array, L1_CACHE_LINES> get_meta() const; 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 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 -- cgit v1.2.3