summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorbd <bdunaisky@umass.edu>2025-04-01 02:12:15 +0000
committerGitHub <noreply@github.com>2025-04-01 02:12:15 +0000
commit6f536bd1bd1abab307c79d688c993e930cf7c250 (patch)
tree6132673f5aa85f2488d6f7de77fb33538b7320d3 /inc
parent44cb9d396b909c84ef7ad3338e0a12cfcc082748 (diff)
parent574212dafcf1c4bdb7d5e6aaa577b74345988d67 (diff)
Merge pull request #45 from bdunahu/dev-sid
MEM WB stage
Diffstat (limited to 'inc')
-rw-r--r--inc/id.h3
-rw-r--r--inc/instr.h7
-rw-r--r--inc/instrDTO.h14
-rw-r--r--inc/stage.h9
4 files changed, 28 insertions, 5 deletions
diff --git a/inc/id.h b/inc/id.h
index 3ff5063..ebbe290 100644
--- a/inc/id.h
+++ b/inc/id.h
@@ -64,8 +64,7 @@ class ID : public Stage
* @param the resulting third field, which varies per type.
* @param the resulting mnemonic.
*/
- void get_instr_fields(
- signed int &s1, signed int &s2, signed int &s3, Mnemonic &m);
+ void get_instr_fields(signed int &s1, signed int &s2, signed int &s3, Mnemonic &m, Type &t);
void decode_R_type(signed int &s1, signed int &s2, signed int &s3);
void decode_I_type(signed int &s1, signed int &s2, signed int &s3);
void decode_J_type(signed int &s1, signed int &s2);
diff --git a/inc/instr.h b/inc/instr.h
index 7fbb42b..d17613d 100644
--- a/inc/instr.h
+++ b/inc/instr.h
@@ -45,6 +45,13 @@ enum Mnemonic {
NOP,
};
+enum Type {
+ R,
+ I,
+ J,
+ INV
+};
+
namespace instr
{
// clang-format off
diff --git a/inc/instrDTO.h b/inc/instrDTO.h
index 77a223e..8249122 100644
--- a/inc/instrDTO.h
+++ b/inc/instrDTO.h
@@ -43,6 +43,10 @@ class InstrDTO
* @return the mnemonic of the instruction
*/
Mnemonic get_mnemonic();
+ /**
+ * @return the type of the instruction
+ */
+ Type get_type();
/**
* @param set hist key
@@ -68,6 +72,11 @@ class InstrDTO
* @param the mnemonic of the instruction
*/
void set_mnemonic(Mnemonic);
+
+ /**
+ * @param the type of the instruction
+ */
+ void set_type(Type);
private:
/**
@@ -91,6 +100,11 @@ class InstrDTO
* The mnemonic of the operation.
*/
Mnemonic mnemonic;
+
+ /**
+ * Type of the instruction
+ */
+ Type type;
};
#endif /* INSTRDTO_H_INCLUDED */
diff --git a/inc/stage.h b/inc/stage.h
index 84d2a7b..03048b0 100644
--- a/inc/stage.h
+++ b/inc/stage.h
@@ -30,11 +30,9 @@ class Stage
* Advances this stage by a single clock cycle.
* A boilerplate version is provided in stage.cc.
*
- * @param a DTO object containing the next instruction to be processed.
* @param a response, indicating whether or not the parent pipe stage is
* ready to accept a new instruction object next cycle.
- * @return a response, indicating whether this pipeline stage is stalling,
- * busy, or done.
+ * @return a DTO object containing the next instruction to be processed.
*
* Must set the status to STALLED when an operation completes.
*/
@@ -55,6 +53,11 @@ class Stage
*/
void set_pc(unsigned int pc);
+ /**
+ * Squashes the pipeline.
+ */
+ void squash();
+
protected:
/**
* The function expected to do the majority of the work.