CMPUT101 Introduction to Computing - Summer 2002

Similar documents
The Von Neumann Architecture. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

Designing Computers. The Von Neumann Architecture. The Von Neumann Architecture. The Von Neumann Architecture

CMPUT101 Introduction to Computing - Summer 2002

The Von Neumann Architecture Odds and Ends. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Computer Architecture (part 2)

CS1004: Intro to CS in Java, Spring 2005

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U

CMPUT 101 with Solutions Quiz 2 (50 minutes) November 16, 2000

Computer Architecture

CMPUT 101 with Solutions Quiz 2 (50 minutes) August 7, 2002

Chapter 5 12/2/2013. Objectives. Computer Systems Organization. Objectives. Objectives (continued) Introduction. INVITATION TO Computer Science 1

Chapter 5: Computer Systems Organization. Invitation to Computer Science, C++ Version, Third Edition

Chapter 5: Computer Systems Organization

A Review of Chapter 5 and. CSc 2010 Spring 2012 Instructor: Qian Hu

CMPUT 101 with Solutions Quiz 2 (50 minutes) November 7, 2003

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

5 Computer Organization

Computer Organization

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Computer Architecture 2/26/01 Lecture #

Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion. Arduino

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

Dec Hex Bin ORG ; ZERO. Introduction To Computing

A B C ((NOT A) AND B) OR C

Von Neumann Architecture

An Introduction to System Software and Virtual Machines

5 Computer Organization

CS 101, Mock Computer Architecture

Computer Architecture and Assembly Language. Spring

Information Science 1

Chapter One. Introduction to Computer System

CC411: Introduction To Microprocessors

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register

Machine Architecture. or what s in the box? Lectures 2 & 3. Prof Leslie Smith. ITNP23 - Autumn 2014 Lectures 2&3, Slide 1

Computer Organization

Computer Organization

Computer System Overview

COMPUTER ORGANISATION CHAPTER 1 BASIC STRUCTURE OF COMPUTERS

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

Unit objective. Unit Introduction UNIT - I. In this unit you will be introduced to :

COMPUTER STRUCTURE AND ORGANIZATION

BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

Summary of Computer Architecture

VON NEUMANN ARCHITECTURE. VON NEUMANN ARCHITECTURE IB DP Computer science Standard Level ICS3U

Chapter 7: Processor and Memory


Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

N.B. These pastpapers may rely on the knowledge gained from the previous chapters.

The Stored Program Computer

Computer Organization II CMSC 3833 Lecture 33

AS/A Level Computing Syllabus 2011

Diskrečioji matematika

Chapter 2 Data Manipulation

Introduction to Computers - Chapter 4

Show how to connect three Full Adders to implement a 3-bit ripple-carry adder

Introduction to CPU architecture using the M6800 microprocessor

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

Introduction to Microcontrollers

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

CHAPTER 2: HOW DOES THE COMPUTER REALLY WORK

THE MICROPROCESSOR Von Neumann s Architecture Model

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

Basic Computer Architecture

Outcomes. Lecture 13 - Introduction to the Central Processing Unit (CPU) Central Processing UNIT (CPU) or Processor

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

EE 3170 Microcontroller Applications

Data Manipulation. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

The Central Processing Unit

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Level 2: The Hardware World Chapters 4 and 5 (topics of other cs courses)

Computer Architecture COMP360

Why learn Computer Programming? Computer-based problem solving in Science and Engineering. Why learn Fortran? Elementary Computer Organization

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

COSC 122 Computer Fluency. Computer Organization. Dr. Ramon Lawrence University of British Columbia Okanagan

PESIT Bangalore South Campus

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

Computer Architecture Review CS 595

Digital System Design Using Verilog. - Processing Unit Design

Chapter 4 The Von Neumann Model

Systems Architecture

Introduction to Microprocessor

Chapter 4 The Von Neumann Model

PESIT Bangalore South Campus

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Computer Organization and Assembly Language (CS-506)


Processing Unit CS206T

1. True or False? For tasks like Web surfing, sufficient memory can make up for a slow processor.

Teaching London Computing

Machine code. Nils Jansen December 12, 2017

Introduction to Computer Engineering. CS/ECE 252 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin Madison

SAE5C Computer Organization and Architecture. Unit : I - V

Chapter 2 COMPUTER SYSTEM HARDWARE

Microcontroller Systems

INTRODUCTION TO COMPUTERS

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

Wednesday, September 13, Chapter 4

Transcription:

7KH9RQ1HXPDQQ$UFKLWHFWXUH Chapter 5.1-5.2 Von Neumann Architecture 'HVLJQLQJ&RPSXWHUV All computers more or less based on the same basic design, the Von Neumann Architecture! CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 2 7KH9RQ1HXPDQQ$UFKLWHFWXUH Model for designing and building computers, based on the following three characteristics: 1) The computer consists of four main sub-systems: Memory ALU (Arithmetic/Logic Unit) Control Unit Input/Output System (I/O) 2) Program is stored in memory during execution. 3) Program instructions are executed sequentially. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 3 Chapter 5 The Von Neumann Architecture 1

