|
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.DataTransfer |
|
26 { |
|
27 [ArmRef( "A7.1.28 LDR (1)", "LDR <Rd>, [<Rn>, #<immed_5> * 4]" )] |
|
28 [ArmRef( "A7.1.58 STR (1)", "STR <Rd>, [<Rn>, #<immed_5> * 4]" )] |
|
29 public class Thumb_LoadOrStore_Immediate5 : Thumb_LoadOrStore |
|
30 { |
|
31 #region Constructors |
|
32 public Thumb_LoadOrStore_Immediate5() |
|
33 { |
|
34 // Type immed_5 Rn Rd |
|
35 base.SetMask( "0110" + "#" + "#####" + "###" + "###" ); |
|
36 } |
|
37 #endregion |
|
38 |
|
39 #region From ArmBaseInstruction |
|
40 protected override bool DoQueryInvolvementAsSource( TArmRegisterType aRegister ) |
|
41 { |
|
42 bool ret = false; |
|
43 // |
|
44 TArmDataTransferType type = this.DataTransferType; |
|
45 if ( type == TArmDataTransferType.EStore ) |
|
46 { |
|
47 // STR <Rd>, [<Rn>, #<immed_5> * 4] |
|
48 // Rd = dest, Rn is source register |
|
49 TArmRegisterType regN = this.Rn; |
|
50 ret = ( aRegister == regN ); |
|
51 } |
|
52 else if ( type == TArmDataTransferType.ELoad ) |
|
53 { |
|
54 // LDR <Rd>, [<Rn>, #<immed_5> * 4] |
|
55 // Rd = source, Rn is destination register |
|
56 TArmRegisterType regD = this.Rd; |
|
57 ret = ( aRegister == regD ); |
|
58 } |
|
59 // |
|
60 return ret; |
|
61 } |
|
62 |
|
63 protected override bool DoQueryInvolvementAsDestination( TArmRegisterType aRegister ) |
|
64 { |
|
65 bool ret = false; |
|
66 // |
|
67 TArmDataTransferType type = this.DataTransferType; |
|
68 if ( type == TArmDataTransferType.EStore ) |
|
69 { |
|
70 // STR <Rd>, [<Rn>, #<immed_5> * 4] |
|
71 // Rd = dest, Rn is source register |
|
72 TArmRegisterType regD = this.Rd; |
|
73 ret = ( aRegister == regD ); |
|
74 } |
|
75 else if ( type == TArmDataTransferType.ELoad ) |
|
76 { |
|
77 // LDR <Rd>, [<Rn>, #<immed_5> * 4] |
|
78 // Rd = source, Rn is destination register |
|
79 TArmRegisterType regN = this.Rn; |
|
80 ret = ( aRegister == regN ); |
|
81 } |
|
82 // |
|
83 return ret; |
|
84 } |
|
85 #endregion |
|
86 |
|
87 #region Framework API |
|
88 public override TArmDataTransferType DataTransferType |
|
89 { |
|
90 get |
|
91 { |
|
92 TArmDataTransferType ret = (TArmDataTransferType) base.AIRawValue[ 11 ]; |
|
93 return ret; |
|
94 } |
|
95 } |
|
96 |
|
97 public override TArmRegisterType Rd |
|
98 { |
|
99 get |
|
100 { |
|
101 TArmRegisterType ret = (TArmRegisterType) Thumb_LoadOrStore.KBits2To0.Apply( base.AIRawValue ); |
|
102 return ret; |
|
103 } |
|
104 } |
|
105 |
|
106 public TArmRegisterType Rn |
|
107 { |
|
108 get |
|
109 { |
|
110 TArmRegisterType ret = (TArmRegisterType) Thumb_LoadOrStore.KBits5To3.Apply( base.AIRawValue ); |
|
111 return ret; |
|
112 } |
|
113 } |
|
114 #endregion |
|
115 |
|
116 #region Properties |
|
117 public uint Immediate |
|
118 { |
|
119 get |
|
120 { |
|
121 uint ret = KMaskImmediate5.Apply( base.AIRawValue ); |
|
122 ret *= 4; |
|
123 return ret; |
|
124 } |
|
125 } |
|
126 #endregion |
|
127 |
|
128 #region Internal methods |
|
129 #endregion |
|
130 |
|
131 #region Data members |
|
132 private static readonly SymMask KMaskImmediate5 = new SymMask( 0x7C0, SymMask.TShiftDirection.ERight, 6 ); |
|
133 #endregion |
|
134 } |
|
135 } |
|
136 |