diff options
author | bd <bdunahu@operationnull.com> | 2025-03-29 19:45:21 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-29 19:45:21 -0400 |
commit | 6bce0485a0f9ce92bc235f063a1f9aab2d59a1c9 (patch) | |
tree | 8ac46090c2d9b8570464fcb76fd26c19a4f7f7a9 /inc/stage.h | |
parent | d21a1a9caa1f1791343a5376121936e552b1124c (diff) |
Add proper read and write guard methods, clean up id test file
Diffstat (limited to 'inc/stage.h')
-rw-r--r-- | inc/stage.h | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/inc/stage.h b/inc/stage.h index ff4455b..19e3896 100644 --- a/inc/stage.h +++ b/inc/stage.h @@ -6,7 +6,7 @@ #include "response.h" #include "storage.h" #include <array> -#include <set> +#include <deque> #include <memory> class Stage @@ -31,15 +31,18 @@ class Stage protected: /** - * Facilitates register checkout. - * It does this by checking that the register passed in is not currently - * checked out. If true, then replaces r with the value of the register and - * returns OK. If false, returns STALLED. - * - * @param the registers number, to be dereferenced. - * @return OK if `r` is not checked out, STALLED otherwise. + * Helper for `check_out`. + * Returns true if r are not checked out, false otherwise. + * @param a list of register numbers. + * @return true if registers are not in checked_out, false otherwise. + */ + bool is_checked_out(signed int r); + /** + * Returns the value of the register corresponding to `v`. + * @param the register number. + * @return the value in the associated register. */ - Response check_out(unsigned int &r); + signed int dereference_register(signed int v); /** * The name of the pipeline stage. */ @@ -68,6 +71,11 @@ class Stage * The current clock cycle. */ static int clock_cycle; + // TODO fix this comment after writeback stage + /** + * The set of registers currently checked out. + */ + static std::deque<signed int> checked_out; /** * A pointer to the next stage in the pipeline. */ @@ -80,33 +88,6 @@ class Stage * The current status of this stage. */ Response status; - - private: - /** - * Helper for `check_out`. - * Returns true if r are not checked out, false otherwise. - * @param a list of register numbers. - * @return true if registers are not in checked_out, false otherwise. - */ - bool is_checked_out(unsigned int r); - /** - * Helper for `check_out`. - * Checks out a single register, and places it in checked_out. - * @param a register number. - * @return the value in the register. - */ - signed int check_out_register(unsigned int r); - // TODO fix this comment after writeback stage - /** - * Helper for `check_out_register` - * @param the register number. - * @return the value in the associated register. - */ - signed int dereference_register(unsigned int r); - /** - * The set of registers currently checked out. - */ - static std::set<unsigned int> checked_out; }; #endif /* STAGE_H_INCLUDED */ |