dolphin/Source/UnitTests/AudioJitTests.cpp
j4ck.fr0st ab76cbf2fc set eol-style native
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5307 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-04-09 19:28:18 +00:00

84 lines
2.1 KiB
C++

#include "DSPJitTester.h"
void nx_dr()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x04);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void nx_ir()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x08);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void nx_nr()
{
SDSP test_dsp;
DSPJitTester tester(0x40, 0x0c);
for (u16 input_reg = 0; input_reg < 50; input_reg++)
for (u16 input_wr0 = 0; input_wr0 < 10; input_wr0++)
{
memset(&test_dsp, 0, sizeof(SDSP));
test_dsp.r[DSP_REG_WR0] = input_wr0;
test_dsp.r[0] = input_reg;
if (!tester.Test(test_dsp))
{
printf("%s Test failed: in = 0x%04x, wr0 = 0x%04x > int = 0x%04x, jit = 0x%04x\n",
tester.GetInstructionName(),
input_reg, input_wr0,
tester.GetLastInterpreterDSP().r[0], tester.GetLastJitDSP().r[0]);
}
}
tester.Report();
}
void AudioJitTests()
{
DSPJitTester::Initialize();
nx_ir();
nx_dr();
//nx_nr();
}
//required to be able to link against DSPCore
void DSPHost_UpdateDebugger() { }
unsigned int DSPHost_CodeLoaded(unsigned const char*, int) { return 0; }
void DSPHost_InterruptRequest() { }
bool DSPHost_OnThread() { return false; }
void DSPHost_WriteHostMemory(unsigned char, unsigned int) { }
unsigned char DSPHost_ReadHostMemory(unsigned int) { return 0; }