# arm_demo - ARM Movement Instructions MOVS Rd updates...

• Notes
• 14

This preview shows pages 1–6. Sign up to view the full content.

arm_demo 1 ARM Movement Instructions • MOV S Rd, <op2> ; updates N, Z, C Rd = <op2> (copy of <op2> MVN Rd, <op2> ; Rd = 0xF..F EOR <op2> (one’s complement of <op2>) arm_demo 2 OP2 Selection for binary operations • R m – register m is the operand #n – n is the immediate operand • R m shift immediate • R m shift R s arm_demo 3 ALU Arithmetic Instructions ADDS Rd, Rn, <op2> ; updates N, Z, V, C Rd = Rn + <op2> SUBS Rd, Rn, <op2> Rd = Rn - <op2> CMP Rd, <op2> Flags <= Rd - <op2> (difference lost)

This preview has intentionally blurred sections. Sign up to view the full version.

arm_demo 4 ALU Logical Examples TST Rd, <op2> Flags <= Rd AND <op2> TEQ Rd, <op2> Flags <= Rd EOR <op2> • AND S Rd, Rn, <op2> Rd = Rn AND <op2> update N, Z, C arm_demo 5 ALU Logical Examples EOR Rd, Rn, <op2> Rd = Rn EOR <op2> ORR Rd, Rn, <op2> Rd = Rn OR <op2> BIC Rd, Rn, <op2> ;BIt Clear Rd = Rn AND NOT <op2> arm_demo 6 Conditions (1) (opcode suffix) EQ - Z set (equal) NE - Z clear (not equal) HS / CS - C set (unsigned higher or same) LO / CC - C clear (unsigned lower) MI -N set (negative) PL - N clear (positive or zero) VS - V set (overflow) VC - V clear (no overflow) HI - C set and Z clear (unsigned higher)
arm_demo 7 Conditions (2) (opcode suffix) LS - C clear or Z (set unsigned lower or same) GE - N set and V set, or N clear and V clear (>or =) LT - N set and V clear, or N clear and V set (>) GT - Z clear, and either N set and V set, or N clear and V set (>) LE - Z set, or N set and V clear,or N clear and V set (<, or =) AL – always (default) NV – reserved (don’t use) arm_demo 8 Typical Conditions EQ: last arithmetic operation yielded 0 result last logical operation yielded 0 result last compare when both operands the same NE: last arithmetic operation yielded non-0 result last logical operation yielded non-0 result last compare when operands differed PL: value of MSB is 0 after last operation (result is positive number arm_demo 9 Branch Instructions B label ( BAL label ) PC <= “address” of label B(cond) label PC <= “address” of label if cond is true, otherwise execute next instruction These are not calls to subroutines!

This preview has intentionally blurred sections. Sign up to view the full version.

arm_demo 10 Branch and Link Instructions BL label ( BLAL label ) PC <= “address” of label, set link register to current PC value BL(cond) label PC <= “address” of label if cond is true, set link register to current PC value, otherwise execute next instruction These are calls to subroutines since we remember where we came from. arm_demo 11 <am1> Typical Modes • [R n ] – pointer/register indirect, memory address is content or register [Rn, off] – above with offset added to register [Rn], #4 – post increment of pointer in register (word: #4, byte: #1) arm_demo 12 Load Instructions LDR Rd, <am1> (also LDRB for bytes) Rd = [address] LDM(cond){IB|IA|DB|DA}, Rd(!), <regs>{^} “block pop”, ! => update Rd, <“regs”> => list of registers ^ => set the S bit
arm_demo 13 Store Instructions STR Rd, <am1> (also STRB for bytes) [address] = Rd STM(cond){IB|IA|DB|DA}, Rd(!), <regs>{^} “block push”, ! => update Rd,

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern