Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.

Slides:



Advertisements
Similar presentations
Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Advertisements

Goal: Write Programs in Assembly
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
CS/COE0447 Computer Organization & Assembly Language
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 5: Data Transfer Instructions / Control Flow Instructions Partially adapted from Computer.
ELEN 468 Advanced Logic Design
Chapter 2.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
The University of Adelaide, School of Computer Science
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 6 – Introduction to MIPS Data Transfer & Decisions I Pieter Abbeel’s recent.
Chap.2: Instructions: Language of the computer Jen-Chang Liu, Spring 2006 Adapted from
Instructions Set Bo Cheng Instruction Set Design An Instruction Set provides a functional description of a processor. It is the visible.
Elec2041 lec-11-mem-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 11: Memory Access - I
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 4: Arithmetic / Data Transfer Instructions Partially adapted from Computer Organization.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
ARM programmer’s model and assembler Embedded Systems Programming.
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
CS61C L09 Introduction to MIPS : Data Transfer and Decisions (1) Garcia, Spring 2007 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
Arithmetic for Computers
Topic 8: Data Transfer Instructions CSE 30: Computer Organization and Systems Programming Winter 2010 Prof. Ryan Kastner Dept. of Computer Science and.
MIPS assembly. Computer What’s in a computer? Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
Memory and Addressing How and Where Information is Stored.
Registers and MAL Lecture 12. The MAL Architecture MAL is a load/store architecture. MAL supports only those addressing modes supported by the MIPS RISC.
Working With Main Memory. Why Main Memory Register space limited Used for communication.
Character Data and 32-bit Constants (Lecture #20) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying.
Lecture 8. MIPS Instructions #2 – Memory Access (Load/Store) Instructions Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer.
Lecture 4. MIPS Instructions #2 Memory Access (Load/Store) Instructions Prof. Taeweon Suh Computer Science Education Korea University ECM534 Advanced Computer.
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Chapter 2 CSF 2009 The MIPS Assembly Language: Introduction to Binary System.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /22/2013 Lecture 12: Character Data Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
Addressing Modes. Register Addressing Immediate Addressing Base Addressing Indexed Addressing PC-Relative Addressing.
MIPS Instruction Set Architecture Prof. Sirer CS 316 Cornell University.
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Jump and Branch Instructions
Computer Organization Instructions Language of The Computer (MIPS) 2.
Address alignment When a word (4-bytes) is loaded or stored the memory address must be a multiple of four. This is called an alignment restriction. Addresses.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Programming Model CS 333 Sam Houston State University Dr. Tim McGuire.
Assembly Variables: Registers Unlike HLL like C or Java, assembly cannot use variables – Why not? Keep Hardware Simple Assembly Operands are registers.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
MIPS Arithmetic is 32 bits
Memory Access Instructions
Morgan Kaufmann Publishers
Conditional Branches What distinguishes a computer from a simple calculator is its ability to make decisions Decisions are made using the if statement,
Von Neumann model - Memory
Computer Organization and Assembly Language (COAL)
Appendix A Classifying Instruction Set Architecture
The University of Adelaide, School of Computer Science
Computer Architecture & Operations I
MIPS Instruction Encoding
MIPS Instruction Encoding
Architecture Overview
Von Neumann model - Memory
MIPS Assembly.
Computer Instructions
Computer Architecture
3.
Instruction encoding The ISA defines Format = Encoding
Instruction encoding The ISA defines Format = Encoding
COMS 361 Computer Organization
Reading and writing to data memory
MIPS Instruction Set Architecture
Instruction encoding The ISA defines Format = Encoding
Presentation transcript:

Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment. Big Endian, Little Endian. Load word. Store word. Load halfword. Store halfword. lw, sw, lh, lhu, sh Setting Up the base register Low order result. Portability problems Textbook: Chapter 3. Appendix A Central Connecticut State University, MIPS Tutorial. Chapters 15,16.

Review: MIPS model 2 32 cells, each 8 bits 2 32 bytes Memory Size Address 32 bits MIPS memory is an array of 2 32 bytes. Each byte has a 32-bit address. Each byte can hold an 8-bit pattern, one of the 256 possible 8-bit patterns. The addresses of MIPS main memory range from 0x to 0xFFFFFFFF. Operations Load: a bit pattern starting at a designated address in memory is copied into a register inside the processor. Store: a bit pattern is copied from a processor register to memory at a designated address. General Purpose Register

Byte operations 2 32 bytes Memory Size Address 32 bits General Purpose Register Load byte Memory byte -> Register byte Store byte Register byte -> Memory byte Low order

2 32 bytes Memory Size Address 32 bits General Purpose Register Halfword operations Load halfword Memory 2 bytes -> Register 2 bytes Store halfword Register 2 bytes -> Memory 2 bytes Load halfword Memory 2 bytes -> Register 2 bytes Store halfword Register 2 bytes -> Memory 2 bytes Low order

2 32 bytes Memory Size Address 32 bits General Purpose Register Word length operations Load word Memory 4 bytes -> Register 4 bytes Store word Register 4 bytes -> Memory 4 bytes Load word Memory 4 bytes -> Register 4 bytes Store word Register 4 bytes -> Memory 4 bytes Low order

 Addressing mode – One of several addressing regimes delimited by their varied use of operands and or addresses.  The first two modes we have learned. Addressing Modes 1. Immediate addressing, where the operand is a constant within the instruction itself 2. Register addressing, where the operand is a register 3. Base or displacement addressing, where the operand is at the memory location, whose address is the sum of a register and a constant in the instruction

 A MIPS instruction is 32 bits (always).  A MIPS memory address is 32 bits (always).  How can a load or store instruction specify an address that is the same size as itself ? Memory Instructions need Address & Register  To transfer a word of data, we need to specify two things:  Register: We specify this by # ($0 - $31) or symbolic name ($s0,…,$t0,…)  Memory address: This is more difficult to specify.

 Memory is a single one-dimensional array, so we can address it simply by supplying a pointer to a memory address.  However very often, we want to be able to offset from this pointer.  This is because sometimes we need only the relative address to refer to the memory starting from some current address.  That relative address is called “offset”. Offset and absolute address complicate our task Absolute pointer 0x Relative pointer(offset) +2 Relative pointer(offset)

So for memory addressing we need:  Either the absolute 32 bit address of the memory  Or The offset (relative address) of the memory  In this case to calculate the absolute address of the memory we need the offset and some current or base absolute address. Base address + Offset Base Address = 0x Calculated address = 0x =0x Calculated address = 0x =0x

Where to keep the Base Address and Offset ? To specify a memory address specify two things: A register containing a base 32 bits address to memory A numerical offset in bytes in the instruction The desired memory address is the sum of these two values. Example: 8($t0) specifies the memory address pointed to by the value in $t0, plus 8 bytes

What looks like the memory access instruction ? Why sign extension ? lb rt, MemAaddress lb rt, offset (rs) offset

Addressing examples positive offset

Addressing examples negative offset