7KH9RQ1HXPDQQ$UFKLWHFWXUH Bus Memory Processor (CPU) Control Unit Input-Output Store data and program Execute program ALU Do arithmetic/logic operations requested by program Communicate with "outside world", e.g. Screen Keyboard Storage devices... CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 4 0HPRU\6XEV\VWHP Memory, also called RAM (Random Access Memory), Consists of many memory cells (storage units) of a fixed size. Each cell has an address associated with it: 0, 1, All accesses to memory are to a specified address. A cell is the minimum unit of access (fetch/store a complete cell). The time it takes to fetch/store a cell is the same for all cells. When the computer is running, both Program Data (variables) are stored in the memory. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 5 5$0 Need to distinguish between the address of a memory cell and the content of a memory cell Memory width (W): How many bits is each memory cell, typically one byte (=8 bits) Address width (N): How many bits used to represent each address, determines the maximum memory size = address space If address width is N-bits, then address space is 2 N (0,1,...,2 N -1) CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 6 0 1 2 2 N -1 N 0000000000000001... W 1 bit 2 N Chapter 5 The Von Neumann Architecture 2

0HPRU\6L]H6SHHG Typical memory in a personal computer (PC): 64MB - 256MB Memory sizes: Kilobyte (KB) = 2 10 = 1,024 bytes ~ 1 thousand Megabyte(MB) = 2 20 = 1,048,576 bytes ~ 1 million Gigabyte (GB) = 2 30 = 1,073,741,824 bytes ~ 1 billion Memory Access Time (read from/ write to memory) 50-75 nanoseconds (1 nsec. = 0.000000001 sec.) RAM is volatile (can only store when power is on) relatively expensive CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 7 2SHUDWLRQVRQ0HPRU\ Fetch (address): Fetch a copy of the content of memory cell with the specified address. Non-destructive, copies value in memory cell. Store (address, value): Store the specified value into the memory cell specified by address. Destructive, overwrites the previous value of the memory cell. The memory system is interfaced via: Memory Address Register (MAR) Memory Data Register (MDR) Fetch/Store signal CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 8 6WUXFWXUHRIWKH0HPRU\6XEV\VWHP MAR Memory decoder circuit F/S... MDR Fetch/Store controller Fetch(address) Load address into MAR. Decode the address in MAR. Copy the content of memory cell with specified address into MDR. Store(address, value) Load the address into MAR. Load the value into MDR. Decode the address in MAR Copy the content of MDR into memory cell with the specified address. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 9 Chapter 5 The Von Neumann Architecture 3

,QSXW2XWSXW6XEV\VWHP Handles devices that allow the computer system to: Communicate and interact with the outside world Screen, keyboard, printer,... Store information (mass-storage) Hard-drives, floppies, CD, tapes, Mass-Storage Device Access Methods: Direct Access Storage Devices (DASDs) Hard-drives, floppy-disks, CD-ROMs,... Sequential Access Storage Devices (SASDs) Tapes (for example, used as backup devices) CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 10,2&RQWUROOHUV Speed of I/O devices is slow compared to RAM RAM ~ 50 nsec. Hard-Drive ~ 10msec. = (10,000,000 nsec) Solution: I/O Controller, a special purpose processor: Has a small memory buffer, and a control logic to control I/O device (e.g. move disk arm). Sends an interrupt signal to CPU when done read/write. Data transferred between RAM and memory buffer. Processor free to do something else while I/O controller reads/writes data from/to device into I/O buffer. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 11 6WUXFWXUHRIWKH,26XEV\VWHP Interrupt signal (to processor) Data from/to memory I/O controller I/O Buffer Control/Logic I/O device CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 12 Chapter 5 The Von Neumann Architecture 4

7KH$/86XEV\VWHP The ALU (Arithmetic/Logic Unit) performs mathematical operations (+, -, x, /, ) logic operations (=, <, >, and, or, not,...) In today's computers integrated into the CPU Consists of: Circuits to do the arithmetic/logic operations. Registers (fast storage units) to store intermediate computational results. Bus that connects the two. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 13 6WUXFWXUHRIWKH$/8 Registers: Very fast local memory cells, that store operands of operations and intermediate results. CCR (condition code register), a special purpose register that stores the result of <, =, > operations ALU circuitry: Contains an array of circuits to do mathematical/logic operations. Bus: Data path interconnecting the registers to the ALU circuitry. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 14 R0 R1 R2 Rn ALU circuitry GT EQ LT 7KH&RQWURO8QLW Program is stored in memory as machine language instructions, in binary The task of the control unit is to execute programs by repeatedly: Fetch from memory the next instruction to be executed. Decode it, that is, determine what is to be done. Execute it by issuing the appropriate signals to the ALU, memory, and I/O subsystems. Continues until the HALT instruction CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 15 Chapter 5 The Von Neumann Architecture 5

