From d21a1a9caa1f1791343a5376121936e552b1124c Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 29 Mar 2025 17:11:17 -0400 Subject: Fetch stage properly holds objects until parent is ready --- inc/stage.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'inc/stage.h') diff --git a/inc/stage.h b/inc/stage.h index 761b9f6..ff4455b 100644 --- a/inc/stage.h +++ b/inc/stage.h @@ -7,6 +7,7 @@ #include "storage.h" #include #include +#include class Stage { @@ -17,17 +18,16 @@ class Stage * @return A newly allocated stage object. */ Stage(Stage *next); - virtual ~Stage() = default; + virtual ~Stage(); /** * Advances this stage by a single clock cycle. - * @param a DTO object containing various information about an instruction - * moving through the pipeline. + * @param a DTO object containing the next instruction to be processed. * @param a response, indicating whether or not the parent pipe stage is - * busy. + * ready to accept a new instruction object next cycle. * @return a response, indicating whether this pipeline stage is stalling, * busy, or done. */ - virtual Response advance(InstrDTO &i, Response p) = 0; + virtual Response advance(InstrDTO &next_instr, Response p) = 0; protected: /** @@ -56,10 +56,6 @@ class Stage * The address of the currently executing instruction. */ static unsigned int pc; - /** - * A pointer to the next stage in the pipeline. - */ - Stage *next; /** * A pointer to the top-level storage device. */ @@ -72,6 +68,18 @@ class Stage * The current clock cycle. */ static int clock_cycle; + /** + * A pointer to the next stage in the pipeline. + */ + Stage *next; + /** + * A pointer to the current instruction this stage is processing. + */ + std::unique_ptr curr_instr; + /** + * The current status of this stage. + */ + Response status; private: /** -- cgit v1.2.3