diff options
author | bd <bdunahu@operationnull.com> | 2025-04-01 00:49:52 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-01 00:49:52 -0400 |
commit | 6579f7272905d1e25b43ef051da6c2180e60ca2b (patch) | |
tree | a4b217aa56126f7d05304ab93f6c36b66fd6b694 /inc | |
parent | a4e0e5ff6208205f6ebd980f9ed1eca91dcc4311 (diff) |
Ensure all stages only do work if they are not 'OK'
Diffstat (limited to 'inc')
-rw-r--r-- | inc/instr.h | 8 | ||||
-rw-r--r-- | inc/stage.h | 18 |
2 files changed, 11 insertions, 15 deletions
diff --git a/inc/instr.h b/inc/instr.h index d17613d..2b1807a 100644 --- a/inc/instr.h +++ b/inc/instr.h @@ -1,7 +1,6 @@ #ifndef INSTR_H #define INSTR_H #include <functional> -#include <iostream> #include <unordered_map> enum Mnemonic { @@ -45,12 +44,7 @@ enum Mnemonic { NOP, }; -enum Type { - R, - I, - J, - INV -}; +enum Type { R, I, J, INV }; namespace instr { diff --git a/inc/stage.h b/inc/stage.h index 03048b0..2f9812f 100644 --- a/inc/stage.h +++ b/inc/stage.h @@ -34,7 +34,7 @@ class Stage * ready to accept a new instruction object next cycle. * @return a DTO object containing the next instruction to be processed. * - * Must set the status to STALLED when an operation completes. + * Must set the status to WAIT when the current instruction is evicted.. */ virtual InstrDTO *advance(Response p); @@ -47,6 +47,12 @@ class Stage * @param the condition code to retrieve, */ bool get_condition(CC c); + /** + * Sets the bit in the condition code register corresponding to `c`. + * @param the condition code to set. + * @param the truthy value to set it to. + */ + void set_condition(CC c, bool v); /** * Sets the value of the PC register. @@ -62,16 +68,12 @@ class Stage /** * The function expected to do the majority of the work. * - * Must set the status to OK when an operation is ready. + * Must set the status to OK when an operation is done. + * Must set the status to STALLED when an operation cannot be completed the + * current cycle. */ virtual void advance_helper() = 0; /** - * Sets the bit in the condition code register corresponding to `c`. - * @param the condition code to set. - * @param the truthy value to set it to. - */ - void set_condition(CC c, bool v); - /** * Helper for `check_out`. * Returns true if r are not checked out, false otherwise. * @param a list of register numbers. |