From WikiChip
Difference between revisions of "arm/armv1"
< arm

 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{arm title|ARMv1}}
+
{{arm title|ARMv1}}{{arm isa main}}
'''ARMv1''' is the first [[ARM]] instruction set version. Introduced with the {{armh|ARM1}} on April 26 1985, the ARMv1 defines a {{arch|32}} ISA along with {{arm|26-bit|26-bit addressing space}}.
+
'''ARMv1''' is the first [[ARM]] instruction set version. Introduced with the {{acorn|ARM1}} on April 26 1985, the ARMv1 defines a {{arch|32}} ISA along with {{arm|26-bit|26-bit addressing space}}. The ARMv1 was only implemented by the {{acorn|ARM1}} and was replaced soon after by the {{acorn|ARM2}}. Only a few hundred of those chips were ever fabricated.
 +
 
 +
== Overview ==
 +
The ARMv1 presents a simple instruction set architecture, albeit bigger and more complex than many of its [[RISC]] contemporaries, consisting of mostly simple operations along with a number of complex ones borrowed from early {{arch|8}} CISC microprocessors. Each instruction is 32-bit in size and operates on two 32-bit operands. There is a 24-bit [[program counter]] allowing for a 26-bit address space of up to 64 MiB of memory.
 +
 
 +
== Registers ==
 +
There are 16 [[general purpose registers|general purpose]] 32-bit registers. With the exception of {{arm|R15|register 15}} and 14, all registers are orthogonal with no specific designated purpose.
 +
 
 +
== Addressing Mode ==
 +
The ARMv1 has five addressing modes:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Mode !! Syntax !! Operation
 +
|-
 +
| PC Relative || Label || Effective_Address = PC ± Offset (12 bits)
 +
|-
 +
| Base Register Offset<br>With Post-Increment || [Rn], offset || Effective_Address = Rn<br>Rn = Rn ± offset
 +
|-
 +
| Base Register Offset<br>With Pre-Increment || [Rn, offset] || Effective_Address = Rn ± offset (12 bits)<br>Rn = Rn ± offset
 +
|-
 +
| Base Register Index<br>With Post-Increment || [Rn], Rm || Effective_Address = Rn<br>Rn = Rn ± Rm
 +
|-
 +
| Base Register Index<br>With Pre-Increment || [Rn, Rm] || Effective_Address = Rn ± Rm<br>Rn = Rn ± Rm
 +
|}
 +
 
 +
== Instruction Listing ==
 +
The ARMv1 ISA has 45 operations under 23 mnemonics. The ARMv1 is broken down into 8 classes of instruction:
 +
 
 +
* [[#movement_instructions|Movement Instructions]]
 +
* [[#load_instructions|Load Instructions]]
 +
* [[#store_instructions|Store Instructions]]
 +
* [[#arithmetic_instructions|Arithmetic Instructions]]
 +
* [[#logical_instructions|Logical Instructions]]
 +
* [[#comparison_instructions|Comparison Instructions]]
 +
* [[#branch_instructions|Branch Instructions]]
 +
* [[#miscellaneous_instructions|Miscellaneous Instructions]]
 +
 
 +
{{isa
 +
| title    = ARMv1 ISA
 +
| Syntax
 +
| Description
 +
| Action
 +
| cols = 5
 +
| listing  =
 +
 
 +
{{inst|cols=5|section=<span id="movement_instructions">'''Movement Instructions'''</span><br><small>Movement instructions move data between registers and operands.</small>}}
 +
{{inst|mn=MOV |col 1=MOV<cond>{S} Rd, #imm            |col 2=Move value immed    |col 3 = Rd = immed}}
 +
{{inst|mn=MOV |col 1=MOV<cond>{S} Rd, Rm, {, <shift>} |col 2=Move value          |col 3 = Rd = Shift(Rm) }}
 +
{{inst|mn=MVN |col 1=MVN<cond>{S} Rd, #imm            |col 2=Move NOT value immed |col 3 = Rd = {{l|not|immed}}}}
 +
{{inst|mn=MVN |col 1=MVN<cond>{S} Rd, Rm, {, <shift>} |col 2=Move NOT value      |col 3 = Rd = {{l|not|Shift(Rm) }}}}
 +
 
 +
{{inst|cols=5|section=<span id="load_instructions">'''Load Instructions'''</span><br><small>Load instructions move the content of memory addresses into registers.</small>}}
 +
{{inst|mn=LDM  |col 1=LDM<cond><type> Rn{!}, <reglist>{^} |col 2= Load multiple |col 3 = addr = Rn<br>for each Rd in {reglist}:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rd = [addr]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update address based on {type} }}
 +
{{inst|mn=LDR  |col 1=LDR<cond>{B} Rd, [Rn {, #imm}]{!}  |col 2=Load register immed |col 3 = Rd = [Rn + imm]<br>If !: Rn = Rn + imm}}
 +
{{inst|mn=LDR  |col 1=LDR<cond>{B} Rd,  [Rn, Rm {, <shift>}]{!}  |col 2=Load register    |col 3 = Rd = [Rn + Shift(Rm)]<br>If !: Rn = Rn + Shift(Rm)]}}
 +
{{inst|mn=LDR  |col 1=LDR<cond>{B}{T} Rd,  [Rn], #imm  |col 2=Load register, post index    |col 3 = Rd = [Rn]<br>Rn = Rn + imm}}
 +
{{inst|mn=LDR  |col 1=LDR<cond>{B}{T} Rd,  [Rn], Rm {, <shift>}  |col 2=Load register, post index    |col 3 = Rd = [Rn]<br>Rn = Rn + Shift(Rm) }}
 +
 
 +
{{inst|cols=5|section=<span id="store_instructions">'''Store Instructions'''</span><br><small>Store instructions moves the values from registers into memory.</small>}}
 +
{{inst|mn=STM  |col 1=STM<cond><type> Rn{!}, <reglist>{^} |col 2= Store multiple |col 3 = addr = Rn<br>for each Rd in {reglist}:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[addr] = Rd<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update address based on {type} }}
 +
{{inst|mn=STR  |col 1=STR<cond>{B} Rd, [Rn {, #imm}]{!}  |col 2=Store register immed |col 3 = [Rn + imm] = Rd<br>If !: Rn = Rn + imm}}
 +
{{inst|mn=STR  |col 1=STR<cond>{B} Rd,  [Rn, Rm {, <shift>}]{!}  |col 2=Store register    |col 3 = [Rn + Shift(Rm)] = Rd<br>If !: Rn = Rn + Shift(Rm)]}}
 +
{{inst|mn=STR  |col 1=STR<cond>{B}{T} Rd,  [Rn], #imm  |col 2=Store register, post index    |col 3 = [Rn] = Rd<br>Rn = Rn + imm}}
 +
{{inst|mn=STR  |col 1=STR<cond>{B}{T} Rd,  [Rn], Rm {, <shift>}  |col 2=Store register, post index    |col 3 = [Rn] = Rd<br>Rn = Rn + Shift(Rm) }}
 +
 
 +
{{inst|cols=5|section=<span id="arithmetic_instructions">'''Arithmetic Instructions'''</span><br><small>Arithmetic instructions perform basic mathematical operations on two operands.</small>}}
 +
{{inst|mn=ADC |col 1=ADC<cond>{S} Rd, Rn, #imm          |col 2=Add and carry immed              |col 3 =Rd = Rn + imm + C}}
 +
{{inst|mn=ADC |col 1=ADC<cond>{S} Rd, Rn, Rm{, <shift>}  |col 2=Add and carry                    |col 3 =Rd = Rn + Shift(Rm) + C}}
 +
{{inst|mn=ADD |col 1=ADD<cond>S Rd, Rn, #imm            |col 2=Add immed                        |col 3 =Rd = Rn + imm}}
 +
{{inst|mn=ADD |col 1=ADD<cond>S Rd, Rn, Rm{, <shift>}    |col 2=Add                              |col 3 =Rd = Rn + Shift(Rm) }}
 +
{{inst|mn=RSB |col 1=RSB<cond>S Rd, Rn, #imm            |col 2=Reverse subtract immed            |col 3 =Rd = imm - Rn}}
 +
{{inst|mn=RSB |col 1=RSB<cond>S Rd, Rn, Rm{, <shift>}    |col 2=Reverse subtract                  |col 3 =Rd = Shift(Rm) - Rn }}
 +
{{inst|mn=RSC |col 1=RSB<cond>S Rd, Rn, #imm            |col 2=Reverse subtract with carry immed |col 3 =Rd = imm - Rn - {{l|not|C}}}}
 +
{{inst|mn=RSC |col 1=RSB<cond>S Rd, Rn, Rm{, <shift>}    |col 2=Reverse subtract with carry      |col 3 =Rd = Shift(Rm) - Rn - {{l|not|C}}}}
 +
{{inst|mn=SBC |col 1=SBC<cond>{S} Rd, Rn, #imm          |col 2=Subtract with carry immed        |col 3 =Rd = Rn - imm - {{l|not|C}}}}
 +
{{inst|mn=SBC |col 1=SBC<cond>{S} Rd, Rn, Rm{, <shift>}  |col 2=Subtract with carry              |col 3 =Rd = Rn - Shift(Rm) - {{l|not|C}}}}
 +
{{inst|mn=SUB |col 1=SUB<cond>{S} Rd, Rn, #imm          |col 2=Subtract immed                    |col 3 =Rd = Rn - imm}}
 +
{{inst|mn=SUB |col 1=SUB<cond>{S} Rd, Rn, Rm{, <shift>}  |col 2=Subtract                          |col 3 =Rd = Rn - Shift(Rm) }}
 +
 
 +
{{inst|cols=5|section=<span id="logical_instructions">'''Logical Instructions'''</span><br><small>Logical instructions perform logical bitwise operations on operands.</small>}}
 +
{{inst|mn=AND |col 1=AND<cond>{S} Rd, Rn, #imm          |col 2=AND immed          |col 3 =Rd = {{l|land2|Rn|imm}}}}
 +
{{inst|mn=AND |col 1=AND<cond>{S} Rd, Rn, Rm{, <shift>} |col 2=AND                |col 3 =Rd = {{l|land2|Rn|Shift(Rm) }}}}
 +
{{inst|mn=BIC |col 1=BIC<cond>{S} Rd, Rn, #imm          |col 2=Bit clear immed    |col 3 =Rd = {{l|land2|Rn|{{l|not|imm}}}}}}
 +
{{inst|mn=BIC |col 1=BIC<cond>{S} Rd, Rn, Rm{, <shift>} |col 2=Bit clear          |col 3 =Rd = {{l|land2|Rn|{{l|not|Rm}}}}}}
 +
{{inst|mn=EOR |col 1=EOR<cond>{S} Rd, Rn, #imm          |col 2=Exclusive OR immed |col 3 =Rd = {{l|xor|Rn|imm}}}}
 +
{{inst|mn=EOR |col 1=EOR<cond>{S} Rd, Rn, Rm{, <shift>} |col 2=Exclusive OR      |col 3 =Rd = {{l|xor|Rn|Shift(Rm) }}}}
 +
{{inst|mn=ORR |col 1=ORR<cond>{S} Rd, Rn, #imm          |col 2=Logical OR immed  |col 3 =Rd = {{l|lor2|Rn|imm}}}}
 +
{{inst|mn=ORR |col 1=ORR<cond>{S} Rd, Rn, Rm{, <shift>} |col 2=Logical OR        |col 3 =Rd = {{l|lor2|Rn|Shift(Rm) }}}}
 +
 
 +
{{inst|cols=5|section=<span id="comparison_instructions">'''Comparison Instructions'''</span><br><small>Comparison instructions compare two values and set appropriate status flags.</small>}}
 +
{{inst|mn=CMN  |col 1=CMN<cond> Rn, #imm          |col 2=Compare negative immed |col 3 =CPSR flags set on (Rn + imm)}}
 +
{{inst|mn=CMN  |col 1=CMN<cond> Rn, Rm{, <shift>} |col 2=Compare negative      |col 3 =CPSR flags set on (Rn + Shift(Rm))}}
 +
{{inst|mn=CMP  |col 1=CMP<cond> Rn, #imm          |col 2=Compare immed          |col 3 =CPSR flags set on (Rn - imm)}}
 +
{{inst|mn=CMP  |col 1=CMP<cond> Rn, Rm{, <shift>} |col 2=Compare                |col 3 =CPSR flags set on (Rn - Shift(Rm))}}
 +
{{inst|mn=TEQ  |col 1=TEQ<cond> Rn, #imm          |col 2=Test equality immed    |col 3 =CPSR flags set on ({{l|xor|Rn|imm}})}}
 +
{{inst|mn=TEQ  |col 1=TEQ<cond> Rn, Rm{, <shift>} |col 2=Test equality          |col 3 =CPSR flags set on ({{l|xor|Rn|Shift(Rm) }})}}
 +
{{inst|mn=TST  |col 1=TST<cond> Rn, #imm          |col 2=Test bits immed        |col 3 =CPSR flags set on ({{l|land2|Rn|imm}})}}
 +
{{inst|mn=TST  |col 1=TST<cond> Rn, Rm{, <shift>} |col 2=Test bits              |col 3 =CPSR flags set on ({{l|land2|Rn|Shift(Rm) }})}}
 +
 
 +
{{inst|cols=5|section=<span id="branch_instructions">'''Branch Instructions'''</span><br><small>Branch instructions order instruction processing to start elsewhere conditionally or unconditionally.</small>}}
 +
{{inst|mn=B  |col 1=B<cond> imm  |col 2=Branch relative |col 3 =PC = PC + address}}
 +
{{inst|mn=BL |col 1=BL<cond> imm |col 2=Branch and link relative |col 3 =LR = RET<br>PC = PC + address}}
 +
 
 +
{{inst|cols=5|section=<span id="miscellaneous_instructions">'''Miscellaneous Instructions'''</span><br><small>Any instruction that doesn't belong anywhere else.</small>}}
 +
{{inst|mn=SWI |col 1=SWI<cond> imm |col 2=Software interrupt |col 3 =LR = RET<br>Execute SWI vector in supervisor mode}}
 +
}}
 +
 
 +
== Multiplication and Floating Point ==
 +
ARMv1 does not have support for multiplication. Software that requires multiplication will have to resort to a software implementation (e.g., [[Shift-and-Add Multiplication]]). This was considerably slow and was consequently added in later ARM versions. Likewise there was no support for hardware floating point or an ability to do such operations on an external FPU coprocessor.
 +
 
 +
== Exception Vector Map ==
 +
{| class="wikitable"
 +
|-
 +
! Address !! Function !! Priority
 +
|-
 +
| 000 0000 || Reset || 0
 +
|-
 +
| 000 0004 || Undefined Instruction Trap || 6
 +
|-
 +
| 000 0008 || Software Interrupt || 7
 +
|-
 +
| 000 000C || Abort (Prefetch) || 5
 +
|-
 +
| 000 0010 || Abort (Data) || 2
 +
|-
 +
| 000 0014 || Address Exception || 1
 +
|-
 +
| 000 0018 || Normal Interrupt (IRQ) || 4
 +
|-
 +
| 000 001C || Fast Interrupt (FIRQ) || 3

Latest revision as of 14:07, 2 July 2017

v · d · e
ARM ISA
General
Variants
Extensions
Topics
Versions(all)

ARMv1 is the first ARM instruction set version. Introduced with the ARM1 on April 26 1985, the ARMv1 defines a 32-bit ISA along with 26-bit addressing space. The ARMv1 was only implemented by the ARM1 and was replaced soon after by the ARM2. Only a few hundred of those chips were ever fabricated.

Overview[edit]

The ARMv1 presents a simple instruction set architecture, albeit bigger and more complex than many of its RISC contemporaries, consisting of mostly simple operations along with a number of complex ones borrowed from early 8-bit CISC microprocessors. Each instruction is 32-bit in size and operates on two 32-bit operands. There is a 24-bit program counter allowing for a 26-bit address space of up to 64 MiB of memory.

Registers[edit]

There are 16 general purpose 32-bit registers. With the exception of register 15 and 14, all registers are orthogonal with no specific designated purpose.

Addressing Mode[edit]

The ARMv1 has five addressing modes:

Mode Syntax Operation
PC Relative Label Effective_Address = PC ± Offset (12 bits)
Base Register Offset
With Post-Increment
[Rn], offset Effective_Address = Rn
Rn = Rn ± offset
Base Register Offset
With Pre-Increment
[Rn, offset] Effective_Address = Rn ± offset (12 bits)
Rn = Rn ± offset
Base Register Index
With Post-Increment
[Rn], Rm Effective_Address = Rn
Rn = Rn ± Rm
Base Register Index
With Pre-Increment
[Rn, Rm] Effective_Address = Rn ± Rm
Rn = Rn ± Rm

Instruction Listing[edit]

The ARMv1 ISA has 45 operations under 23 mnemonics. The ARMv1 is broken down into 8 classes of instruction:

ARMv1 ISA
Mnemonic Syntax Description Action
Movement Instructions
Movement instructions move data between registers and operands.
MOVMOV<cond>{S} Rd, #immMove value immedRd = immed
MOVMOV<cond>{S} Rd, Rm, {, <shift>}Move valueRd = Shift(Rm)
MVNMVN<cond>{S} Rd, #immMove NOT value immedRd = ¬immed
MVNMVN<cond>{S} Rd, Rm, {, <shift>}Move NOT valueRd = ¬Shift(Rm)
Load Instructions
Load instructions move the content of memory addresses into registers.
LDMLDM<cond><type> Rn{!}, <reglist>{^}Load multipleaddr = Rn
for each Rd in {reglist}:
     Rd = [addr]
     update address based on {type}
LDRLDR<cond>{B} Rd, [Rn {, #imm}]{!}Load register immedRd = [Rn + imm]
If !: Rn = Rn + imm
LDRLDR<cond>{B} Rd, [Rn, Rm {, <shift>}]{!}Load registerRd = [Rn + Shift(Rm)]
If !: Rn = Rn + Shift(Rm)]
LDRLDR<cond>{B}{T} Rd, [Rn], #immLoad register, post indexRd = [Rn]
Rn = Rn + imm
LDRLDR<cond>{B}{T} Rd, [Rn], Rm {, <shift>}Load register, post indexRd = [Rn]
Rn = Rn + Shift(Rm)
Store Instructions
Store instructions moves the values from registers into memory.
STMSTM<cond><type> Rn{!}, <reglist>{^}Store multipleaddr = Rn
for each Rd in {reglist}:
     [addr] = Rd
     update address based on {type}
STRSTR<cond>{B} Rd, [Rn {, #imm}]{!}Store register immed[Rn + imm] = Rd
If !: Rn = Rn + imm
STRSTR<cond>{B} Rd, [Rn, Rm {, <shift>}]{!}Store register[Rn + Shift(Rm)] = Rd
If !: Rn = Rn + Shift(Rm)]
STRSTR<cond>{B}{T} Rd, [Rn], #immStore register, post index[Rn] = Rd
Rn = Rn + imm
STRSTR<cond>{B}{T} Rd, [Rn], Rm {, <shift>}Store register, post index[Rn] = Rd
Rn = Rn + Shift(Rm)
Arithmetic Instructions
Arithmetic instructions perform basic mathematical operations on two operands.
ADCADC<cond>{S} Rd, Rn, #immAdd and carry immedRd = Rn + imm + C
ADCADC<cond>{S} Rd, Rn, Rm{, <shift>}Add and carryRd = Rn + Shift(Rm) + C
ADDADD<cond>S Rd, Rn, #immAdd immedRd = Rn + imm
ADDADD<cond>S Rd, Rn, Rm{, <shift>}AddRd = Rn + Shift(Rm)
RSBRSB<cond>S Rd, Rn, #immReverse subtract immedRd = imm - Rn
RSBRSB<cond>S Rd, Rn, Rm{, <shift>}Reverse subtractRd = Shift(Rm) - Rn
RSCRSB<cond>S Rd, Rn, #immReverse subtract with carry immedRd = imm - Rn - ¬C
RSCRSB<cond>S Rd, Rn, Rm{, <shift>}Reverse subtract with carryRd = Shift(Rm) - Rn - ¬C
SBCSBC<cond>{S} Rd, Rn, #immSubtract with carry immedRd = Rn - imm - ¬C
SBCSBC<cond>{S} Rd, Rn, Rm{, <shift>}Subtract with carryRd = Rn - Shift(Rm) - ¬C
SUBSUB<cond>{S} Rd, Rn, #immSubtract immedRd = Rn - imm
SUBSUB<cond>{S} Rd, Rn, Rm{, <shift>}SubtractRd = Rn - Shift(Rm)
Logical Instructions
Logical instructions perform logical bitwise operations on operands.
ANDAND<cond>{S} Rd, Rn, #immAND immedRd = Rn & imm
ANDAND<cond>{S} Rd, Rn, Rm{, <shift>}ANDRd = Rn & Shift(Rm)
BICBIC<cond>{S} Rd, Rn, #immBit clear immedRd = Rn & ¬imm
BICBIC<cond>{S} Rd, Rn, Rm{, <shift>}Bit clearRd = Rn & ¬Rm
EOREOR<cond>{S} Rd, Rn, #immExclusive OR immedRd = Rn ⊕ imm
EOREOR<cond>{S} Rd, Rn, Rm{, <shift>}Exclusive ORRd = Rn ⊕ Shift(Rm)
ORRORR<cond>{S} Rd, Rn, #immLogical OR immedRd = Rn ∥ imm
ORRORR<cond>{S} Rd, Rn, Rm{, <shift>}Logical ORRd = Rn ∥ Shift(Rm)
Comparison Instructions
Comparison instructions compare two values and set appropriate status flags.
CMNCMN<cond> Rn, #immCompare negative immedCPSR flags set on (Rn + imm)
CMNCMN<cond> Rn, Rm{, <shift>}Compare negativeCPSR flags set on (Rn + Shift(Rm))
CMPCMP<cond> Rn, #immCompare immedCPSR flags set on (Rn - imm)
CMPCMP<cond> Rn, Rm{, <shift>}CompareCPSR flags set on (Rn - Shift(Rm))
TEQTEQ<cond> Rn, #immTest equality immedCPSR flags set on (Rn ⊕ imm)
TEQTEQ<cond> Rn, Rm{, <shift>}Test equalityCPSR flags set on (Rn ⊕ Shift(Rm))
TSTTST<cond> Rn, #immTest bits immedCPSR flags set on (Rn & imm)
TSTTST<cond> Rn, Rm{, <shift>}Test bitsCPSR flags set on (Rn & Shift(Rm))
Branch Instructions
Branch instructions order instruction processing to start elsewhere conditionally or unconditionally.
BB<cond> immBranch relativePC = PC + address
BLBL<cond> immBranch and link relativeLR = RET
PC = PC + address
Miscellaneous Instructions
Any instruction that doesn't belong anywhere else.
SWISWI<cond> immSoftware interruptLR = RET
Execute SWI vector in supervisor mode

Multiplication and Floating Point[edit]

ARMv1 does not have support for multiplication. Software that requires multiplication will have to resort to a software implementation (e.g., Shift-and-Add Multiplication). This was considerably slow and was consequently added in later ARM versions. Likewise there was no support for hardware floating point or an ability to do such operations on an external FPU coprocessor.

Exception Vector Map[edit]

Address Function Priority
000 0000 Reset 0
000 0004 Undefined Instruction Trap 6
000 0008 Software Interrupt 7
000 000C Abort (Prefetch) 5
000 0010 Abort (Data) 2
000 0014 Address Exception 1
000 0018 Normal Interrupt (IRQ) 4
000 001C Fast Interrupt (FIRQ) 3