aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Tests/Cpu/CpuTest32.cs
diff options
context:
space:
mode:
authormerry <git@mary.rs>2022-04-21 00:25:43 +0100
committerGitHub <noreply@github.com>2022-04-21 01:25:43 +0200
commit6a1a03566aa04d6e3e32547821aae0bc587d1128 (patch)
treec5a14a833469753ef102fc4446e1c7c95628bc63 /Ryujinx.Tests/Cpu/CpuTest32.cs
parent13f5294aa3b8b179255fee1d49111896d5510800 (diff)
T32: Implement load/store single (immediate) (#3186)1.1.106
* T32: Implement load/store single (immediate) * tests * tidy formatting * address comments
Diffstat (limited to 'Ryujinx.Tests/Cpu/CpuTest32.cs')
-rw-r--r--Ryujinx.Tests/Cpu/CpuTest32.cs31
1 files changed, 30 insertions, 1 deletions
diff --git a/Ryujinx.Tests/Cpu/CpuTest32.cs b/Ryujinx.Tests/Cpu/CpuTest32.cs
index 1ffea0b6..2176e5ad 100644
--- a/Ryujinx.Tests/Cpu/CpuTest32.cs
+++ b/Ryujinx.Tests/Cpu/CpuTest32.cs
@@ -286,6 +286,35 @@ namespace Ryujinx.Tests.Cpu
Assert.That(GetContext().Pstate, Is.EqualTo(finalCpsr));
}
+ public void RunPrecomputedTestCase(PrecomputedMemoryThumbTestCase test)
+ {
+ byte[] testMem = new byte[Size];
+
+ for (ulong i = 0; i < Size; i += 2)
+ {
+ testMem[i + 0] = (byte)((i + DataBaseAddress) >> 0);
+ testMem[i + 1] = (byte)((i + DataBaseAddress) >> 8);
+ }
+
+ SetWorkingMemory(0, testMem);
+
+ RunPrecomputedTestCase(new PrecomputedThumbTestCase(){
+ Instructions = test.Instructions,
+ StartRegs = test.StartRegs,
+ FinalRegs = test.FinalRegs,
+ });
+
+ foreach (var delta in test.MemoryDelta)
+ {
+ testMem[delta.Address - DataBaseAddress + 0] = (byte)(delta.Value >> 0);
+ testMem[delta.Address - DataBaseAddress + 1] = (byte)(delta.Value >> 8);
+ }
+
+ byte[] mem = _memory.GetSpan(DataBaseAddress, (int)Size).ToArray();
+
+ Assert.That(mem, Is.EqualTo(testMem), "testmem");
+ }
+
protected void SetWorkingMemory(uint offset, byte[] data)
{
_memory.Write(DataBaseAddress + offset, data);
@@ -641,4 +670,4 @@ namespace Ryujinx.Tests.Cpu
_context.SetFPstateFlag(FPState.VFlag, (fpscr & (1u << (int)FPState.VFlag)) != 0);
}
}
-}
+} \ No newline at end of file