Chap5-mem-1 - Overview Memory Access in Assembly Data...

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

View Full Document Right Arrow Icon
Overview ° Memory Access in Assembly ° Data Structures in Assembly Review:Instruction Set (ARM 7TDMI) ° Set of instruction that a processor can execute ° Instruction Categories Data Processing or Computational (Logical and Arithmetic Load/Store (Memory Access: or transferring data between memory and registers) Control Flow (Jump and Branch) Floating Point - coprocessor Memory Management Special Registers
Background image of page 1

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

View Full DocumentRight Arrow Icon
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 Data Transfer: Memory to Reg (#1/4) ° To transfer a word of data, we need to specify two things: Register: specify this by number (r0 – r15) Memory address: more difFcult - Think of memory as a single one- dimensional array, so we can address it simply by supplying a pointer to a memory address. - Other times, we want to be able to offset from this pointer . arr[0] arr[1] arr[2] arr[3] arr[4]
Background image of page 2
Data Transfer: Memory to Reg (#2/4) ° To specify a memory address to copy from, specify two things: A register which contains a pointer to memory A numerical offset (in bytes), or a register which contain an offset ° The desired memory address is the sum of these two values. ° Example: [v1, #8] speciFes the memory address pointed to by the value in v1 , plus 8 bytes ° Example: [v1, v2] speciFes the memory address pointed to by the value in v1 , plus v2 Data Transfer: Memory to Reg (#3/4) ° Load Instruction Syntax: 1 2, [3, 4] where 1) operation name 2) register that will receive value 3) register containing pointer to memory 4) numerical offset in bytes, or another shifted index register ° Instruction Name: ldr (meaning Load register, so 32 bits or one word are loaded at a time from memory to register)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Data Transfer: Memory to Reg (#4/4) ° Example: ldr a1, [v1, #8] This instruction will take the pointer in v1 , add 8 bytes to it, and then load the value from the memory pointed to by this calculated sum into register a1 ° Notes: v1 is called the base register 8 is called the offset offset is generally used in accessing elements of array: base reg points to beginning of array ° Example: ldr a1, [v1, v2] This instruction will take the pointer in v1 , add an index offset in register v2 to it, and then load the value from the memory pointed to by this calculated sum into register a1 ° Notes: v1 is called the base register
Background image of page 4
Image of page 5
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.

Page1 / 14

Chap5-mem-1 - Overview Memory Access in Assembly Data...

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

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