summaryrefslogtreecommitdiff
path: root/src/sim/id.cc
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 /src/sim/id.cc
parent12a9e93f913c0057f2ef32f5894931c8b4bd3a85 (diff)
parent6a15f66bef28de9e1b982c3adda4d9b75c818852 (diff)
Merge pull request #42 from bdunahu/bdunahu
Add tests for EX, rest of (non-vector) instructions
Diffstat (limited to 'src/sim/id.cc')
-rw-r--r--src/sim/id.cc40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/sim/id.cc b/src/sim/id.cc
index 36addbb..edf74e2 100644
--- a/src/sim/id.cc
+++ b/src/sim/id.cc
@@ -8,25 +8,6 @@
ID::ID(Stage *stage) : Stage(stage) { this->id = DCDE; }
-void ID::get_instr_fields(
- signed int &s1, signed int &s2, signed int &s3, Mnemonic &m)
-{
- unsigned int type;
- this->split_instr(s1, type, m);
-
- switch (type) {
- case 0b00:
- this->decode_R_type(s1, s2, s3);
- break;
- case 0b01:
- this->decode_I_type(s1, s2, s3);
- break;
- case 0b10:
- this->decode_J_type(s1, s2);
- break;
- }
-}
-
void ID::split_instr(signed int &raw, unsigned int &type, Mnemonic &m)
{
unsigned int opcode, opcode_size;
@@ -80,6 +61,27 @@ void ID::advance_helper()
}
}
+void ID::get_instr_fields(
+ signed int &s1, signed int &s2, signed int &s3, Mnemonic &m)
+{
+ unsigned int type;
+ this->split_instr(s1, type, m);
+
+ switch (type) {
+ case 0b00:
+ this->decode_R_type(s1, s2, s3);
+ break;
+ case 0b01:
+ this->decode_I_type(s1, s2, s3);
+ break;
+ case 0b10:
+ this->decode_J_type(s1, s2);
+ break;
+ case 0b11:
+ this->status = OK;
+ }
+}
+
void ID::decode_R_type(signed int &s1, signed int &s2, signed int &s3)
{
unsigned int s0b, s1b, s2b;