Arm Instruction Set and a means to use arm CORTEX

bravewarriors123 4 views 19 slides Sep 14, 2025
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

nice


Slide Content

WEEK 2: CODE LIKE A PRO! A RM Instruction Set MISSION MICROPROCESSORS:IET ROVISP

ARM Data Processing Instructions • ARM data processing instructions enable the programmer to perform arithmetic and logical operations on data in registers. These instructions typically require two operands and produce a single result, though there are exceptions. All operands are 32 bits wide and come from registers or are specified as literals in the instruction itself. The result, if there is one, is 32 bits wide and is placed in a register . • • •

Arithmetic Operation

Register Movement Operation 'MOV' operation moves the second operand to the destination. The ' MVN ' mnemonic stands for 'move negated'; it leaves the result register set to the value obtained by inverting every bit in the source operand. • •

Register- indirect addressing • Register- indirect addressing uses a value in one register (the base register) as a memory address. It loads the value from that address into another register or stores the value from another register into that memory address. • LDR r0, [r1] ; r0:= mem 32 [r1] STR r0, [r1] ; mem 32 [r1] := r0

FLAGS

Boolean Operations R1 = 0b1100 R2 = 0b1010 AND → R3 = 0b1000 ORR → R3 = 0b1110 EOR → R3 = 0b0110 MVN R4, R1 → Inverts all bits in R1

Shift Register Operation • LSL : logical shift left by to 31 places; fill the vacated bits at the least significant end of the word with zeros.

Shift Register Operation • LSR : logical shift right by to 32 places; fill the vacated bits at the most significant end of the word with zeros.

Shift Register Operation • ASR: arithmetic shift right by to 32 places; fill the vacated bits at the most significant end of the word with zeros if the source operand was positive, or with ones if the source operand was negative..

Shift and Rotate Operations LSL r4, r6, #4 ; r4 = r6 << 4 bits LSL r4, r6, r3 ; r4 = r6 << # specified in r3 ROR r4, r6, #12 ; r4 = r6 rotated right 12 bits All shift operations take one clock cycle to execute, except register- specified shifts, which take an extra cycle as there are only two read ports on the register bank, and an extra read is required.

Shift and Rotate Operations The shift and logical operations can also be used to move data from one byte to another. Suppose we need to move the uppermost byte from register r2 and put it at the bottom of register r3. The contents of register r3 are shifted left by 8 bits first. Two instructions could be used to do this: LSR r0, r2, #24 ; extract top byte from r2 into r0 ORR r3, r0, r3, LSL #8 ; shift up r3 and insert r0

Multiplication

Multiplication MUL and MLA are multiply and multiply- and- accumulate instructions that produce 32- bit results. MUL multiplies the values in two registers, truncates the result to 32 bits, and stores the product in a third register. MLA multiplies two registers, truncates the results to 32 bits, adds the value of a third register to the product, and stores the result in a fourth register MUL r4, r2, r1 ; r4 = r2 * r1 MULS r4, r2, r1 ; r4 = r2 * r1, then set the flags MLA r7, r8, r9, r3 ; r7 = r8 * r9 + r3

Multiplication MUL r4, r2, r1 ; r4 = r2 * r1 MULS r4, r2, r1 ; r4 = r2 * r1, then set the flags MLA r7, r8, r9, r3 ; r7 = r8 * r9 + r3

DATA MOVEMENT
Tags