ARM.SoC.Architecture

Some arm systems may generate an exception 4 in

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: memory location. Rd and Rm may be the same register (but should both be distinct from Rn), in which case the register and memory values are exchanged. The ARM executes separate memory read and then memory write cycles, but asserts a 'lock' signal to indicate to the memory system that the two cycles should not be separated. Status register to general register transfer instructions 133 Assembler format Example SWP{<cond>}{B} [Rn] ADR SWPB Rd, Rm, r0, SEMAPHORE r1, r1, [r0] ; exchange byte Notes 1. The PC should not be used as any of the registers in this instruction. 2. The base register (Rn) should not be the same as either the source (Rm) or the destination (Rd) register. 5.14 Status register to general register transfer instructions When it is necessary to save or modify the contents of the CPSR or the SPSR of the current mode, those contents must first be transferred into a general register, the selected bits modified and then the value returned to the status register. These instructions perform the first step in this sequence. Binary encoding Figure 5.13 Status register to general register transfer instruction binary encoding. Description The CPSR (R = 0) or the current mode SPSR (R = 1) is copied into the destination register (Rd). All 32 bits are copied. MRS{<cond>} CPSRISPSR Rd, Assembler format Examples MRS CPSR MRS SPSR r0, r3, ; move the CPSR to r0 ; move the SPSR to r3 134 The ARM Instruction Set Notes 1. The SPSR form should not be used in user or system mode since there is no accessible SPSR in those modes. 2. When modifying the CPSR or SPSR care should be taken to preserve the values of all the unused bits; this will maximize the probability of compatibility with future uses of those bits. This is best achieved by moving the status register to a general register (using these instructions), modifying only the necessary bits and then moving the result back to the status register. 5.15 General register to status register transfer instructions When it is nec...
View Full Document

This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.

Ask a homework question - tutors are online