CENG4480 Lecture 09: Memory 1

Similar documents
CENG3420 Lecture 08: Memory Organization

ECE468 Computer Organization and Architecture. Memory Hierarchy

Concept of Memory. The memory of computer is broadly categories into two categories:

ECE 341. Lecture # 16

Memory Hierarchy Technology. The Big Picture: Where are We Now? The Five Classic Components of a Computer

,e-pg PATHSHALA- Computer Science Computer Architecture Module 25 Memory Hierarchy Design - Basics

CPS101 Computer Organization and Programming Lecture 13: The Memory System. Outline of Today s Lecture. The Big Picture: Where are We Now?

EEC 483 Computer Organization

CS152 Computer Architecture and Engineering Lecture 16: Memory System

Overview. Memory Classification Read-Only Memory (ROM) Random Access Memory (RAM) Functional Behavior of RAM. Implementing Static RAM

CSC Memory System. A. A Hierarchy and Driving Forces

chapter 8 The Memory System Chapter Objectives

CpE 442. Memory System

ECE7995 (4) Basics of Memory Hierarchy. [Adapted from Mary Jane Irwin s slides (PSU)]

k -bit address bus n-bit data bus Control lines ( R W, MFC, etc.)

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 13

The Memory Hierarchy Part I

Lecture-14 (Memory Hierarchy) CS422-Spring

UNIT-V MEMORY ORGANIZATION

ECE232: Hardware Organization and Design

Recap: Machine Organization

Announcement. Computer Architecture (CSC-3501) Lecture 20 (08 April 2008) Chapter 6 Objectives. 6.1 Introduction. 6.

MEMORY. Objectives. L10 Memory

The University of Adelaide, School of Computer Science 13 September 2018

The Memory Hierarchy & Cache

CPE300: Digital System Architecture and Design

Large and Fast: Exploiting Memory Hierarchy

ECE 152 Introduction to Computer Architecture

Unit IV MEMORY SYSTEM PART A (2 MARKS) 1. What is the maximum size of the memory that can be used in a 16-bit computer and 32 bit computer?

Memory. Lecture 22 CS301

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Memory. Objectives. Introduction. 6.2 Types of Memory

LECTURE 10: Improving Memory Access: Direct and Spatial caches

Lecture 18: Memory Systems. Spring 2018 Jason Tang

Computer Organization and Assembly Language (CS-506)

a) Memory management unit b) CPU c) PCI d) None of the mentioned

Memory systems. Memory technology. Memory technology Memory hierarchy Virtual memory

EEM 486: Computer Architecture. Lecture 9. Memory

CS 61C: Great Ideas in Computer Architecture. The Memory Hierarchy, Fully Associative Caches

Picture of memory. Word FFFFFFFD FFFFFFFE FFFFFFFF

CENG 3420 Computer Organization and Design. Lecture 08: Memory - I. Bei Yu

Organization. 5.1 Semiconductor Main Memory. William Stallings Computer Organization and Architecture 6th Edition

Multilevel Memories. Joel Emer Computer Science and Artificial Intelligence Laboratory Massachusetts Institute of Technology

Memory latency: Affects cache miss penalty. Measured by:

Design and Implementation of an AHB SRAM Memory Controller

ECE 485/585 Microprocessor System Design

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

COMP3221: Microprocessors and. and Embedded Systems. Overview. Lecture 23: Memory Systems (I)

CSE 431 Computer Architecture Fall Chapter 5A: Exploiting the Memory Hierarchy, Part 1

Summer 2003 Lecture 18 07/09/03

CS 320 February 2, 2018 Ch 5 Memory

CS 61C: Great Ideas in Computer Architecture. Direct Mapped Caches

Memory Pearson Education, Inc., Hoboken, NJ. All rights reserved.

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 7: Memory Organization Part II

Internal Memory Cache Stallings: Ch 4, Ch 5 Key Characteristics Locality Cache Main Memory

Where Have We Been? Ch. 6 Memory Technology

The Memory Hierarchy & Cache The impact of real memory on CPU Performance. Main memory basic properties: Memory Types: DRAM vs.

EE414 Embedded Systems Ch 5. Memory Part 2/2

Memory classification:- Topics covered:- types,organization and working

Memory Hierarchy Y. K. Malaiya

Memory Hierarchy and Caches

William Stallings Computer Organization and Architecture 6th Edition. Chapter 5 Internal Memory

CS 31: Intro to Systems Storage and Memory. Kevin Webb Swarthmore College March 17, 2015

Basic Organization Memory Cell Operation. CSCI 4717 Computer Architecture. ROM Uses. Random Access Memory. Semiconductor Memory Types

ENGIN 112 Intro to Electrical and Computer Engineering

CS429: Computer Organization and Architecture

Contents. Main Memory Memory access time Memory cycle time. Types of Memory Unit RAM ROM

William Stallings Computer Organization and Architecture 8th Edition. Chapter 5 Internal Memory

CS 261 Fall Mike Lam, Professor. Memory

Memory latency: Affects cache miss penalty. Measured by:

! Memory Overview. ! ROM Memories. ! RAM Memory " SRAM " DRAM. ! This is done because we can build. " large, slow memories OR

Chapter Seven. Large & Fast: Exploring Memory Hierarchy

CS429: Computer Organization and Architecture

Memory Hierarchies. Instructor: Dmitri A. Gusev. Fall Lecture 10, October 8, CS 502: Computers and Communications Technology

Transistor: Digital Building Blocks

Contents. Memory System Overview Cache Memory. Internal Memory. Virtual Memory. Memory Hierarchy. Registers In CPU Internal or Main memory

Memory hierarchy Outline

Memory Hierarchy. Maurizio Palesi. Maurizio Palesi 1

Cycle Time for Non-pipelined & Pipelined processors

The Memory Hierarchy 1

Chapter 5 Internal Memory

Memories: Memory Technology

Random Access Memory (RAM)

Lecture 18: DRAM Technologies

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface

CPU issues address (and data for write) Memory returns data (or acknowledgment for write)

Computer Organization. 8th Edition. Chapter 5 Internal Memory

CENG 3420 Computer Organization and Design. Lecture 08: Cache Review. Bei Yu

Main Memory. EECC551 - Shaaban. Memory latency: Affects cache miss penalty. Measured by:

Introduction to cache memories

Computer Architecture A Quantitative Approach, Fifth Edition. Chapter 2. Memory Hierarchy Design. Copyright 2012, Elsevier Inc. All rights reserved.

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Computer Architecture. Memory Hierarchy. Lynn Choi Korea University

Review: Performance Latency vs. Throughput. Time (seconds/program) is performance measure Instructions Clock cycles Seconds.

Chapter Seven. Memories: Review. Exploiting Memory Hierarchy CACHE MEMORY AND VIRTUAL MEMORY

Memory Technologies. Technology Trends

CS650 Computer Architecture. Lecture 9 Memory Hierarchy - Main Memory

Storage Technologies and the Memory Hierarchy

Mark Redekopp, All rights reserved. EE 352 Unit 10. Memory System Overview SRAM vs. DRAM DMA & Endian-ness

Transcription:

CENG4480 Lecture 09: Memory 1 Bei Yu byu@cse.cuhk.edu.hk (Latest update: November 8, 2017) Fall 2017 1 / 37

Overview Introduction Memory Principle Random Access Memory (RAM) Non-Volatile Memory Conclusion 2 / 37

Overview Introduction Memory Principle Random Access Memory (RAM) Non-Volatile Memory Conclusion 3 / 37

Why We Need Memory? Combinational Circuit: Always gives the same output for a given set of inputs E.g., adders Sequential Circuit: Store information Output depends on stored information E.g., counter Need a storage element 3 / 37

Who Cares About the Memory Hierarchy? Performance 1000 100 10 1 Processor Growth Curve follows Moore s Law 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 Time CPU DRAM Processor 60%/yr. (2x/1.5 yr) Processor-Memory Performance Gap: (grows 50% / year) DRAM 9%/yr. (2x/10 yrs) 4 / 37 Processor-DRAM Memory Performance Gap

