summaryrefslogtreecommitdiff
path: root/inc/wb.h
blob: c4755eaa5559afcf9390a2584da980c5b83204e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef WB_H
#define WB_H
#include "instrDTO.h"
#include "response.h"
#include "stage.h"

class WB : public Stage
{
  public:
	/**
	 * Constructor.
	 * @param The next stage in the pipeline.
	 * @return A newly allocated WB object.
	 */
	WB(Stage *next);
	using Stage::advance;

  private:
	void advance_helper() override;
	/**
	 * Performs the actual work of storing into a register.
	 */
	void write_handler();
	/**
	 * Performs the actual work of processing a jump instruction.
	 */
	void jump_handler();
	/**
	 * @return true if the current instruction is an R or I type and is not a
	 * STORE.
	 */
	bool should_write();
	/**
	 * @return true if the current instruction is a J type and is not a push.
	 * STORE.
	 */
	bool should_jump();
};

#endif /* WB_H_INCLUDED */