diff options
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/controller.h | 8 | ||||
| -rw-r--r-- | inc/ex.h | 14 | ||||
| -rw-r--r-- | inc/id.h | 14 | ||||
| -rw-r--r-- | inc/if.h | 14 | ||||
| -rw-r--r-- | inc/mm.h | 14 | ||||
| -rw-r--r-- | inc/stage.h | 8 | ||||
| -rw-r--r-- | inc/wb.h | 14 | 
7 files changed, 80 insertions, 6 deletions
diff --git a/inc/controller.h b/inc/controller.h index 0cafe10..56f3836 100644 --- a/inc/controller.h +++ b/inc/controller.h @@ -1,5 +1,6 @@  #ifndef CONTROLLER_H  #define CONTROLLER_H +#include "response.h"  #include "stage.h"  /** @@ -15,7 +16,6 @@ class Controller : public Stage  	 * @return A newly allocated controller object.  	 */  	Controller(Storage *storage, bool is_pipelined); -	~Controller();  	/**  	 * Direct the simulator to run for `number` clock cycles. @@ -34,14 +34,10 @@ class Controller : public Stage  	 * @return the pc.  	 */  	int get_pc(); +	Response advance();    private:  	/** -	 * Helper for run_for. -	 * Advances the simulation by a single cycle. -	 */ -	void advance(); -	/**  	 * The current clock cycle.  	 */  	int clock_cycle; diff --git a/inc/ex.h b/inc/ex.h new file mode 100644 index 0000000..c560eda --- /dev/null +++ b/inc/ex.h @@ -0,0 +1,14 @@ +#ifndef EX_H +#define EX_H +#include "response.h" +#include "stage.h" + +class EX : public Stage +{ +  public: +	using Stage::Stage; + +	Response advance(); +}; + +#endif /* EX_H_INCLUDED */ diff --git a/inc/id.h b/inc/id.h new file mode 100644 index 0000000..dcfda82 --- /dev/null +++ b/inc/id.h @@ -0,0 +1,14 @@ +#ifndef ID_H +#define ID_H +#include "response.h" +#include "stage.h" + +class ID : public Stage +{ +  public: +	using Stage::Stage; + +	Response advance(); +}; + +#endif /* ID_D_INCLUDED */ diff --git a/inc/if.h b/inc/if.h new file mode 100644 index 0000000..d9599dd --- /dev/null +++ b/inc/if.h @@ -0,0 +1,14 @@ +#ifndef IF_H +#define IF_H +#include "response.h" +#include "stage.h" + +class IF : public Stage +{ +  public: +	using Stage::Stage; + +	Response advance(); +}; + +#endif /* IF_H_INCLUDED */ diff --git a/inc/mm.h b/inc/mm.h new file mode 100644 index 0000000..e9d04d5 --- /dev/null +++ b/inc/mm.h @@ -0,0 +1,14 @@ +#ifndef MM_H +#define MM_H +#include "response.h" +#include "stage.h" + +class MM : public Stage +{ +  public: +	using Stage::Stage; + +	Response advance(); +}; + +#endif /* MM_H_INCLUDED */ diff --git a/inc/stage.h b/inc/stage.h index 769818c..494f3d3 100644 --- a/inc/stage.h +++ b/inc/stage.h @@ -1,13 +1,21 @@  #ifndef STAGE_H  #define STAGE_H  #include "definitions.h" +#include "response.h"  #include "storage.h"  #include <array>  class Stage  {    public: +	Stage(Stage *next);  	virtual ~Stage() = default; +	/** +	 * Advances this stage by a single clock cycle. +	 * @return a response, indicating whether this pipeline stage is stalled, +	 * busy, or done. +	 */ +	virtual Response advance() = 0;    protected:  	/** diff --git a/inc/wb.h b/inc/wb.h new file mode 100644 index 0000000..031bf20 --- /dev/null +++ b/inc/wb.h @@ -0,0 +1,14 @@ +#ifndef WB_H +#define WB_H +#include "response.h" +#include "stage.h" + +class WB : public Stage +{ +  public: +	using Stage::Stage; + +	Response advance(); +}; + +#endif /* WB_H_INCLUDED */  | 