Moore s Law Transistor number on a unit area would double every 1.5 years. *1965 paper reprint: link 5 / 37

6 / 37

7 / 37

Memory System Revisted Maximum size of memory is determined by addressing scheme E.g. 16-bit addresses can only address 2 16 = 65536 memory locations Most machines are byte-addressable each memory address location refers to a byte Most machines retrieve/store data in words Common abbreviations 1k 2 10 (kilo) 1M 2 20 (Mega) 1G 2 30 (Giga) 1T 2 40 (Tera) 8 / 37

Simplified View Data transfer takes place through MAR: memory address register MDR: memory data register Processor MAR MDR k-bit address bus n-bit data bus Memory Up to 2 k addressable locations Control lines ( R / W, MFC, etc.) Word length = n bits Several addressable locations (bytes) are grouped into a word 9 / 37

Big Picture Processor usually runs much faster than main memory: Small memories are fast, large memories are slow. Use a cache memory to store data in the processor that is likely to be used. Main memory is limited: Use virtual memory to increase the apparent size of physical memory by moving unused sections of memory to disk (automatically). A translation between virtual and physical addresses is done by a memory management unit (MMU) To be discussed in later lectures 10 / 37

Memory Hierarchy Taking advantage of the principle of locality: Present the user with as much memory as is available in the cheapest technology. Provide access at the speed offered by the fastest technology Processor Datapath Control Registers On-Chip Cache Second Level Cache (SRAM) Main Memory (DRAM) Secondary Storage (Disk) Tertiary Storage (Tape) Speed: ~1 ns Tens ns Hundreds ns 1 us Tens ms Tens sec Size (bytes): Hundreds Mega's Giga's Tera's 11 / 37

Terminology Memory Access Time time between start and finish of a memory request Memory Cycle Time minimum delay between successive memory operations Random Access Memory (RAM) Property: comparable access time for any memory locations 12 / 37

Overview Introduction Memory Principle Random Access Memory (RAM) Non-Volatile Memory Conclusion 13 / 37

Memory Controller A memory controller is normally used to interface between the memory and the processor. DRAMs have a slightly more complex interface as they need refreshing and they usually have time-multiplex signals to reduce pin number. SRAM interfaces are simpler and may not need a memory controller. Row/Column Address address Processor R/ W Request Clock Memory controller RAS CAS R/ W CS Clock Memory Data RAS (CAS) = Row (Column) Address Strobe; CS = Chip Select 13 / 37

Memory Controller The memory controller accepts a complete address and the R/W signal from the processor. The controller generates the RAS (Row Access Strobe) and CAS (Column Access Strobe) signals. 14 / 37

Memory Controller The memory controller accepts a complete address and the R/W signal from the processor. The controller generates the RAS (Row Access Strobe) and CAS (Column Access Strobe) signals. The high-order address bits, which select a row in the cell array, are provided first under the control of the RAS (Row Access Strobe) signal. Then the low-order address bits, which select a column, are provided on the same address pins under the control of the CAS (Column Access Strobe) signal. 14 / 37

Memory Controller The memory controller accepts a complete address and the R/W signal from the processor. The controller generates the RAS (Row Access Strobe) and CAS (Column Access Strobe) signals. The high-order address bits, which select a row in the cell array, are provided first under the control of the RAS (Row Access Strobe) signal. Then the low-order address bits, which select a column, are provided on the same address pins under the control of the CAS (Column Access Strobe) signal. The right memory module will be selected based on the address. Data lines are connected directly between the processor and the memory. SDRAM needs refresh, but the refresh overhead is only less than 1 percent of the total time available to access the memory. 14 / 37

Memory Hierarchy Processor Registers Aim: to produce fast, big and cheap memory Increasing latency Increasing size Primary cache L1 Increasing speed Increasing cost per bit L1, L2 cache are usually SRAM Main memory is DRAM Relies on locality of reference Secondary cache Main memory L2 Magnetic disk secondary memory 15 / 37

