Address nits

This commit is contained in:
merry 2022-02-14 21:48:10 +00:00
parent 4a257bf7a1
commit d86dcaa13d
7 changed files with 32 additions and 29 deletions

View file

@ -1,9 +1,11 @@
using ARMeilleure.State;
namespace ARMeilleure.Decoders namespace ARMeilleure.Decoders
{ {
class OpCodeT16AddSubSp : OpCodeT16, IOpCode32AluImm class OpCodeT16AddSubSp : OpCodeT16, IOpCode32AluImm
{ {
public int Rd => 13; public int Rd => RegisterAlias.Aarch32Sp;
public int Rn => 13; public int Rn => RegisterAlias.Aarch32Sp;
public bool? SetFlags => false; public bool? SetFlags => false;

View file

@ -1,4 +1,5 @@
using ARMeilleure.Instructions; using ARMeilleure.Instructions;
using System;
namespace ARMeilleure.Decoders namespace ARMeilleure.Decoders
{ {
@ -50,7 +51,7 @@ namespace ARMeilleure.Decoders
Immediate = ((opCode >> 6) & 0x1f) << 1; Immediate = ((opCode >> 6) & 0x1f) << 1;
break; break;
default: default:
throw new System.InvalidOperationException(); throw new InvalidOperationException();
} }
} }
} }

View file

@ -1,9 +1,11 @@
namespace ARMeilleure.Decoders using ARMeilleure.State;
namespace ARMeilleure.Decoders
{ {
class OpCodeT16MemLit : OpCodeT16, IOpCode32Mem class OpCodeT16MemLit : OpCodeT16, IOpCode32Mem
{ {
public int Rt { get; } public int Rt { get; }
public int Rn => 15; public int Rn => RegisterAlias.Aarch32Pc;
public bool WBack => false; public bool WBack => false;
public bool IsLoad => true; public bool IsLoad => true;
@ -13,6 +15,7 @@
public int Immediate { get; } public int Immediate { get; }
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT16MemLit(inst, address, opCode); public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT16MemLit(inst, address, opCode);
public OpCodeT16MemLit(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode) public OpCodeT16MemLit(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
{ {
Rt = (opCode >> 8) & 7; Rt = (opCode >> 8) & 7;

View file

@ -16,26 +16,18 @@ namespace ARMeilleure.Decoders
public OpCodeT16MemMult(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode) public OpCodeT16MemMult(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
{ {
RegisterMask = opCode & 0xff;
Rn = (opCode >> 8) & 7;
int regCount = BitOperations.PopCount((uint)RegisterMask); int regCount = BitOperations.PopCount((uint)RegisterMask);
switch (inst.Name) RegisterMask = opCode & 0xff;
Rn = (opCode >> 8) & 7;
Offset = 0;
PostOffset = 4 * regCount;
IsLoad = inst.Name switch
{ {
case InstName.Stm: InstName.Ldm => true,
IsLoad = false; InstName.Stm => false,
Offset = 0; _ => throw new InvalidOperationException()
PostOffset = 4 * regCount; };
break;
case InstName.Ldm:
IsLoad = true;
Offset = 0;
PostOffset = 4 * regCount;
break;
default:
throw new InvalidOperationException();
}
} }
} }
} }

View file

@ -1,9 +1,11 @@
namespace ARMeilleure.Decoders using ARMeilleure.State;
namespace ARMeilleure.Decoders
{ {
class OpCodeT16MemSp : OpCodeT16, IOpCode32Mem class OpCodeT16MemSp : OpCodeT16, IOpCode32Mem
{ {
public int Rt { get; } public int Rt { get; }
public int Rn => 13; public int Rn => RegisterAlias.Aarch32Sp;
public bool WBack => false; public bool WBack => false;
public bool IsLoad { get; } public bool IsLoad { get; }

View file

@ -1,4 +1,5 @@
using ARMeilleure.Instructions; using ARMeilleure.Instructions;
using ARMeilleure.State;
using System; using System;
using System.Numerics; using System.Numerics;
@ -6,7 +7,7 @@ namespace ARMeilleure.Decoders
{ {
class OpCodeT16MemStack : OpCodeT16, IOpCode32MemMult class OpCodeT16MemStack : OpCodeT16, IOpCode32MemMult
{ {
public int Rn => 13; public int Rn => RegisterAlias.Aarch32Sp;
public int RegisterMask { get; } public int RegisterMask { get; }
public int PostOffset { get; } public int PostOffset { get; }
public bool IsLoad { get; } public bool IsLoad { get; }

View file

@ -1,9 +1,11 @@
using ARMeilleure.State;
namespace ARMeilleure.Decoders namespace ARMeilleure.Decoders
{ {
class OpCodeT16SpRel : OpCodeT16, IOpCode32AluImm class OpCodeT16SpRel : OpCodeT16, IOpCode32AluImm
{ {
public int Rd { get; } public int Rd { get; }
public int Rn => 13; public int Rn => RegisterAlias.Aarch32Sp;
public bool? SetFlags => false; public bool? SetFlags => false;