02.02.2013 Views

ARM Processor Instruction Set

ARM Processor Instruction Set

ARM Processor Instruction Set

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ARM</strong>7500FE Data Sheet<br />

<strong>ARM</strong> DDI 0077B<br />

<strong>ARM</strong> <strong>Processor</strong> <strong>Instruction</strong> <strong>Set</strong><br />

For example, the following sequence performs a mode change:<br />

MRS R0,CPSR ;take a copy of the CPSR<br />

BIC R0,R0,#0x1F ;clear the mode bits<br />

ORR R0,R0,#new_mode ;select new mode<br />

MSR CPSR,R0 ;write back the modified CPSR<br />

When the aim is simply to change the condition code flags in a PSR, a value can be<br />

written directly to the flag bits without disturbing the control bits. e.g. The following<br />

instruction sets the N,Z,C & V flags:<br />

MSR CPSR_flg,#0xF0000000<br />

;set all the flags regardless of<br />

;their previous state (does not<br />

;affect any control bits)<br />

Note: Do not attempt to write an 8 bit immediate value into the whole PSR since such<br />

an operation cannot preserve the reserved bits.<br />

5.5.3 <strong>Instruction</strong> cycle times<br />

PSR Transfers take 1 instruction fetch. For more information see 5.17 <strong>Instruction</strong><br />

Speed Summary on page 5-47.<br />

5.5.4 Assembler syntax<br />

1 MRS - transfer PSR contents to a register<br />

MRS{cond} Rd,<br />

2 MSR - transfer register contents to PSR<br />

MSR{cond} ,Rm<br />

3 MSR - transfer register contents to PSR flag bits only<br />

MSR{cond} ,Rm<br />

The most significant four bits of the register contents are written to the N,Z,C<br />

& V flags respectively.<br />

4 MSR - transfer immediate value to PSR flag bits only<br />

MSR{cond} ,<br />

The expression should symbolize a 32-bit value of which the most significant<br />

four bits are written to the N,Z,C & V flags respectively.<br />

where:<br />

{cond} two-character condition mnemonic, see Figure 5-2: Condition<br />

codes on page 5-2<br />

Rd and Rm expressions evaluating to a register number other than R15<br />

is CPSR, CPSR_all, SPSR or SPSR_all. (CPSR and<br />

CPSR_all are synonyms as are SPSR and SPSR_all)<br />

is CPSR_flg or SPSR_flg<br />

where used, the assembler will attempt to generate a shifted<br />

immediate 8-bit field to match the expression. If this is<br />

impossible, it will give an error.<br />

Open Access - Preliminary<br />

5-15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!