summaryrefslogtreecommitdiff
path: root/tests/id.cc
diff options
context:
space:
mode:
authorbd <bdunaisky@umass.edu>2025-04-18 00:58:40 +0000
committerGitHub <noreply@github.com>2025-04-18 00:58:40 +0000
commit480181957b3f3dbcf7731023504c2cacc8d181ea (patch)
treee936781b52c6846d87c98381ed47bc7da7c43bff /tests/id.cc
parent62b9e280d5d0222710e491dcd28fe26bea915dcd (diff)
parent984ce6eef2e439955ff991f90c2b654be7c6c3f3 (diff)
Merge pull request #54 from bdunahu/bdunahu
The pipeline says some things and there are numbers
Diffstat (limited to 'tests/id.cc')
-rw-r--r--tests/id.cc78
1 files changed, 5 insertions, 73 deletions
diff --git a/tests/id.cc b/tests/id.cc
index 06eec0c..321c013 100644
--- a/tests/id.cc
+++ b/tests/id.cc
@@ -102,7 +102,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # one", "[id]")
signed int t;
InstrDTO *i;
- t = this->encode_R_type(0b0, 0b1, 0b10, 0b11, 0b0);
+ t = this->encode_R_type(0b101, 0b110, 0b111, 0b11, 0b0);
i = this->decode_bits(t);
CHECK(i->get_s1() == 0x00000000); // registers are empty
@@ -134,7 +134,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # one", "[id]")
signed int t;
InstrDTO *i;
- t = this->encode_I_type(0xF, 0b1, 0b10, 0b0111, 0b1);
+ t = this->encode_I_type(0xF, 0b101, 0b110, 0b0111, 0b1);
i = this->decode_bits(t);
CHECK(i->get_s1() == 0x00000000); // registers are empty
@@ -150,7 +150,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # two", "[id]")
signed int t;
InstrDTO *i;
- t = this->encode_I_type(0xCC, 0b010, 0b101, 0b1011, 0b1);
+ t = this->encode_I_type(0xCC, 0b101, 0b110, 0b1011, 0b1);
i = this->decode_bits(t);
CHECK(i->get_s1() == 0x00000000); // registers are empty
@@ -184,8 +184,9 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # two", "[id]")
t = this->encode_J_type(0xBBCCF, 0b10101, 0b0011, 0b10);
i = this->decode_bits(t);
+ t = 0xFFFBBCCF;
CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0xFFFBBCCF);
+ CHECK(i->get_s2() == t);
CHECK(i->get_mnemonic() == JAL);
delete i;
@@ -205,72 +206,3 @@ TEST_CASE_METHOD(IDFixture, "read does not conflict with read", "[id]")
this->d->read_guard(v);
REQUIRE(v == 0b0);
}
-
-TEST_CASE_METHOD(IDFixture, "write does not conflict with write", "[id]")
-{
- signed int v;
-
- v = 0b1;
- this->d->write_guard(v);
- REQUIRE(v == 0b0);
-
- v = 0b1;
- this->d->write_guard(v);
- REQUIRE(v == 0b0);
-}
-
-TEST_CASE_METHOD(IDFixture, "write does not conflict with read", "[id]")
-{
- signed int v;
- Response r;
-
- v = 0b1;
- r = this->d->read_guard(v);
- CHECK(v == 0b0);
- REQUIRE(r == OK);
-
- v = 0b1;
- this->d->write_guard(v);
- REQUIRE(v == 0b0);
-}
-
-TEST_CASE_METHOD(IDFixture, "read does conflict with write", "[id]")
-{
- signed int v;
- Response r;
-
- v = 0b1;
- this->d->write_guard(v);
- REQUIRE(v == 0b0);
-
- v = 0b1;
- r = this->d->read_guard(v);
- CHECK(v == 0b01);
- REQUIRE(r == STALLED);
-}
-
-TEST_CASE_METHOD(IDFixture, "stores indefinite conflicts", "[id]")
-{
- signed int v, ov;
- Response r;
-
- v = 0b1;
- ov = v;
- while (v < 0b110) {
- this->d->write_guard(v);
- REQUIRE(v == 0b0);
- v = ++ov;
- }
- this->d->write_guard(v);
- REQUIRE(v == 0b0);
-
- v = 0b110;
- r = this->d->read_guard(v);
- CHECK(v == 0b110);
- REQUIRE(r == STALLED);
-
- v = 0b1;
- r = this->d->read_guard(v);
- CHECK(v == 0b1);
- REQUIRE(r == STALLED);
-}