diff options
Diffstat (limited to 'tests')
-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); -} |