Locality of Reference Temporal Locality (locality in time) If an item is referenced, it will tend to be referenced again soon. When information item (instruction or data) is first needed, brought it into cache where it will hopefully be used again. Spatial Locality (locality in space) If an item is referenced, neighbouring items whose addresses are close-by will tend to be referenced soon. Rather than a single word, fetch data from adjacent addresses as well. 16 / 37

Mix-and-Match: Best of Both By taking advantages of the principle of locality: Present the user with as much memory as is available in the cheapest technology. Provide access at the speed offered by the fastest technology. DRAM is slow but cheap and dense: Good choice for presenting the user with a BIG memory system âăş main memory SRAM is fast but expensive and not very dense: Good choice for providing the user FAST access time âăş L1 and L2 cache 17 / 37

Cache Usage Need to determine how the cache is organized Mapping functions determine how memory addresses are assigned to cache locations Need to have a replacement algorithm to decide what to do when cache is full (i.e. decide which item to be unloaded from cache). Processor Cache Main Memory Block A set of contiguous addresses of a given size (cache block is also called cache line) 18 / 37

Cache Read Operation Contents of a block are read into the cache the first time from the memory. Subsequent accesses are (hopefully) from the cache, called a cache read hit. Number of cache entries is relatively small, need to keep most likely used data in cache. When an un-cached block is required, need to employ a replacement algorithm to remove an old block and to create space for the new one. 19 / 37

Cache Write Operation Scheme 1: Write-Through Cache and main memory updated at the same time. Note that read misses and read hits can occur. 20 / 37

Cache Write Operation Scheme 1: Write-Through Cache and main memory updated at the same time. Note that read misses and read hits can occur. Scheme 2: Write-Back Update cache only and mark the entry dirty. Main memory will be updated later when cache block is removed. Note that write misses and write hits can occur. 20 / 37

Question 2: Which write scheme is simpler? Which one has better performance? Why? 21 / 37

Overview Introduction Memory Principle Random Access Memory (RAM) Non-Volatile Memory Conclusion 22 / 37

Storage based on Feedback What if we add feedback to a pair of inverters? 22 / 37

Storage based on Feedback What if we add feedback to a pair of inverters? Usually drawn as a ring of cross-coupled inverters Stable way to store one bit of information (w. power) 22 / 37

How to change the value stored? Replace inverter with NAND gate RS Latch A B A nand B 0 0 1 0 1 1 1 0 1 1 1 0 23 / 37

QUESTION: What s the Q value based on different R, S inputs? A B A nand B 0 0 1 0 1 1 1 0 1 1 1 0 R=S=1: S=0, R=1: S=1, R=0: R=S=0: 24 / 37

SRAM Cell At least 6 transistors (6T) Used in most commercial chips A pair of weak cross-coupled inverters Data stored in cross-coupled inverters word bit bit_b 25 / 37

DRAM Cell 1 Transistor (1T) Requires presence of an extra capacitor Modifications in the manufacturing process. Higher density Write: Charged or discharged the capacitor (slow) Read: Charge redistribution takes place between bit line and storage capacitance 26 / 37

SRAM v.s. DRAM Static RAM (SRAM) Capable of retaining the state as long as power is applied. They are fast, low power (current flows only when accessing the cells) but costly (require several transistors), so the capacity is small. They are the Level 1 cache and Level 2 cache inside a processor, of size 3 MB or more. Dynamic RAM (DRAM) store data as electric charge on a capacitor. Charge leaks away with time, so DRAMs must be refreshed. In return for this trouble, much higher density (simpler cells). 27 / 37

28 / 37

Synchronous DRAM (SDRAM) The common type used today as it uses a clock to synchronize the operation. The refresh operation becomes transparent to the users. All control signals needed are generated inside the chip. The initial commercial SDRAM in the1990s were designed for clock speed of up to 133MHz. Today s SDRAM chips operate with clock speeds exceeding 1 GHz. 29 / 37

