02_ARM_Processor_Core_and_Instruction_Sets

R2 r9 r0r2 r9 r1r2 r9 r13r2 r9 fd postfix full

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: ore Increment Descending Full Empty STMIB STMFA LDMIB LDMED After r9 r9’ r5 r1 r0 LDMDB STMDB LDMEA STMFD 101816 100c16 r9 100016 r9’ STMDA r9!, {r0, r1, r5} STMIA LDMIA STMEA LDMFD Before 101816 r5 r1 r0 100c16 100016 STMDB r9!, {r0, r1, r5} Empty Decrement After LDMDA LDMFA STMDA STMED 82/213 Block Copy Addressing (2/2) Institute of Electronics, National Chiao Tung University • Copy 8 words from the location r0 points to to the location r1 points to LDMIA r0!,{r2-r9} STMIA r1,{r2-r9} – r0 increased by 32, r1 unchanged • If r2 to r9 contained useful values, preserve them by pushing them onto a stack STMFD LDMIA STMIA LDMFD r13!,{r2-r9} r0!,{r2-r9} r1,{r2-r9} r13,{r2-r9} – FD postfix: full descending stack addressing mode 83/213 Memory Block Copy – – – – STMIA/LDMIA: STMIB/LDMIB: STMDA/LDMDA: STMDB/LDMDB: Increment Increment Decrement Decrement After Before After Before • For Example memory r13 ;r12 points to start of source data r14 ;r14 points to end of source data ;r13 points to start of destination data r12 Loop LDMIA r12!,{r0-r11} ;load 48 bytes STMIA r13!,{r0-r11} ;and store them CMP r12,r14 ;check for the end BNE Loop ;and loop until done copy Institute of Electronics, National Chiao Tung University • The direction that the base pointer moves through memory is given by the postfix to the STM/LDM instruction increasing – this loop transfers 48 bytes in 31 cycles – over 50Mbytes/sec at 33MHz 84/213 Single Word and Unsigned Byte Data Transfer Instructions Institute of Electronics, National Chiao Tung University • Pre-indexed form LDR|STR {<cond>}{B} Rd,[Rn,<offset>]{!} • Post-index form LDR|STR {<cond>}{B}{T} Rd,[Rn],<offset> • PC-relative form LDR|STR {<cond>}{B} Rd,LABEL – LDR ‘load register’; STR ‘store register’ ‘B’ unsigned byte transfer, default is word; <offset> may be # +/-<12-bit immediate> or +/- Rm{,shift} ! auto-indexing T flag selects the user view of the memory translation and protection system 85/213 Example Institute of Electronics, National Chiao Tung University • Store a byte in r0 to a peripheral UARTADD LDR r1,UARTADD STRB r0,[r1] … & &10000000 ;store data to UART 86/213 Half-word and Signed Byte Data Transfer Instructions Institute of Electronics, National Chiao Tung University • Pre-indexed form LDR|STR{<cond>}H|SH|SB Rd,[Rn,<offset>]{!} • Post-indexed form LDR|STR{<cond>}H|SH|SB Rd,[Rn],<offset> – <offset> is # +/-<8-bit immediate> or +/-Rm – H|SH|SB selects the data type - unsigned half-word, signed halfword and signed byte. Otherwise is for word and unsigned byte transfer 87/213 Example Institute of Electronics, National Chiao Tung University • Expand an array of signed half-words into an array of words Loop ADR ADR ADR LDRSH STR CMP BLT r1,ARRAY1 r2,ARRAY2 r3,ENDARR1 r0,[r1],#2 r0,[r2],#4 r1,r3 Loop ;half-word array start ;word array start ;ARRAY1 end+2 ;get signed half-word ;save word ;check for end of array ;if not finis...
View Full Document

This note was uploaded on 08/23/2009 for the course IEE 5016 taught by Professor Tian-sheuanchang during the Spring '05 term at National Chiao Tung University.

Ask a homework question - tutors are online