Add Cmeq_S, Cmge_S, Cmgt_S, Cmhi_S, Cmhs_S, Cmle_S, Cmlt_S (Reg, Zero) & Cmtst_S compare instructions. Add 22 compare tests (Scalar, Vector). Add Eor_V, Not_V tests. (#171)
* Add files via upload * Add files via upload * Delete CpuTestScalar.cs * Update CpuTestSimdArithmetic.cs
This commit is contained in:
parent
35e695552e
commit
3bdd109f45
20 changed files with 2624 additions and 338 deletions
|
@ -1,6 +1,8 @@
|
|||
// https://github.com/LDj3SNuD/ARM_v8-A_AArch64_Instructions_Tester/blob/master/Tester/Pseudocode.cs
|
||||
|
||||
// https://meriac.github.io/archex/A64_v83A_ISA/shared_pseudocode.xml
|
||||
// https://developer.arm.com/products/architecture/a-profile/exploration-tools
|
||||
// ..\A64_v83A_ISA_xml_00bet6.1\ISA_v83A_A64_xml_00bet6.1_OPT\xhtml\
|
||||
|
||||
// https://alastairreid.github.io/asl-lexical-syntax/
|
||||
|
||||
// | ------------------------|----------------------------------- |
|
||||
|
@ -31,7 +33,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
internal static class AArch64
|
||||
{
|
||||
#region "exceptions/exceptions/"
|
||||
/* #AArch64.ResetControlRegisters.1 */
|
||||
/* shared_pseudocode.html#AArch64.ResetControlRegisters.1 */
|
||||
public static void ResetControlRegisters(bool cold_reset)
|
||||
{
|
||||
PSTATE.N = cold_reset;
|
||||
|
@ -76,7 +78,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
#endregion
|
||||
|
||||
#region "functions/registers/"
|
||||
/* #AArch64.ResetGeneralRegisters.0 */
|
||||
/* shared_pseudocode.html#AArch64.ResetGeneralRegisters.0 */
|
||||
public static void ResetGeneralRegisters()
|
||||
{
|
||||
for (int i = 0; i <= 30; i++)
|
||||
|
@ -86,7 +88,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #AArch64.ResetSIMDFPRegisters.0 */
|
||||
/* shared_pseudocode.html#AArch64.ResetSIMDFPRegisters.0 */
|
||||
public static void ResetSIMDFPRegisters()
|
||||
{
|
||||
for (int i = 0; i <= 31; i++)
|
||||
|
@ -96,7 +98,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #AArch64.ResetSpecialRegisters.0 */
|
||||
/* shared_pseudocode.html#AArch64.ResetSpecialRegisters.0 */
|
||||
public static void ResetSpecialRegisters()
|
||||
{
|
||||
// AArch64 special registers
|
||||
|
@ -105,10 +107,10 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
/* SP_EL1 = bits(64) UNKNOWN; */
|
||||
SP_EL1.SetAll(false);
|
||||
|
||||
FPSR.SetAll(false); // FIXME: Temporary solution.
|
||||
FPSR.SetAll(false); // TODO: Add named fields.
|
||||
}
|
||||
|
||||
// #impl-aarch64.SP.write.0
|
||||
// shared_pseudocode.html#impl-aarch64.SP.write.0
|
||||
public static void SP(Bits value)
|
||||
{
|
||||
/* int width = value.Count; */
|
||||
|
@ -140,7 +142,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
// #impl-aarch64.SP.read.0
|
||||
// shared_pseudocode.html#impl-aarch64.SP.read.0
|
||||
public static Bits SP(int width)
|
||||
{
|
||||
/* assert width IN {8,16,32,64}; */
|
||||
|
@ -166,7 +168,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
// #impl-aarch64.V.write.1
|
||||
// shared_pseudocode.html#impl-aarch64.V.write.1
|
||||
public static void V(int n, Bits value)
|
||||
{
|
||||
/* int width = value.Count; */
|
||||
|
@ -177,7 +179,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
_V[n] = ZeroExtend(128, value);
|
||||
}
|
||||
|
||||
/* #impl-aarch64.V.read.1 */
|
||||
/* shared_pseudocode.html#impl-aarch64.V.read.1 */
|
||||
public static Bits V(int width, int n)
|
||||
{
|
||||
/* assert n >= 0 && n <= 31; */
|
||||
|
@ -186,7 +188,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return _V[n][width - 1, 0];
|
||||
}
|
||||
|
||||
/* #impl-aarch64.Vpart.read.2 */
|
||||
/* shared_pseudocode.html#impl-aarch64.Vpart.read.2 */
|
||||
public static Bits Vpart(int width, int n, int part)
|
||||
{
|
||||
/* assert n >= 0 && n <= 31; */
|
||||
|
@ -204,7 +206,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
// #impl-aarch64.Vpart.write.2
|
||||
// shared_pseudocode.html#impl-aarch64.Vpart.write.2
|
||||
public static void Vpart(int n, int part, Bits value)
|
||||
{
|
||||
int width = value.Count;
|
||||
|
@ -224,7 +226,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
// #impl-aarch64.X.write.1
|
||||
// shared_pseudocode.html#impl-aarch64.X.write.1
|
||||
public static void X(int n, Bits value)
|
||||
{
|
||||
/* int width = value.Count; */
|
||||
|
@ -238,7 +240,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #impl-aarch64.X.read.1 */
|
||||
/* shared_pseudocode.html#impl-aarch64.X.read.1 */
|
||||
public static Bits X(int width, int n)
|
||||
{
|
||||
/* assert n >= 0 && n <= 31; */
|
||||
|
@ -256,12 +258,12 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
#endregion
|
||||
|
||||
#region "instrs/countop/"
|
||||
// #CountOp
|
||||
// shared_pseudocode.html#CountOp
|
||||
public enum CountOp {CountOp_CLZ, CountOp_CLS, CountOp_CNT};
|
||||
#endregion
|
||||
|
||||
#region "instrs/extendreg/"
|
||||
/* #impl-aarch64.DecodeRegExtend.1 */
|
||||
/* shared_pseudocode.html#impl-aarch64.DecodeRegExtend.1 */
|
||||
public static ExtendType DecodeRegExtend(Bits op)
|
||||
{
|
||||
switch (op)
|
||||
|
@ -286,7 +288,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #impl-aarch64.ExtendReg.3 */
|
||||
/* shared_pseudocode.html#impl-aarch64.ExtendReg.3 */
|
||||
public static Bits ExtendReg(int N, int reg, ExtendType type, int shift)
|
||||
{
|
||||
/* assert shift >= 0 && shift <= 4; */
|
||||
|
@ -335,13 +337,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return Extend(Bits.Concat(val[len - 1, 0], Zeros(shift)), N, unsigned);
|
||||
}
|
||||
|
||||
// #ExtendType
|
||||
// shared_pseudocode.html#ExtendType
|
||||
public enum ExtendType {ExtendType_SXTB, ExtendType_SXTH, ExtendType_SXTW, ExtendType_SXTX,
|
||||
ExtendType_UXTB, ExtendType_UXTH, ExtendType_UXTW, ExtendType_UXTX};
|
||||
#endregion
|
||||
|
||||
#region "instrs/integer/bitmasks/"
|
||||
/* #impl-aarch64.DecodeBitMasks.4 */
|
||||
/* shared_pseudocode.html#impl-aarch64.DecodeBitMasks.4 */
|
||||
public static (Bits, Bits) DecodeBitMasks(int M, bool immN, Bits imms, Bits immr, bool immediate)
|
||||
{
|
||||
Bits tmask, wmask;
|
||||
|
@ -404,7 +406,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
#endregion
|
||||
|
||||
#region "instrs/integer/shiftreg/"
|
||||
/* #impl-aarch64.DecodeShift.1 */
|
||||
/* shared_pseudocode.html#impl-aarch64.DecodeShift.1 */
|
||||
public static ShiftType DecodeShift(Bits op)
|
||||
{
|
||||
switch (op)
|
||||
|
@ -421,7 +423,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #impl-aarch64.ShiftReg.3 */
|
||||
/* shared_pseudocode.html#impl-aarch64.ShiftReg.3 */
|
||||
public static Bits ShiftReg(int N, int reg, ShiftType type, int amount)
|
||||
{
|
||||
Bits result = X(N, reg);
|
||||
|
@ -446,10 +448,15 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #ShiftType
|
||||
// shared_pseudocode.html#ShiftType
|
||||
public enum ShiftType {ShiftType_LSL, ShiftType_LSR, ShiftType_ASR, ShiftType_ROR};
|
||||
#endregion
|
||||
|
||||
#region "instrs/vector/arithmetic/unary/cmp/compareop/"
|
||||
// shared_pseudocode.html#CompareOp
|
||||
public enum CompareOp {CompareOp_GT, CompareOp_GE, CompareOp_EQ, CompareOp_LE, CompareOp_LT};
|
||||
#endregion
|
||||
|
||||
#region "instrs/vector/reduce/reduceop/"
|
||||
public static Bits Reduce(ReduceOp op, Bits input, int esize)
|
||||
{
|
||||
|
@ -495,6 +502,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// shared_pseudocode.html#ReduceOp
|
||||
public enum ReduceOp {ReduceOp_FMINNUM, ReduceOp_FMAXNUM,
|
||||
ReduceOp_FMIN, ReduceOp_FMAX,
|
||||
ReduceOp_FADD, ReduceOp_ADD};
|
||||
|
@ -520,7 +528,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
SP_EL0 = new Bits(64, false);
|
||||
SP_EL1 = new Bits(64, false);
|
||||
|
||||
FPSR = new Bits(32, false); // FIXME: Temporary solution.
|
||||
FPSR = new Bits(32, false); // TODO: Add named fields.
|
||||
|
||||
PSTATE.N = false;
|
||||
PSTATE.Z = false;
|
||||
|
@ -537,7 +545,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return x.And(y);
|
||||
}
|
||||
|
||||
// #impl-shared.ASR.2
|
||||
// shared_pseudocode.html#impl-shared.ASR.2
|
||||
public static Bits ASR(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -558,7 +566,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.ASR_C.2
|
||||
// shared_pseudocode.html#impl-shared.ASR_C.2
|
||||
public static (Bits, bool) ASR_C(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -572,13 +580,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (result, carry_out);
|
||||
}
|
||||
|
||||
// #impl-shared.Abs.1
|
||||
// shared_pseudocode.html#impl-shared.Abs.1
|
||||
public static BigInteger Abs(BigInteger x)
|
||||
{
|
||||
return (x >= 0 ? x : -x);
|
||||
}
|
||||
|
||||
// #impl-shared.CountLeadingSignBits.1
|
||||
// shared_pseudocode.html#impl-shared.CountLeadingSignBits.1
|
||||
public static int CountLeadingSignBits(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -586,7 +594,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return CountLeadingZeroBits(EOR(x[N - 1, 1], x[N - 2, 0]));
|
||||
}
|
||||
|
||||
// #impl-shared.CountLeadingZeroBits.1
|
||||
// shared_pseudocode.html#impl-shared.CountLeadingZeroBits.1
|
||||
public static int CountLeadingZeroBits(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -594,7 +602,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (N - 1 - HighestSetBit(x));
|
||||
}
|
||||
|
||||
// #impl-shared.Elem.read.3
|
||||
// shared_pseudocode.html#impl-shared.Elem.read.3
|
||||
public static Bits Elem(/*in */Bits vector, int e, int size)
|
||||
{
|
||||
/* int N = vector.Count; */
|
||||
|
@ -604,7 +612,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return vector[e * size + size - 1, e * size];
|
||||
}
|
||||
|
||||
// #impl-shared.Elem.write.3
|
||||
// shared_pseudocode.html#impl-shared.Elem.write.3
|
||||
public static void Elem(/*out */Bits vector, int e, int size, Bits value)
|
||||
{
|
||||
/* int N = vector.Count; */
|
||||
|
@ -620,7 +628,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return x.Xor(y);
|
||||
}
|
||||
|
||||
// #impl-shared.Extend.3
|
||||
// shared_pseudocode.html#impl-shared.Extend.3
|
||||
public static Bits Extend(Bits x, int N, bool unsigned)
|
||||
{
|
||||
if (unsigned)
|
||||
|
@ -633,13 +641,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #impl-shared.Extend.2 */
|
||||
/* shared_pseudocode.html#impl-shared.Extend.2 */
|
||||
public static Bits Extend(int N, Bits x, bool unsigned)
|
||||
{
|
||||
return Extend(x, N, unsigned);
|
||||
}
|
||||
|
||||
// #impl-shared.HighestSetBit.1
|
||||
// shared_pseudocode.html#impl-shared.HighestSetBit.1
|
||||
public static int HighestSetBit(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -655,13 +663,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return -1;
|
||||
}
|
||||
|
||||
// #impl-shared.Int.2
|
||||
// shared_pseudocode.html#impl-shared.Int.2
|
||||
public static BigInteger Int(Bits x, bool unsigned)
|
||||
{
|
||||
return (unsigned ? UInt(x) : SInt(x));
|
||||
}
|
||||
|
||||
// #impl-shared.IsOnes.1
|
||||
// shared_pseudocode.html#impl-shared.IsOnes.1
|
||||
public static bool IsOnes(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -669,7 +677,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (x == Ones(N));
|
||||
}
|
||||
|
||||
// #impl-shared.IsZero.1
|
||||
// shared_pseudocode.html#impl-shared.IsZero.1
|
||||
public static bool IsZero(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -677,13 +685,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (x == Zeros(N));
|
||||
}
|
||||
|
||||
// #impl-shared.IsZeroBit.1
|
||||
// shared_pseudocode.html#impl-shared.IsZeroBit.1
|
||||
public static bool IsZeroBit(Bits x)
|
||||
{
|
||||
return IsZero(x);
|
||||
}
|
||||
|
||||
// #impl-shared.LSL.2
|
||||
// shared_pseudocode.html#impl-shared.LSL.2
|
||||
public static Bits LSL(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -704,7 +712,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.LSL_C.2
|
||||
// shared_pseudocode.html#impl-shared.LSL_C.2
|
||||
public static (Bits, bool) LSL_C(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -718,7 +726,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (result, carry_out);
|
||||
}
|
||||
|
||||
// #impl-shared.LSR.2
|
||||
// shared_pseudocode.html#impl-shared.LSR.2
|
||||
public static Bits LSR(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -739,7 +747,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.LSR_C.2
|
||||
// shared_pseudocode.html#impl-shared.LSR_C.2
|
||||
public static (Bits, bool) LSR_C(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -753,7 +761,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (result, carry_out);
|
||||
}
|
||||
|
||||
// #impl-shared.Min.2
|
||||
// shared_pseudocode.html#impl-shared.Min.2
|
||||
public static int Min(int a, int b)
|
||||
{
|
||||
if (a <= b)
|
||||
|
@ -766,13 +774,14 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #impl-shared.NOT.1 */
|
||||
/* shared_pseudocode.html#impl-shared.NOT.1 */
|
||||
public static Bits NOT(Bits x)
|
||||
{
|
||||
return x.Not();
|
||||
}
|
||||
|
||||
// #impl-shared.Ones.1
|
||||
// shared_pseudocode.html#impl-shared.Ones.1
|
||||
/* shared_pseudocode.html#impl-shared.Ones.0 */
|
||||
public static Bits Ones(int N)
|
||||
{
|
||||
return Replicate(true, N);
|
||||
|
@ -790,7 +799,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (decimal)value;
|
||||
}
|
||||
|
||||
// #impl-shared.ROR.2
|
||||
// shared_pseudocode.html#impl-shared.ROR.2
|
||||
public static Bits ROR(Bits x, int shift)
|
||||
{
|
||||
/* assert shift >= 0; */
|
||||
|
@ -809,7 +818,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.ROR_C.2
|
||||
// shared_pseudocode.html#impl-shared.ROR_C.2
|
||||
public static (Bits, bool) ROR_C(Bits x, int shift)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -823,7 +832,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (result, carry_out);
|
||||
}
|
||||
|
||||
/* #impl-shared.Replicate.1 */
|
||||
/* shared_pseudocode.html#impl-shared.Replicate.1 */
|
||||
public static Bits Replicate(int N, Bits x)
|
||||
{
|
||||
int M = x.Count;
|
||||
|
@ -833,7 +842,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return Replicate(x, N / M);
|
||||
}
|
||||
|
||||
/* #impl-shared.Replicate.2 */
|
||||
/* shared_pseudocode.html#impl-shared.Replicate.2 */
|
||||
public static Bits Replicate(Bits x, int N)
|
||||
{
|
||||
int M = x.Count;
|
||||
|
@ -848,13 +857,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return new Bits(dst);
|
||||
}
|
||||
|
||||
/* #impl-shared.RoundDown.1 */
|
||||
/* shared_pseudocode.html#impl-shared.RoundDown.1 */
|
||||
public static BigInteger RoundDown(decimal x)
|
||||
{
|
||||
return (BigInteger)Decimal.Floor(x);
|
||||
}
|
||||
|
||||
// #impl-shared.RoundTowardsZero.1
|
||||
// shared_pseudocode.html#impl-shared.RoundTowardsZero.1
|
||||
public static BigInteger RoundTowardsZero(decimal x)
|
||||
{
|
||||
if (x == 0.0m)
|
||||
|
@ -871,13 +880,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
}
|
||||
}
|
||||
|
||||
/* #impl-shared.RoundUp.1 */
|
||||
/* shared_pseudocode.html#impl-shared.RoundUp.1 */
|
||||
public static BigInteger RoundUp(decimal x)
|
||||
{
|
||||
return (BigInteger)Decimal.Ceiling(x);
|
||||
}
|
||||
|
||||
// #impl-shared.SInt.1
|
||||
// shared_pseudocode.html#impl-shared.SInt.1
|
||||
public static BigInteger SInt(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -900,7 +909,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.SignExtend.2
|
||||
// shared_pseudocode.html#impl-shared.SignExtend.2
|
||||
public static Bits SignExtend(Bits x, int N)
|
||||
{
|
||||
int M = x.Count;
|
||||
|
@ -910,13 +919,13 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return Bits.Concat(Replicate(x[M - 1], N - M), x);
|
||||
}
|
||||
|
||||
/* #impl-shared.SignExtend.1 */
|
||||
/* shared_pseudocode.html#impl-shared.SignExtend.1 */
|
||||
public static Bits SignExtend(int N, Bits x)
|
||||
{
|
||||
return SignExtend(x, N);
|
||||
}
|
||||
|
||||
// #impl-shared.UInt.1
|
||||
// shared_pseudocode.html#impl-shared.UInt.1
|
||||
public static BigInteger UInt(Bits x)
|
||||
{
|
||||
int N = x.Count;
|
||||
|
@ -934,7 +943,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.ZeroExtend.2
|
||||
// shared_pseudocode.html#impl-shared.ZeroExtend.2
|
||||
public static Bits ZeroExtend(Bits x, int N)
|
||||
{
|
||||
int M = x.Count;
|
||||
|
@ -944,14 +953,14 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return Bits.Concat(Zeros(N - M), x);
|
||||
}
|
||||
|
||||
/* #impl-shared.ZeroExtend.1 */
|
||||
/* shared_pseudocode.html#impl-shared.ZeroExtend.1 */
|
||||
public static Bits ZeroExtend(int N, Bits x)
|
||||
{
|
||||
return ZeroExtend(x, N);
|
||||
}
|
||||
|
||||
// #impl-shared.Zeros.1
|
||||
/* #impl-shared.Zeros.0 */
|
||||
// shared_pseudocode.html#impl-shared.Zeros.1
|
||||
/* shared_pseudocode.html#impl-shared.Zeros.0 */
|
||||
public static Bits Zeros(int N)
|
||||
{
|
||||
return Replicate(false, N);
|
||||
|
@ -959,7 +968,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
#endregion
|
||||
|
||||
#region "functions/crc/"
|
||||
// #impl-shared.BitReverse.1
|
||||
// shared_pseudocode.html#impl-shared.BitReverse.1
|
||||
public static Bits BitReverse(Bits data)
|
||||
{
|
||||
int N = data.Count;
|
||||
|
@ -974,7 +983,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #impl-shared.Poly32Mod2.2
|
||||
// shared_pseudocode.html#impl-shared.Poly32Mod2.2
|
||||
public static Bits Poly32Mod2(Bits _data, Bits poly)
|
||||
{
|
||||
int N = _data.Count;
|
||||
|
@ -996,7 +1005,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
#endregion
|
||||
|
||||
#region "functions/integer/"
|
||||
/* #impl-shared.AddWithCarry.3 */
|
||||
/* shared_pseudocode.html#impl-shared.AddWithCarry.3 */
|
||||
public static (Bits, Bits) AddWithCarry(int N, Bits x, Bits y, bool carry_in)
|
||||
{
|
||||
BigInteger unsigned_sum = UInt(x) + UInt(y) + UInt(carry_in);
|
||||
|
@ -1021,11 +1030,11 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
public static Bits SP_EL0;
|
||||
public static Bits SP_EL1;
|
||||
|
||||
public static Bits FPSR; // FIXME: Temporary solution.
|
||||
public static Bits FPSR; // TODO: Add named fields.
|
||||
#endregion
|
||||
|
||||
#region "functions/system/"
|
||||
// #impl-shared.ConditionHolds.1
|
||||
// shared_pseudocode.html#impl-shared.ConditionHolds.1
|
||||
public static bool ConditionHolds(Bits cond)
|
||||
{
|
||||
bool result;
|
||||
|
@ -1070,16 +1079,16 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return result;
|
||||
}
|
||||
|
||||
// #EL3
|
||||
// shared_pseudocode.html#EL3
|
||||
public static readonly Bits EL3 = "11";
|
||||
// #EL2
|
||||
// shared_pseudocode.html#EL2
|
||||
public static readonly Bits EL2 = "10";
|
||||
// #EL1
|
||||
// shared_pseudocode.html#EL1
|
||||
public static readonly Bits EL1 = "01";
|
||||
// #EL0
|
||||
// shared_pseudocode.html#EL0
|
||||
public static readonly Bits EL0 = "00";
|
||||
|
||||
/* #impl-shared.HaveEL.1 */
|
||||
/* shared_pseudocode.html#impl-shared.HaveEL.1 */
|
||||
public static bool HaveEL(Bits el)
|
||||
{
|
||||
if (el == EL1 || el == EL0)
|
||||
|
@ -1093,7 +1102,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
|
||||
public static ProcState PSTATE;
|
||||
|
||||
/* #ProcState */
|
||||
/* shared_pseudocode.html#ProcState */
|
||||
internal struct ProcState
|
||||
{
|
||||
public void NZCV(Bits nzcv) // ASL: ".<,,,>".
|
||||
|
@ -1122,7 +1131,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
#endregion
|
||||
|
||||
#region "functions/vector/"
|
||||
// #impl-shared.SatQ.3
|
||||
// shared_pseudocode.html#impl-shared.SatQ.3
|
||||
public static (Bits, bool) SatQ(BigInteger i, int N, bool unsigned)
|
||||
{
|
||||
(Bits result, bool sat) = (unsigned ? UnsignedSatQ(i, N) : SignedSatQ(i, N));
|
||||
|
@ -1130,7 +1139,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (result, sat);
|
||||
}
|
||||
|
||||
// #impl-shared.SignedSatQ.2
|
||||
// shared_pseudocode.html#impl-shared.SignedSatQ.2
|
||||
public static (Bits, bool) SignedSatQ(BigInteger i, int N)
|
||||
{
|
||||
BigInteger result;
|
||||
|
@ -1155,7 +1164,7 @@ namespace Ryujinx.Tests.Cpu.Tester
|
|||
return (result.SubBigInteger(N - 1, 0), saturated);
|
||||
}
|
||||
|
||||
// #impl-shared.UnsignedSatQ.2
|
||||
// shared_pseudocode.html#impl-shared.UnsignedSatQ.2
|
||||
public static (Bits, bool) UnsignedSatQ(BigInteger i, int N)
|
||||
{
|
||||
BigInteger result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue