summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-30 21:30:17 -0400
committerGitHub <noreply@github.com>2025-03-30 21:30:17 -0400
commit52e1ca72925444b8e5a9bb5b240a4063a4d7b958 (patch)
treebfd8e383eedbd40f5c9067e04734f62ed6ccab23 /inc
parent12a9e93f913c0057f2ef32f5894931c8b4bd3a85 (diff)
parent6a15f66bef28de9e1b982c3adda4d9b75c818852 (diff)
Merge pull request #42 from bdunahu/bdunahu
Add tests for EX, rest of (non-vector) instructions
Diffstat (limited to 'inc')
-rw-r--r--inc/ex.h2
-rw-r--r--inc/id.h32
-rw-r--r--inc/stage.h20
3 files changed, 32 insertions, 22 deletions
diff --git a/inc/ex.h b/inc/ex.h
index cc8062b..6d4254e 100644
--- a/inc/ex.h
+++ b/inc/ex.h
@@ -25,7 +25,7 @@ class EX : public Stage
*/
std::unordered_map<
Mnemonic,
- std::function<void(signed int &s1, signed int s2)>>
+ std::function<void(signed int &s1, signed int s2, signed int s3)>>
instr_map;
};
diff --git a/inc/id.h b/inc/id.h
index 9911440..3ff5063 100644
--- a/inc/id.h
+++ b/inc/id.h
@@ -21,22 +21,6 @@ class ID : public Stage
*/
/**
- * Parse an instruction into a type, opcode, and fields. If the type is
- * invalid, only the type field will be set.
- *
- * This method is marked public so it may be tested, and is not used outside
- * of this class during normal execution.
- *
- * @param the resulting first field, which varies per type. To call this
- * function properly, this field must contain the full instruction bytes on
- * function entry.
- * @param the resulting second field, which varies per type.
- * @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);
- /**
* Facilitates register checkout and data hazard management.
* It does this by checking that the register passed in is not currently
* checked out. If true, then replaces r with the value of the register and
@@ -66,6 +50,22 @@ class ID : public Stage
* @param the resulting second field.
* @param the resulting third field.
*/
+ /**
+ * Parse an instruction into a type, opcode, and fields. If the type is
+ * invalid, only the type field will be set.
+ *
+ * This method is marked public so it may be tested, and is not used outside
+ * of this class during normal execution.
+ *
+ * @param the resulting first field, which varies per type. To call this
+ * function properly, this field must contain the full instruction bytes on
+ * function entry.
+ * @param the resulting second field, which varies per type.
+ * @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 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/stage.h b/inc/stage.h
index 56a3589..84d2a7b 100644
--- a/inc/stage.h
+++ b/inc/stage.h
@@ -40,6 +40,21 @@ class Stage
*/
virtual InstrDTO *advance(Response p);
+ /* The following methods are made public so that they may be tested, and are
+ * not to be called from outside classes during standard execution.
+ */
+
+ /**
+ * Gets the bit in the condition code register correspondng to `c`.
+ * @param the condition code to retrieve,
+ */
+ bool get_condition(CC c);
+
+ /**
+ * Sets the value of the PC register.
+ */
+ void set_pc(unsigned int pc);
+
protected:
/**
* The function expected to do the majority of the work.
@@ -54,11 +69,6 @@ class Stage
*/
void set_condition(CC c, bool v);
/**
- * Gets the bit in the condition code register correspondng to `c`.
- * @param the condition code to retrieve,
- */
- bool get_condition(CC c);
- /**
* Helper for `check_out`.
* Returns true if r are not checked out, false otherwise.
* @param a list of register numbers.