tests/A64: Test small blocks

This commit is contained in:
MerryMage 2018-01-26 18:50:57 +00:00
parent 330e6111fa
commit ec0a91d6ee
2 changed files with 29 additions and 2 deletions

View file

@ -368,3 +368,28 @@ TEST_CASE("A64: Floating point instructions", "[a64]") {
RunTestInstance(regs, vecs, 100, instructions, pstate, fpcr); RunTestInstance(regs, vecs, 100, instructions, pstate, fpcr);
} }
} }
TEST_CASE("A64: Small random block", "[a64]") {
for (size_t iteration = 0; iteration < 100000; ++iteration) {
std::array<u64, 31> regs;
std::generate_n(regs.begin(), 31, []{ return RandInt<u64>(0, ~u64(0)); });
std::array<Vector, 32> vecs;
std::generate_n(vecs.begin(), 32, []{ return RandomVector(); });
std::vector<u32> instructions;
instructions.push_back(GenRandomInst(0, false));
instructions.push_back(GenRandomInst(4, false));
instructions.push_back(GenRandomInst(8, false));
instructions.push_back(GenRandomInst(12, false));
instructions.push_back(GenRandomInst(16, true));
u32 pstate = RandInt<u32>(0, 0xF) << 28;
u32 fpcr = RandInt<u32>(0, 0x3) << 22; // randomize RMode
INFO("Instruction 1: 0x" << std::hex << instructions[0]);
INFO("Instruction 2: 0x" << std::hex << instructions[1]);
INFO("Instruction 3: 0x" << std::hex << instructions[2]);
INFO("Instruction 4: 0x" << std::hex << instructions[3]);
INFO("Instruction 5: 0x" << std::hex << instructions[4]);
RunTestInstance(regs, vecs, 100, instructions, pstate, fpcr);
}
}

View file

@ -35,8 +35,10 @@ Unicorn::~Unicorn() {
} }
void Unicorn::Run() { void Unicorn::Run() {
CHECKED(uc_emu_start(uc, GetPC(), END_ADDRESS, 0, testenv.ticks_left)); while (testenv.ticks_left > 0) {
testenv.ticks_left = 0; CHECKED(uc_emu_start(uc, GetPC(), END_ADDRESS, 0, 1));
testenv.ticks_left--;
}
} }
u64 Unicorn::GetSP() const { u64 Unicorn::GetSP() const {