Synchronous DRAM (SDRAM) The common type used today as it uses a clock to synchronize the operation. The refresh operation becomes transparent to the users. All control signals needed are generated inside the chip. The initial commercial SDRAM in the1990s were designed for clock speed of up to 133MHz. Today s SDRAM chips operate with clock speeds exceeding 1 GHz. Memory modules are used to hold several SDRAM chips and are the standard type used in a computer s motherboard, of size like 4GB or more. 29 / 37

Double Data Rate (DDR) SDRAM normal SDRAMs only operate once per clock cycle Double Data Rate (DDR) SDRAM transfers data on both clock edges DDR-2 (4x basic memory clock) and DDR-3 (8x basic memory clock) are in the market. They offer increased storage capacity, lower power and faster clock speeds. For example, DDR2 can operate at clock frequencies of 400 and 800 MHz. Therefore, they can transfer data at effective clock speed of 800 and 1600 MHz. 30 / 37

Performance of SDRAM 1 Hertz 1 Cycle per second RAM Type SDRAM 100 MHz (PC100) SDRAM 133 MHz (PC133) DDR SDRAM 200 MHz (PC1600) DDR SDRAM 266 MHz (PC2100) DDR SDRAM 333 MHz (PC2600) DDR-2 SDRAM 667 MHz (PC2-5400) DDR-2 SDRAM 800 MHz (PC2-6400) Theoretical Maximum Bandwidth 100 MHz X 64 bit/ cycle = 800 MByte/sec 133 MHz X 64 bit/ cycle = 1064 MByte/sec 2 X 100 MHz X 64 bit/ cycle ~= 1600 MByte/sec 2 X 133 MHz X 64 bit/ cycle ~= 2100 MByte/sec 2 X 166 MHz X 64 bit/ cycle ~= 2600 MByte/sec 2 X 2 X 166 MHz X 64 bit/ cycle ~= 5400 MByte/sec 2 X 2 X 200 MHz X 64 bit/ cycle ~= 6400 MByte/sec Bandwidth comparison. However, due to latencies, SDRAM does not perform as good as the figures shown. 31 / 37

Bandwidth v.s. Latency Example Mary acts FAST but she s always LATE. Peter is always PUNCTUAL but he is SLOW. 32 / 37

Bandwidth v.s. Latency Example Mary acts FAST but she s always LATE. Peter is always PUNCTUAL but he is SLOW. Bandwidth: talking about the number of bits/bytes per second when transferring a block of data steadily. Latency: amount of time to transfer the first word of a block after issuing the access signal. Usually measure in number of clock cycles or in ns/µs. 32 / 37

Question: Suppose the clock rate is 500 MHz. What is the latency and what is the bandwidth, assuming that each data is 64 bits? Clock Row Access Strobe Data d0 d1 d2 33 / 37

Overview Introduction Memory Principle Random Access Memory (RAM) Non-Volatile Memory Conclusion 34 / 37

Read-Only Memory (ROM) Memory content fixed and cannot be changed easily. Useful to bootstrap a computer since RAM is volatile (i.e. lost memory) when power removed. We need to store a small program in such a memory, to be used to start the process of loading the OS from a hard disk into the main memory. PROM/EPROM/EEPROM 34 / 37

FLASH Memory Flash devices have greater density, higher capacity and lower cost per bit. Can be read and written This is normally used for non-volatile storage Typical applications include cell phones, digital cameras, MP3 players, etc. 35 / 37

FLASH Cards Flash cards are made from FLASH chips Flash cards with standard interface are usable in a variety of products. Flash cards with USB interface are widely used memory keys. Larger cards may hold 32GB. A minute of music can be stored in about 1MB of memory, hence 32GB can hold 500 hours of music. 36 / 37

Overview Introduction Memory Principle Random Access Memory (RAM) Non-Volatile Memory Conclusion 37 / 37

Conclusion Processor usually runs much faster than main memory Common RAM types: SRAM, DRAM, SDRAM, DDR SDRAM Principle of locality: Temporal and Spatial Present the user with as much memory as is available in the cheapest technology. Provide access at the speed offered by the fastest technology. Memory hierarchy: Register Cache Main Memory Disk Tape 37 / 37