diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-05-11 11:51:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-11 11:51:15 -0400 |
commit | a35eb451889f0efa99ff7fe1c0a3a76afd5e7ad5 (patch) | |
tree | 44205b454c11a2d98711cd3226b4828e12a8479a /tests/id.cc | |
parent | c7132dbc9c38ff766053bd9a0b72c68b23cd08d2 (diff) | |
parent | 6f4e9e0b914c3e68691a5d884cbad0b5813fcf18 (diff) |
Merge pull request #78 from bdunahu/bdunahu
cleanup/fix existing vector extension
Diffstat (limited to 'tests/id.cc')
-rw-r--r-- | tests/id.cc | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/id.cc b/tests/id.cc index a81e967..b52ad9c 100644 --- a/tests/id.cc +++ b/tests/id.cc @@ -118,7 +118,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # two", "[id]") signed int t; InstrDTO *i; - t = this->encode_R_type(0b10000, 0b01000, 0b00100, 0b10, 0b0); + t = this->encode_R_type(0b1000, 0b01000, 0b00100, 0b10, 0b0); i = this->decode_bits(t); CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty @@ -129,6 +129,22 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # two", "[id]") delete i; } +TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # three", "[id]") +{ + signed int t; + InstrDTO *i; + + t = this->encode_R_type(0b10000, 0b10001, 0b10101, 0b1110, 0b0); + i = this->decode_bits(t); + + 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 == MULV); + + delete i; +} + TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # one", "[id]") { signed int t; @@ -150,7 +166,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # two", "[id]") signed int t; InstrDTO *i; - t = this->encode_I_type(0xCC, 0b101, 0b110, 0b1011, 0b1); + t = this->encode_I_type(0xCC, 0b10101, 0b00110, 0b11011, 0b1); i = this->decode_bits(t); CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty @@ -166,7 +182,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # one", "[id]") signed int t; InstrDTO *i; - t = this->encode_J_type(0x3456, 0b10101, 0b0111, 0b10); + t = this->encode_J_type(0x3456, 0b101, 0b0111, 0b10); i = this->decode_bits(t); CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty @@ -181,7 +197,7 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # two", "[id]") signed int t; InstrDTO *i; - t = this->encode_J_type(0xBBCCF, 0b10101, 0b0011, 0b10); + t = this->encode_J_type(0xBBCCF, 0b00101, 0b0011, 0b10); i = this->decode_bits(t); t = 0xFFFBBCCF; @@ -191,18 +207,3 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # two", "[id]") delete i; } - -TEST_CASE_METHOD(IDFixture, "read 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->read_guard(v); - REQUIRE(v == 0b0); -} |