diff options
author | Karel Kočí <cynerd@email.cz> | 2017-11-21 23:54:04 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-11-21 23:54:04 +0100 |
commit | f5d4468b2a8afa28ddad0bad425f762725eb69a7 (patch) | |
tree | 618b54866130da61a65968775a5550960e8c954c /qtmips_machine/tests | |
parent | 054225612d13e9a32b7900e423590367b5969b6e (diff) | |
download | qtmips-f5d4468b2a8afa28ddad0bad425f762725eb69a7.tar.gz qtmips-f5d4468b2a8afa28ddad0bad425f762725eb69a7.tar.bz2 qtmips-f5d4468b2a8afa28ddad0bad425f762725eb69a7.zip |
Implement some logical operations
Diffstat (limited to 'qtmips_machine/tests')
-rw-r--r-- | qtmips_machine/tests/testcore.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/qtmips_machine/tests/testcore.cpp b/qtmips_machine/tests/testcore.cpp index 3a48f1d..43d4c90 100644 --- a/qtmips_machine/tests/testcore.cpp +++ b/qtmips_machine/tests/testcore.cpp @@ -88,7 +88,39 @@ void MachineTests::core_regs_data() { << regs_init \ << regs_res; } - // TODO test other operations + + // Logical instructions + { + Registers regs_init; + regs_init.write_gp(24, 0xf0); + regs_init.write_gp(25, 0xe1); + Registers regs_res(regs_init); + regs_res.write_gp(26, 0xe0); + QTest::newRow("AND") << Instruction(0, 24, 25, 26, 0, 36) \ + << regs_init \ + << regs_res; + QTest::newRow("ANDI") << Instruction(12, 24, 26, 0xe1) \ + << regs_init \ + << regs_res; + regs_res.write_gp(26, 0xf1); + QTest::newRow("OR") << Instruction(0, 24, 25, 26, 0, 37) \ + << regs_init \ + << regs_res; + QTest::newRow("ORI") << Instruction(13, 24, 26, 0xe1) \ + << regs_init \ + << regs_res; + regs_res.write_gp(26, 0x11); + QTest::newRow("XOR") << Instruction(0, 24, 25, 26, 0, 38) \ + << regs_init \ + << regs_res; + QTest::newRow("XORI") << Instruction(14, 24, 26, 0xe1) \ + << regs_init \ + << regs_res; + regs_res.write_gp(26, 0xffffff0e); + QTest::newRow("NOR") << Instruction(0, 24, 25, 26, 0, 39) \ + << regs_init \ + << regs_res; + } } #include <iostream> |