Computer Architecture Lecture 5: Addressing modes Piotr Bilski.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Instruction Set Design
Computer Organization and Architecture
16.317: Microprocessor System Design I
4/14/2017 Discussed Earlier segmentation - the process address space is divided into logical pieces called segments. The following are the example of types.
Virtual Memory Chapter 18 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S. Dandamudi.
Computer Organization and Architecture
Computer Organization and Architecture
Chapter 11 Instruction Sets
Abdullah, Ibrahim Ali, Javeed Budhram, Dharmendra Galiana, Thomas Monegro, Wesley Silva, Frank.
Memory Management Norman White Stern School of Business.
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
Vacuum tubes Transistor 1948 ICs 1960s Microprocessors 1970s.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Chapter 8.3: Memory Management
Memory Management (II)
CE6105 Linux 作業系統 Linux Operating System 許 富 皓. Chapter 2 Memory Addressing.
Chapter 8 Operating System Support (Continued)
Chapter 3.2 : Virtual Memory
Vacuum tubes Transistor 1948 –Smaller, Cheaper, Less heat dissipation, Made from Silicon (Sand) –Invented at Bell Labs –Shockley, Brittain, Bardeen ICs.
Virtual Memory I Chapter 8.
CS2422 Assembly Language & System Programming September 22, 2005.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 2: 80386DX Internal Architecture & Data Organization.
Pentium Addressing Modes
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
Chapter 11 Instruction Sets: Addressing Modes and Formats HW: 11.4, 5, 13, 16 (Due 11/15)
Part II: Addressing Modes
CH12 CPU Structure and Function
Address Translation Mechanism of 80386
Cosc 3P92 Week 9 & 10 Lecture slides
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Chapter 8 – Main Memory (Pgs ). Overview  Everything to do with memory is complicated by the fact that more than 1 program can be in memory.
1 Linux Operating System 許 富 皓. 2 Memory Addressing.
Paging Example What is the data corresponding to the logical address below:
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
80386DX.
Computer Organization
Chapter 11 Instruction Sets: Addressing Modes and Formats Gabriel Baron Sydney Chow.
Operating Systems Unit 7: – Virtual Memory organization Operating Systems.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 21 & 22 Processor Organization Register Organization Course Instructor: Engr. Aisha Danish.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
Addressing Modes and Formats
Different Microprocessors Tamanna Haque Nipa Lecturer Dept. of Computer Science Stamford University Bangladesh.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Memory Management – Page 1CSCI 4717 – Computer Architecture CSCI 4717/5717 Computer Architecture Topic: Memory Management *** Modified – look for Reading:
Computer Architecture
EEL 4709C Prof. Watson Herman Group 4 Ali Alshamma, Derek Montgomery, David Ortiz 11/11/2008.
Displacement (Indexed) Stack
William Stallings Computer Organization and Architecture 6th Edition
COMBINED PAGING AND SEGMENTATION
Address Translation Mechanism of 80386
Alvaro Mauricio Peña Dariusz Niworowski Frank Rodriguez
William Stallings Computer Organization and Architecture 8th Edition
Operating Modes UQ: State and explain the operating modes of X86 family of processors. Show the mode transition diagram highlighting important features.(10.
Computer Architecture
Lecture 3: Main Memory.
Chapter 11 Processor Structure and function
COMP755 Advanced Operating Systems
Presentation transcript:

Computer Architecture Lecture 5: Addressing modes Piotr Bilski

Why do we need different addressing modes? Real or virtual memory space is larger than space referred to by the argument (too small number of bits) A compromise between the address range and simplicity of the address fetching is needed

Real (effective) and virtual address The real address is the address of the physical location in the memory Virtual address (effective address - EA) is the address treated as the instruction argument Translation of the virtual address into the real one depends on the organization of the memory

Symbols used EA – effective address R – content of the address field in the instruction referring to the registers A – content of the addresss field in the instruction (X) – content of the location X

Addressing modes Immediate Direct Indirect Register Register indirect Displacement (indexed) Stack

Immediate mode Operation code Argument value The argument is stored in the instruction using Two’s complements format. Therefore, this number can not be too large.

Direct mode Operation code Argument address Argument memory EA = A

Indirect mode Operation code Address storing information about the address of the argument Argument memory EA = (A) Nesting possible!

Register mode Operation code Name (register number) Argument registers EA = R

Register indirect mode Operation code Address registers Name (register number) memory Argument EA = (R)

Displacement mode Operation code Argument address Address registers Name (register number) memory Argument EA = (A)

Displacement mode (cont.) Relative addressing (R=PC) Addressing with the base register (efficient for the segmented memory) – EA=R+A Indexing (different interpretation of the register and address field that when using base register) – EA=A+R

Displacement addressing (cont.) Addressing with the base register Indexing (uses dedicated indexing register) Operation code Displacement value Register with argument address Operation code Argument address Register with displacement

Stack mode Operation code Argument address Stack register registers stack

Address types Physical – location of the address in the memory Logical – location of the address in relation to the program entry point Base – entry point address

Memory organization from the operating system level Paged memory (model invisible for the programmer) – memory is divided into small fragments (page frames), assigned to the fragments of the programs Segmented memory (model available for the programmer) – assures separate addressing space for every process

Partitioning with the predefined size Division of the memory into fragments of the predefined sizes (constant or varying) 16 MB (OS) 16 MB 16 MB (OS) 4 MB 8 MB 16 MB

Partitioning with the dynamic size Division of the memory into fragments of the sizes depending on the processes requirements 16 MB (OS) 48 MB free 16 MB (OS) Process 1 (20 MB) 28 MB free 16 MB (OS) Process 1 (20 MB) Process 2 (16) MB 12 MB free 16 MB (OS) Process 3 (18 MB) Process 2 (16) MB 12 MB free

Paging memory Process A: Page 0 Page 1 Page 2 Free frames: memory Page 0 Page 1 Page 2 Page table of the process A:

Physical and logical addresses in the paging structure Logical address 1 30 Page table of the process A: memory Page 0 Page 1 Page 2 Physical address 12 30

Translation Lookaside Buffer Cache memory for the recent memory addresses translations Very fast, but small size TLB cooperates with the „real” cache memory Bad design can lead to the system’s malfunctions (see Phenom processors)!

Translation Lookaside Buffer (TLB) START STOP Checking TLB Entry in TLB? YES NO Access to the page table Page in memory? Physical address generation Actualize TLB Page fault handling NO YES

Segmentation Easy management of the data structures of varying size Ability to grant individual rights of the processes to the subsequent segments Ability to use the segment by multiple processes Addressing: segment number + relative address

Pentium address spaces Non-segmented, non-paged memory (virtual address = physical address - drivers) Non-segmented, paged memory (BSD) Segmented, non-paged memory Segmented, paged memory (UNIX System V)

Pentium II Segmentation 2 bits of the segment pointer are used for the protection mechanism Relative address allows addressing 2 32 = 4 GB of memory The overall amount of addressable memory is 2 16 x 2 32 = 64 TB Access of the process to the segment depends on the accessibility level (indicated by the number from 0 – the highest to 3 – the lowest) Virtual address Segment pointer 16 bits Relative address 32 bits

Segment Selector and Descriptor Index PRVTI Base 15-0 Segment border 15-0 Base GS G AVLAVL D/BD/B Base P DPL S Type

Pentium II Paging The page directory contains 1024 entries, which divide the memory into 1024 pages groups Each pages group contains up to 1024 entries Every page has size of 4 kB or 4MB (depending on the PSE bit) Page tables can be contained in the virtual memory Translation Lookaside Buffer contains up to 32 entries of the page tables for the particular page directory

Paging/Segmentation in Pentium II

Pentium addressing modes Pentium has six segment registers (SR) to hold addresses of the first segments Segment descriptor register is related to the segment register (contains segment access rights and its length) Additional registers (base and index) help to assemble address

Pentium addressing modes (cont.) Immediate (Arg = A) Register (AL = R) Displacement (AL = (SR) + A) Base register (AL = (SR) + (B)) Base register with displacement (AL = (SR) + (B) + A) Scaled index with displacement (AL = (SR) + (I) x S + A) Base register with index and displacement (AL = (SR) + (B) + (I) + A) Base register with scaled index and displacement (AL = (SR) + (I) x S + (B) + A) Relative (AL = (PC) + A)

Illustration of the Pentium addressing modes Segment register Descriptor register Selector Linear address Base register Indexing register Scale Displacement Memory Segment base address Border

PowerPC memory management RISC architecture – simple addressing modes! Implementation depends on the architecture (32 or 64 bit) Block address translation mechanism is used as the alternative to the paging mechanism

Effective and real address of PowerPC Effective address Real address Segment PageByte selector Real page numberByte alignment

PowerPC addressing modes Load/store architecture (also with update) –Indirect (AE = (BR) + D ) –Indexed indirect (AE = (BR) +(IR)) Branch address –Absolute (AE = I) –Relative (AE = (PC) +I) –Indirect (AE = (L/CR)) Arithmetic –Register fixed position (AE = GPR) –Immediate (Arg = I) –Register floating position (AE = FPR)

Instruction format Instruction length is limited by the breadth of the applied buses Instruction length should be equal to the breadth of the bus or its multiplicity A compromise between the bit number required for the instruction code and address space Instructions containing codes of varying length are more flexible

Instruction Design Criteria Number of addressing modes Number of operands Number of registers and their sets Address range Address granularity level (byte or word addressing?)

Format example: PDP-8 Instructions and data 12 bit long One register – accumulator Memory is divided into the pages 2 7 = 128 words long The eight bit is a pointer to the page number

PDP-8 instructions Operation D/I Z/CDisplacement DeviceOperation code x CLA CLL CMA CML RAR RAL BSW IAC Memory related instructions Input/output instructions Microoperations and register related instructions

PDP-10 instructions Instruction elements are orthogonal Only direct addressing 36-bit instruction and data Operation Register I Index registerMemory address

Pentium instruction format Prefixes Oper. code ModR/M SIB Displacement Immediate 0-4 B 1-2 B 0-1 B 0-1 B 0-4 B 0-4 B Address specifier

PowerPC instruction format All instructions are 32-bit long! 6 b 5 b 5 b 16 b Operation Options/desti- Options/source nation register register