|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Collections.Generic; |
|
19 using System.Text; |
|
20 using SymbianUtils.BasicTypes; |
|
21 using SymbianStructuresLib.Arm.Registers; |
|
22 using SymbianStructuresLib.Arm.Instructions; |
|
23 using SymbianInstructionLib.Arm.Instructions.Common; |
|
24 |
|
25 namespace SymbianInstructionLib.Arm.Instructions.Thumb.DataProcessing |
|
26 { |
|
27 [ArmRef( "A7.1.7 ADD (5)", "ADD <Rd>, PC, #<immed_8> * 4" )] |
|
28 [ArmRef( "A7.1.8 ADD (6)", "ADD <Rd>, SP, #<immed_8> * 4" )] |
|
29 public class Thumb_Add_SPOrPC : Thumb_AddOrSubtract |
|
30 { |
|
31 #region Constructors |
|
32 public Thumb_Add_SPOrPC() |
|
33 { |
|
34 // Type Rd immed_8 |
|
35 base.SetMask( "1010" + "#" + "###" + "########" ); |
|
36 } |
|
37 #endregion |
|
38 |
|
39 #region From ArmBaseInstruction |
|
40 protected override bool DoQueryInvolvementAsSource( TArmRegisterType aRegister ) |
|
41 { |
|
42 // SP or PC acts as source |
|
43 TArmRegisterType reg = this.RelativeRegister; |
|
44 return ( aRegister == reg ); |
|
45 } |
|
46 #endregion |
|
47 |
|
48 #region From Thumb_AddOrSubtract |
|
49 public override TArmRegisterType Rd |
|
50 { |
|
51 get |
|
52 { |
|
53 TArmRegisterType ret = (TArmRegisterType) KMaskRd.Apply( base.AIRawValue ); |
|
54 return ret; |
|
55 } |
|
56 } |
|
57 |
|
58 public TArmRegisterType RelativeRegister |
|
59 { |
|
60 get |
|
61 { |
|
62 SymBit bit11 = base.AIRawValue[ 11 ]; |
|
63 TArmRegisterType ret = TArmRegisterType.EArmReg_PC; |
|
64 if ( bit11 == SymBit.ESet ) |
|
65 { |
|
66 ret = TArmRegisterType.EArmReg_SP; |
|
67 } |
|
68 return ret; |
|
69 } |
|
70 } |
|
71 |
|
72 public override TArmDataProcessingType OperationType |
|
73 { |
|
74 get { return TArmDataProcessingType.ADD; } |
|
75 } |
|
76 |
|
77 public override uint Immediate |
|
78 { |
|
79 get |
|
80 { |
|
81 uint rawValue = ( base.AIRawValue & 0xFF ); |
|
82 uint ret = rawValue * 4; |
|
83 return ret; |
|
84 } |
|
85 } |
|
86 |
|
87 public override bool SuppliesImmediate |
|
88 { |
|
89 get { return true; } |
|
90 } |
|
91 #endregion |
|
92 |
|
93 #region Properties |
|
94 #endregion |
|
95 |
|
96 #region Internal methods |
|
97 #endregion |
|
98 |
|
99 #region Data members |
|
100 private static readonly SymMask KMaskRd = new SymMask( 0x700, SymMask.TShiftDirection.ERight, 8 ); |
|
101 #endregion |
|
102 } |
|
103 } |
|
104 |