Chap5-mem-2 - Overview Word/ Halfword/ Byte Addressing Byte...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Overview ° Word/ Halfword/ Byte Addressing ° Byte ordering ° Signed Load Instructions ° Instruction Support for Characters Review: Assembly Operands: Memory ° C variables map onto registers; what about large data structures like arrays? ° 1 of 5 components of a computer: memory contains such data structures ° But ARM arithmetic instructions only operate on registers, never directly on memory. ° Data transfer instructions transfer data between registers and memory: Memory to register Register to memory
Background image of page 1

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

View Full DocumentRight Arrow Icon
Review: Data Transfer: Memory  Reg ° Example: ldr a1, [v1, #8] ° Example: ldr a1, [v1, v2] ° Example: ldr a1, [v1,#12]! Pre Indexed Load: Subsequently, v1 is updates by computed sum of v1 and 12, ( v1 v1 + 12 ). ° Example: ldr a1, [v1, v2]! Pre Indexed Load: Subsequently, v1 is updates by computed sum of v1 and 12, ( v1 v1 + v2 ). ° Example: ldr a1, [v1],#12 Post Indexed Load: Subsequently, v1 is updates by computed sum of v1 and 12, ( v1 v1 + 12 ). ° Example: ldr a1, [v1], v2 Post Indexed Load: Subsequently, v1 is updates by computed sum of v1 and 12, ( v1 v1 + v2 ). Similar instructions For STR Review: Memory Alignment 3 2 1 0 Aligned Not Aligned ° ARM requires that all words start at addresses that are multiples of 4 bytes ° Called Alignment : objects must fall on address that is multiple of their size. ° Some machines like Intel allow non-aligned accesses
Background image of page 2
Data Transfer: More Mem to Reg Variants (#1/2) ° Load Byte Example: ldrb a1, [v1,#12] This instruction will take the pointer in v1 , add 12 bytes to it, and then load the byte value from the memory pointed to by this calculated sum into register a1 . ° Load Byte Example: ldrb a1, [v1, v2] This instruction will take the pointer in v1 , add an index offset in register v2 to it, and then load the byte value from the memory pointed to by this calculated sum into register a1 . 1 word = 4 Bytes v1 a1 0 0 0 +12 Data Transfer: More Mem to Reg Variants (#2/2) ° Load Half Word Example: ldrh a1, [v1,#12] This instruction will take the pointer in v1 , add 12 bytes to it, and then load the half word value from the memory pointed to by this calculated sum into register a1 .
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/20/2010 for the course CSC CSCC85 taught by Professor Lorincz during the Spring '10 term at University of Toronto- Toronto.

Page1 / 12

Chap5-mem-2 - Overview Word/ Halfword/ Byte Addressing Byte...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online