summaryrefslogtreecommitdiff
path: root/inc/dram.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/dram.h')
-rw-r--r--inc/dram.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/inc/dram.h b/inc/dram.h
index c7f927a..e6db633 100644
--- a/inc/dram.h
+++ b/inc/dram.h
@@ -32,22 +32,25 @@ class Dram : public Storage
private:
/**
- * Helper for `write` a word
+ * 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
*/
- void do_write(signed int, int);
- /**
- * Helper for writing a line.
- */
- void
- do_write_line(std::array<signed int, LINE_SIZE> data_line, int address);
- /**
- * Helper for `read` a line
- */
- void do_read(std::array<signed int, LINE_SIZE> &data_line, int address);
+ Response process(
+ Accessor accessor,
+ int address,
+ std::function<void(int line, int word)> request_handler);
/**
- * Helper for reading a word.
+ * 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.
+ * @param the accessor asking for a resource
+ * @return whether or not the access can be carried out this function call.
*/
- void do_read_word(signed int &data, int address);
+ Response is_access_cleared(Accessor accessor);
};
std::ostream &operator<<(std::ostream &os, const Dram &d);