summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-04-27 09:12:50 -0400
committerGitHub <noreply@github.com>2025-04-27 09:12:50 -0400
commit5653b2a033e7a4173d2f178b5ce52384666d3d7b (patch)
tree5c8fc7282ad1ce0c215786a70b35296645df2a1b /tests
parent3d0133c2f793e82d7519d8e2c5023114cd0f0eab (diff)
parenta4dd1f00a5d0108058fb3bfbd5f399a507792859 (diff)
Merge pull request #68 from bdunahu/bdunahu
[WIP] Pipeline cleanup and revisited GUI storage display
Diffstat (limited to 'tests')
-rw-r--r--tests/controller.cc2
-rw-r--r--tests/dum.h35
-rw-r--r--tests/ex.cc102
-rw-r--r--tests/id.cc52
-rw-r--r--tests/if.cc16
5 files changed, 121 insertions, 86 deletions
diff --git a/tests/controller.cc b/tests/controller.cc
index 1d1ddb6..9bc71f6 100644
--- a/tests/controller.cc
+++ b/tests/controller.cc
@@ -37,7 +37,7 @@ class ControllerPipeFixture
InstrDTO *i = nullptr;
int j;
for (j = 0; j < this->stage_num + 1; ++j) {
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
}
}
diff --git a/tests/dum.h b/tests/dum.h
new file mode 100644
index 0000000..e60ffad
--- /dev/null
+++ b/tests/dum.h
@@ -0,0 +1,35 @@
+#ifndef DUM_H
+#define DUM_H
+
+#include "instrDTO.h"
+#include "response.h"
+#include "stage.h"
+
+/**
+ * Don't underestimate mocks (the DUM pipe stage).
+ */
+class DUM : public Stage
+{
+ public:
+ using Stage::Stage;
+
+ InstrDTO *advance(Response p) override
+ {
+ InstrDTO *r = nullptr;
+
+ if (this->curr_instr && p == READY) {
+ r = new InstrDTO(*this->curr_instr);
+ delete this->curr_instr;
+ curr_instr = nullptr;
+ }
+
+ return r;
+ }
+
+ void set_curr_instr(InstrDTO *d) { this->curr_instr = d; };
+
+ private:
+ void advance_helper() override{};
+};
+
+#endif /* DUM_H_INCLUDED */
diff --git a/tests/ex.cc b/tests/ex.cc
index 400916e..5972182 100644
--- a/tests/ex.cc
+++ b/tests/ex.cc
@@ -27,15 +27,15 @@ class EXFixture
execute_instr(signed int s1, signed int s2, signed int s3, Mnemonic m)
{
InstrDTO *i = new InstrDTO();
- i->set_s1(s1);
- i->set_s2(s2);
- i->set_s3(s3);
- i->set_mnemonic(m);
+ i->operands.integer.slot_one = s1;
+ i->operands.integer.slot_two = s2;
+ i->operands.integer.slot_three = s3;
+ i->mnemonic = m;
this->dum->set_curr_instr(i);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
return i;
@@ -57,7 +57,7 @@ TEST_CASE_METHOD(EXFixture, "ADD within bounds", "[ex]")
s1 = 42000, s2 = -41958, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 42);
+ CHECK(i->operands.integer.slot_one == 42);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -74,7 +74,7 @@ TEST_CASE_METHOD(EXFixture, "ADD overflow", "[ex]")
s1 = MAX_INT, s2 = 1, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -(MAX_INT)-1);
+ CHECK(i->operands.integer.slot_one == -(MAX_INT)-1);
CHECK(ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -91,7 +91,7 @@ TEST_CASE_METHOD(EXFixture, "ADD underflow", "[ex]")
s1 = -(MAX_INT)-1, s2 = -1, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == MAX_INT);
+ CHECK(i->operands.integer.slot_one == MAX_INT);
CHECK(!ct->get_condition(OF));
CHECK(ct->get_condition(UF));
@@ -108,7 +108,7 @@ TEST_CASE_METHOD(EXFixture, "SUB within bounds", "[ex]")
s1 = 200, s2 = 131, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 69);
+ CHECK(i->operands.integer.slot_one == 69);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -125,7 +125,7 @@ TEST_CASE_METHOD(EXFixture, "SUB overflow", "[ex]")
s1 = MAX_INT, s2 = -1, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -(MAX_INT)-1);
+ CHECK(i->operands.integer.slot_one == -(MAX_INT)-1);
CHECK(ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -142,7 +142,7 @@ TEST_CASE_METHOD(EXFixture, "SUB underflow", "[ex]")
s1 = -(MAX_INT)-1, s2 = 1, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == MAX_INT);
+ CHECK(i->operands.integer.slot_one == MAX_INT);
CHECK(!ct->get_condition(OF));
CHECK(ct->get_condition(UF));
@@ -159,7 +159,7 @@ TEST_CASE_METHOD(EXFixture, "MUL within bounds", "[ex]")
s1 = 200, s2 = 200, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 40000);
+ CHECK(i->operands.integer.slot_one == 40000);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -176,7 +176,7 @@ TEST_CASE_METHOD(EXFixture, "MUL overflow", "[ex]")
s1 = MAX_INT, s2 = MAX_INT, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 1);
+ CHECK(i->operands.integer.slot_one == 1);
CHECK(ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -193,7 +193,7 @@ TEST_CASE_METHOD(EXFixture, "MUL underflow", "[ex]")
s1 = MAX_INT, s2 = -MAX_INT, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -1);
+ CHECK(i->operands.integer.slot_one == -1);
CHECK(!ct->get_condition(OF));
CHECK(ct->get_condition(UF));
@@ -210,7 +210,7 @@ TEST_CASE_METHOD(EXFixture, "QUOT within bounds", "[ex]")
s1 = 2043, s2 = 40, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 51);
+ CHECK(i->operands.integer.slot_one == 51);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -227,7 +227,7 @@ TEST_CASE_METHOD(EXFixture, "QUOT overflow", "[ex]")
s1 = -(MAX_INT)-1, s2 = -1, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -(MAX_INT)-1);
+ CHECK(i->operands.integer.slot_one == -(MAX_INT)-1);
CHECK(ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -258,7 +258,7 @@ TEST_CASE_METHOD(EXFixture, "REM within bounds", "[ex]")
s1 = 2043, s2 = 40, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 3);
+ CHECK(i->operands.integer.slot_one == 3);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -289,7 +289,7 @@ TEST_CASE_METHOD(EXFixture, "SFTR within bounds", "[ex]")
s1 = 1300, s2 = 6, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 20);
+ CHECK(i->operands.integer.slot_one == 20);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -314,7 +314,7 @@ TEST_CASE_METHOD(EXFixture, "SFTL within bounds", "[ex]")
s1 = 13, s2 = 6, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 832);
+ CHECK(i->operands.integer.slot_one == 832);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -339,7 +339,7 @@ TEST_CASE_METHOD(EXFixture, "AND", "[ex]")
s1 = 1234, s2 = 5678, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 1026);
+ CHECK(i->operands.integer.slot_one == 1026);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -356,7 +356,7 @@ TEST_CASE_METHOD(EXFixture, "OR", "[ex]")
s1 = 1234, s2 = 5678, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 5886);
+ CHECK(i->operands.integer.slot_one == 5886);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -373,7 +373,7 @@ TEST_CASE_METHOD(EXFixture, "NOT", "[ex]")
s1 = 1234, s2 = -1, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -1235);
+ CHECK(i->operands.integer.slot_one == -1235);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -390,7 +390,7 @@ TEST_CASE_METHOD(EXFixture, "XOR", "[ex]")
s1 = 1234, s2 = 5678, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 4860);
+ CHECK(i->operands.integer.slot_one == 4860);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -456,7 +456,7 @@ TEST_CASE_METHOD(EXFixture, "CMP less", "[ex]")
i = execute_instr(s1, s2, s3, m);
// should not be changed
- CHECK(i->get_s1() == -1);
+ CHECK(i->operands.integer.slot_one == -1);
CHECK(!ct->get_condition(EQ));
CHECK(!ct->get_condition(GT));
@@ -477,7 +477,7 @@ TEST_CASE_METHOD(EXFixture, "CMP equal", "[ex]")
i = execute_instr(s1, s2, s3, m);
// should not be changed
- CHECK(i->get_s1() == 20);
+ CHECK(i->operands.integer.slot_one == 20);
CHECK(ct->get_condition(EQ));
CHECK(!ct->get_condition(GT));
@@ -498,7 +498,7 @@ TEST_CASE_METHOD(EXFixture, "CMP greater", "[ex]")
i = execute_instr(s1, s2, s3, m);
// should not be changed
- CHECK(i->get_s1() == 21);
+ CHECK(i->operands.integer.slot_one == 21);
CHECK(!ct->get_condition(EQ));
CHECK(ct->get_condition(GT));
@@ -531,7 +531,7 @@ TEST_CASE_METHOD(EXFixture, "LOAD", "[ex]")
s3 = -41958;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 42);
+ CHECK(i->operands.integer.slot_one == 42);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -553,7 +553,7 @@ TEST_CASE_METHOD(EXFixture, "ADDI within bounds", "[ex]")
s3 = -41958;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 42);
+ CHECK(i->operands.integer.slot_one == 42);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -570,7 +570,7 @@ TEST_CASE_METHOD(EXFixture, "ADDI overflow", "[ex]")
s1 = MAX_INT, s2 = 0, s3 = 1;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -(MAX_INT)-1);
+ CHECK(i->operands.integer.slot_one == -(MAX_INT)-1);
CHECK(ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -587,7 +587,7 @@ TEST_CASE_METHOD(EXFixture, "ADDI underflow", "[ex]")
s1 = -(MAX_INT)-1, s2 = 0, s3 = -1;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == MAX_INT);
+ CHECK(i->operands.integer.slot_one == MAX_INT);
CHECK(!ct->get_condition(OF));
CHECK(ct->get_condition(UF));
@@ -604,7 +604,7 @@ TEST_CASE_METHOD(EXFixture, "SUBI within bounds", "[ex]")
s1 = 200, s2 = 0, s3 = 131;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 69);
+ CHECK(i->operands.integer.slot_one == 69);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -621,7 +621,7 @@ TEST_CASE_METHOD(EXFixture, "SUBI overflow", "[ex]")
s1 = -(MAX_INT)-1, s2 = 0, s3 = 1;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == MAX_INT);
+ CHECK(i->operands.integer.slot_one == MAX_INT);
CHECK(!ct->get_condition(OF));
CHECK(ct->get_condition(UF));
@@ -638,7 +638,7 @@ TEST_CASE_METHOD(EXFixture, "SUBI underflow", "[ex]")
s1 = MAX_INT, s2 = 0, s3 = -1;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -(MAX_INT)-1);
+ CHECK(i->operands.integer.slot_one == -(MAX_INT)-1);
CHECK(ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -655,7 +655,7 @@ TEST_CASE_METHOD(EXFixture, "SFTRI within bounds", "[ex]")
s1 = 1300, s2 = 0, s3 = 6;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 20);
+ CHECK(i->operands.integer.slot_one == 20);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -680,7 +680,7 @@ TEST_CASE_METHOD(EXFixture, "SFTLI within bounds", "[ex]")
s1 = 13, s2 = 0, s3 = 6;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 832);
+ CHECK(i->operands.integer.slot_one == 832);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -705,7 +705,7 @@ TEST_CASE_METHOD(EXFixture, "ANDI", "[ex]")
s1 = 1234, s2 = 0, s3 = 5678;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 1026);
+ CHECK(i->operands.integer.slot_one == 1026);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -722,7 +722,7 @@ TEST_CASE_METHOD(EXFixture, "ORI", "[ex]")
s1 = 1234, s2 = 0, s3 = 5678;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 5886);
+ CHECK(i->operands.integer.slot_one == 5886);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -739,7 +739,7 @@ TEST_CASE_METHOD(EXFixture, "XORI", "[ex]")
s1 = 1234, s2 = 0, s3 = 5678;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 4860);
+ CHECK(i->operands.integer.slot_one == 4860);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -756,7 +756,7 @@ TEST_CASE_METHOD(EXFixture, "STORE", "[ex]")
s1 = 42000, s2 = 0, s3 = -41958;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 42);
+ CHECK(i->operands.integer.slot_one == 42);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -777,7 +777,7 @@ TEST_CASE_METHOD(EXFixture, "JMP", "[ex]")
s1 = 42000, s2 = -41958, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 42);
+ CHECK(i->operands.integer.slot_one == 42);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -794,7 +794,7 @@ TEST_CASE_METHOD(EXFixture, "JRL", "[ex]")
s1 = 100, s2 = 69, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 69);
+ CHECK(i->operands.integer.slot_one == 69);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -811,7 +811,7 @@ TEST_CASE_METHOD(EXFixture, "JAL", "[ex]")
s1 = 42000, s2 = -41958, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 42);
+ CHECK(i->operands.integer.slot_one == 42);
CHECK(!ct->get_condition(OF));
CHECK(!ct->get_condition(UF));
@@ -828,7 +828,7 @@ TEST_CASE_METHOD(EXFixture, "BEQ no cond", "[ex]")
s1 = 100, s2 = 50, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -1);
+ CHECK(i->operands.integer.slot_one == -1);
delete i;
}
@@ -844,7 +844,7 @@ TEST_CASE_METHOD(EXFixture, "BEQ", "[ex]")
this->ct->set_condition(EQ, true);
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 50);
+ CHECK(i->operands.integer.slot_one == 50);
delete i;
}
@@ -859,7 +859,7 @@ TEST_CASE_METHOD(EXFixture, "BGT no cond", "[ex]")
s1 = 100, s2 = 50, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -1);
+ CHECK(i->operands.integer.slot_one == -1);
delete i;
}
@@ -875,7 +875,7 @@ TEST_CASE_METHOD(EXFixture, "BGT", "[ex]")
this->ct->set_condition(GT, true);
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 50);
+ CHECK(i->operands.integer.slot_one == 50);
delete i;
}
@@ -890,7 +890,7 @@ TEST_CASE_METHOD(EXFixture, "BUF no cond", "[ex]")
s1 = 100, s2 = -42027, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -1);
+ CHECK(i->operands.integer.slot_one == -1);
delete i;
}
@@ -906,7 +906,7 @@ TEST_CASE_METHOD(EXFixture, "BUF", "[ex]")
this->ct->set_condition(UF, true);
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 50);
+ CHECK(i->operands.integer.slot_one == 50);
delete i;
}
@@ -921,7 +921,7 @@ TEST_CASE_METHOD(EXFixture, "BOF no cond", "[ex]")
s1 = 100, s2 = -42027, s3 = 0;
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == -1);
+ CHECK(i->operands.integer.slot_one == -1);
delete i;
}
@@ -937,7 +937,7 @@ TEST_CASE_METHOD(EXFixture, "BOF", "[ex]")
this->ct->set_condition(OF, true);
i = execute_instr(s1, s2, s3, m);
- CHECK(i->get_s1() == 50);
+ CHECK(i->operands.integer.slot_one == 50);
delete i;
}
diff --git a/tests/id.cc b/tests/id.cc
index 321c013..a81e967 100644
--- a/tests/id.cc
+++ b/tests/id.cc
@@ -26,12 +26,12 @@ class IDFixture
InstrDTO *decode_bits(signed int raw)
{
InstrDTO *i = new InstrDTO();
- i->set_instr_bits(raw);
+ i->slot_A = raw;
this->dum->set_curr_instr(i);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
return i;
@@ -92,7 +92,7 @@ TEST_CASE_METHOD(IDFixture, "Parse invalid type", "[id]")
t = this->encode_R_type(0b0, 0b1, 0b10, 0b11, 0b11);
i = this->decode_bits(t);
- CHECK(i->get_mnemonic() == NOP);
+ CHECK(i->mnemonic == NOP);
delete i;
}
@@ -105,10 +105,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # one", "[id]")
t = this->encode_R_type(0b101, 0b110, 0b111, 0b11, 0b0);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0x00000000);
- CHECK(i->get_mnemonic() == MUL);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x00000000);
+ CHECK(i->operands.integer.slot_three == 0x00000000);
+ CHECK(i->mnemonic == MUL);
delete i;
}
@@ -121,10 +121,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # two", "[id]")
t = this->encode_R_type(0b10000, 0b01000, 0b00100, 0b10, 0b0);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0x00000000);
- CHECK(i->get_mnemonic() == SUB);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x00000000);
+ CHECK(i->operands.integer.slot_three == 0x00000000);
+ CHECK(i->mnemonic == SUB);
delete i;
}
@@ -137,10 +137,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # one", "[id]")
t = this->encode_I_type(0xF, 0b101, 0b110, 0b0111, 0b1);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0xF);
- CHECK(i->get_mnemonic() == ANDI);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x00000000);
+ CHECK(i->operands.integer.slot_three == 0xF);
+ CHECK(i->mnemonic == ANDI);
delete i;
}
@@ -153,10 +153,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # two", "[id]")
t = this->encode_I_type(0xCC, 0b101, 0b110, 0b1011, 0b1);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0xCC);
- CHECK(i->get_mnemonic() == STOREV);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x00000000);
+ CHECK(i->operands.integer.slot_three == 0xCC);
+ CHECK(i->mnemonic == STOREV);
delete i;
}
@@ -169,9 +169,9 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # one", "[id]")
t = this->encode_J_type(0x3456, 0b10101, 0b0111, 0b10);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x3456);
- CHECK(i->get_mnemonic() == BOF);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x3456);
+ CHECK(i->mnemonic == BOF);
delete i;
}
@@ -185,9 +185,9 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # two", "[id]")
i = this->decode_bits(t);
t = 0xFFFBBCCF;
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == t);
- CHECK(i->get_mnemonic() == JAL);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == t);
+ CHECK(i->mnemonic == JAL);
delete i;
}
diff --git a/tests/if.cc b/tests/if.cc
index 8b30d0e..e2a7dbe 100644
--- a/tests/if.cc
+++ b/tests/if.cc
@@ -36,7 +36,7 @@ class IFFixture
int i;
for (i = 0; i < this->m_delay + 1; ++i) {
- r = this->ct->advance(WAIT);
+ r = this->ct->advance(READY);
// check response
CHECK(r == nullptr);
}
@@ -52,11 +52,11 @@ class IFFixture
int i;
for (i = 0; i < this->c_delay; ++i) {
- r = this->ct->advance(WAIT);
+ r = this->ct->advance(READY);
// check response
REQUIRE(r == nullptr);
}
- r = this->ct->advance(WAIT);
+ r = this->ct->advance(READY);
// check response
REQUIRE(r != nullptr);
return r;
@@ -75,7 +75,7 @@ TEST_CASE_METHOD(IFFixture, "fetch returns single instuction", "[if_pipe]")
InstrDTO *i;
i = this->fetch_through();
- REQUIRE(i->get_instr_bits() == this->p[0]);
+ REQUIRE(i->slot_A == this->p[0]);
delete i;
}
@@ -88,13 +88,13 @@ TEST_CASE_METHOD(IFFixture, "fetch returns two instuctions", "[if_pipe]")
expected_cycles = this->m_delay + this->c_delay + 2;
i = this->fetch_through();
- REQUIRE(i->get_instr_bits() == this->p[0]);
+ REQUIRE(i->slot_A == this->p[0]);
delete i;
expected_cycles += this->c_delay + 1;
i = this->fetch_cache();
- REQUIRE(i->get_instr_bits() == this->p[1]);
+ REQUIRE(i->slot_A == this->p[1]);
delete i;
}
@@ -122,9 +122,9 @@ TEST_CASE_METHOD(IFFixture, "fetch waits with old instruction", "[if_pipe]")
REQUIRE(i != nullptr);
}
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
- REQUIRE(i->get_instr_bits() == this->p[0]);
+ REQUIRE(i->slot_A == this->p[0]);
delete i;
}