0DFKLQH/DQJXDJH,QVWUXFWLRQV A machine language instruction consists of: Operation code, telling which operation to perform Address field(s), telling the memory addresses of the values on which the operation works. Example: ADD X, Y (Add content of memory locations X and Y, and store back in memory location Y). Assume: opcode for ADD is 9, and addresses X=99, Y=100 Opcode (8 bits) Address 1 (16 bits) Address 2 (16 bits) 00001001 0000000001100011 0000000001100100 CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 16,QVWUXFWLRQ6HW'HVLJQ Two different approaches: Reduced Instruction Set Computers (RISC) Instruction set as small and simple as possible. Minimizes amount of circuitry --> faster computers Complex Instruction Set Computers (CISC) More instructions, many very complex Each instruction can do more work, but require more circuitry. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 17 7\SLFDO0DFKLQH,QVWUXFWLRQV Notation: We use X, Y, Z to denote RAM cells Assume only one register R (for simplicity) Use English-like descriptions (should be binary) Data Transfer Instructions LOAD X Load content of memory location X to R STORE X Load content of R to memory location X MOVE X, Y Copy content of memory location X to loc. Y (not absolutely necessary) CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 18 Chapter 5 The Von Neumann Architecture 6

0DFKLQH,QVWUXFWLRQVFRQW Arithmetic ADD X, Y, Z CON(Z) = CON(X) + CON(Y) ADD X, Y CON(Y) = CON(X) + CON(Y) ADD X R = CON(X) + R similar instructions for other operators, e.g. SUBTR,OR,... Compare COMPARE X, Y Compare the content of memory cell X to the content of memory cell Y and set the condition codes (CCR) accordingly. E.g. If CON(X) = R then set EQ=1, GT=0, LT=0 CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 19 0DFKLQH,QVWUXFWLRQVFRQW Branch JUMP X Load next instruction from memory loc. X JUMPGT X Load next instruction from memory loc. X only if GT flag in CCR is set, otherwise load statement from next sequence loc. as usual. JUMPEQ, JUMPLT, JUMPGE, JUMPLE,JUMPNEQ Control HALT Stop program execution. CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 20 ([DPSOH Pseudo-code: Set A to B + C Assuming variable: A stored in memory cell 100, B stored in memory cell 150, C stored in memory cell 151 Machine language (really in binary) LOAD 150 ADD 151 STORE 100 or (ADD 150, 151, 100) CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 21 Chapter 5 The Von Neumann Architecture 7

6WUXFWXUHRIWKH&RQWURO8QLW PC (Program Counter): stores the address of next instruction to fetch IR (Instruction Register): stores the instruction fetched from memory Instruction Decoder: Decodes instruction and activates necessary circuitry PC IR +1 Instruction Decoder CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 22 von Neumann Architecture CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 23 +RZGRHVWKLVDOOZRUNWRJHWKHU" Program Execution: PC is set to the address where the first program instruction is stored in memory. Repeat until HALT instruction or fatal error Fetch instruction Decode instruction Execute instruction End of loop CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 24 Chapter 5 The Von Neumann Architecture 8

3URJUDP([HFXWLRQFRQW Fetch phase PC --> MAR (put address in PC into MAR) Fetch signal (signal memory to fetch value into MDR) MDR --> IR (move value to Instruction Register) PC + 1 --> PC (Increase address in program counter) Decode Phase IR -> Instruction decoder (decode instruction in IR) Instruction decoder will then generate the signals to activate the circuitry to carry out the instruction CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 25 3URJUDP([HFXWLRQFRQW Execute Phase Differs from one instruction to the next. Example: LOAD X (load value in addr. X into register) IR_address -> MAR Fetch signal MDR --> R ADD X left as an exercise CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 26,QVWUXFWLRQ6HWIRU2XU9RQ1HXPDQQ0DFKLQH Opcode 0000 0001 0010 0011 0100 0101 0101 0111 1000 1001... 1101 1110 1111 Operation LOAD X STORE X CLEAR X ADD X INCREMENT X SUBTRACT X DECREMENT X COMPARE X JUMP X JUMPGT X JUMPxx X IN X OUT X HALT Meaning CON(X) --> R R --> CON(X) 0 --> CON(X) R + CON(X) --> R CON(X) + 1 --> CON(X) R - CON(X) --> R CON(X) - 1 --> CON(X) If CON(X) > R then GT = 1 else 0 If CON(X) = R then EQ = 1 else 0 If CON(X) < R then LT = 1 else 0 Get next instruction from memory location X Get next instruction from memory loc. X if GT=1 xx = LT / EQ / NEQ Input an integer value and store in X Output, in decimal notation, content of mem. loc. X Stop program execution CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 27 Chapter 5 The Von Neumann Architecture 9