aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/tests
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_machine/tests')
-rw-r--r--qtmips_machine/tests/testalu.cpp14
-rw-r--r--qtmips_machine/tests/testcore.cpp16
2 files changed, 30 insertions, 0 deletions
diff --git a/qtmips_machine/tests/testalu.cpp b/qtmips_machine/tests/testalu.cpp
index b45a317..603a610 100644
--- a/qtmips_machine/tests/testalu.cpp
+++ b/qtmips_machine/tests/testalu.cpp
@@ -12,6 +12,20 @@ void MachineTests::alu_data() {
QTest::addColumn<std::uint32_t>("res");
// TODO SLL-SRAV
+ QTest::newRow("MOVZ") << ALU_OP_MOVZ \
+ << (std::uint32_t)22 \
+ << (std::uint32_t)0 \
+ << (std::uint8_t)0 \
+ << Registers() \
+ << Registers() \
+ << (std::uint32_t)22;
+ QTest::newRow("MOVN") << ALU_OP_MOVN \
+ << (std::uint32_t)22 \
+ << (std::uint32_t)1 \
+ << (std::uint8_t)0 \
+ << Registers() \
+ << Registers() \
+ << (std::uint32_t)22;
{
Registers init;
init.write_hi_lo(true, 42);
diff --git a/qtmips_machine/tests/testcore.cpp b/qtmips_machine/tests/testcore.cpp
index 835dd2c..27a49b4 100644
--- a/qtmips_machine/tests/testcore.cpp
+++ b/qtmips_machine/tests/testcore.cpp
@@ -127,6 +127,8 @@ static void core_regs_data() {
Registers regs_init;
regs_init.write_hi_lo(true, 24);
regs_init.write_hi_lo(false, 28);
+ regs_init.write_gp(24, 55);
+ regs_init.write_gp(25, 56);
regs_init.write_gp(27, 21);
regs_init.write_gp(28, 22);
Registers regs_res(regs_init);
@@ -148,6 +150,20 @@ static void core_regs_data() {
QTest::newRow("MTLO") << Instruction(0, 28, 0, 0, 0, 19) \
<< regs_init \
<< regs_res;
+ regs_res.write_hi_lo(false, 28);
+ QTest::newRow("MOVZ-F") << Instruction(0, 24, 24, 25, 0, 10) \
+ << regs_init \
+ << regs_res;
+ QTest::newRow("MOVN-F") << Instruction(0, 24, 1, 25, 0, 11) \
+ << regs_init \
+ << regs_res;
+ regs_res.write_gp(25, 55);
+ QTest::newRow("MOVZ-T") << Instruction(0, 24, 1, 25, 0, 10) \
+ << regs_init \
+ << regs_res;
+ QTest::newRow("MOVN-T") << Instruction(0, 24, 24, 25, 0, 11) \
+ << regs_init \
+ << regs_res;
}
}