41 lines
726 B
C++
41 lines
726 B
C++
#include <foot-emulator.h>
|
|
|
|
#include <iostream>
|
|
|
|
inline foot::Emulator run_instruction(uint32_t instruction)
|
|
{
|
|
foot::Emulator emu;
|
|
emu.memory_at(0) = instruction;
|
|
|
|
emu.run_instruction();
|
|
|
|
return emu;
|
|
}
|
|
|
|
inline foot::Emulator run_instructions(const std::vector<uint32_t>& instructions)
|
|
{
|
|
foot::Emulator emu;
|
|
for (int i = 0; i < instructions.size(); i++)
|
|
{
|
|
emu.memory_at(i) = instructions[i];
|
|
}
|
|
|
|
for (int i = 0; i < instructions.size(); i++)
|
|
{
|
|
emu.run_instruction();
|
|
}
|
|
|
|
return emu;
|
|
}
|
|
|
|
inline bool check(uint32_t expected, uint32_t actual)
|
|
{
|
|
if (actual != expected)
|
|
{
|
|
std::cout << std::hex << "Expected " << expected << ", got " << actual << ".\n";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|