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

Similar documents
Computer Organization

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

Dec Hex Bin ORG ; ZERO. Introduction To Computing

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

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.

Homeschool Enrichment. The System Unit: Processing & Memory

CC411: Introduction To Microprocessors

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

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

Systems Architecture

Chapter 5: Computer Systems Organization

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

CS 101, Mock Computer Architecture

Computer Architecture 2/26/01 Lecture #

Chapter 2 Data Manipulation

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

The Central Processing Unit

5 Computer Organization

Chapter 1 : Introduction

machine cycle, the CPU: (a) Fetches an instruction, (b) Decodes the instruction, (c) Executes the instruction, and (d) Stores the result.

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

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

Computer Architecture Review. ICS332 - Spring 2016 Operating Systems

Information Science 1

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

CS 140 Introduction to Computing & Computer Technology. Computing Components

Computer Architecture (part 2)

5 Computer Organization

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

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

FACTFILE: GCE DIGITAL TECHNOLOGY

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

Computers Are Your Future

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

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

COMP2121: Microprocessors and Interfacing. Introduction to Microprocessors

Ms. Minerva A. Lagarde

2011 Francisco Delgadillo

7/28/ Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc.

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

CMPUT101 Introduction to Computing - Summer 2002

Chapter Two. Hardware Basics: Inside the Box

Computer Architecture and Assembly Language. Spring

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

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

Von Neumann Architecture

Knowledge Organiser. Computing. Year 10 Term 1 Hardware

MARIE: An Introduction to a Simple Computer

So computers can't think in the same way that people do. But what they do, they do excellently well and very, very fast.

Microcomputer Architecture and Programming

Technology in Action

Lecture 19: Computers. Pay no attention to the man behind the curtain.

Unit - II. Computer Concepts and C Programming 06CCP13. Unit II

Computer Architecture

What is the typical configuration of a computer sold today? 1-1

Computer Organization

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Chapter 7: Processor and Memory

Chapter 2 Logic Gates and Introduction to Computer Architecture

Computer Organization

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

CS1004: Intro to CS in Java, Spring 2005

Segment 1A. Introduction to Microcomputer and Microprocessor

Full file at

MARIE: An Introduction to a Simple Computer

Data Manipulation. *2.4 Arithmetic/Logic. Instructions. Logic Operations Rotation and Shift Operations Arithmetic Operations. *2.5 Communicating with

Computers Are Your Future

2/15/2008. Announcements. Programming. Instruction Execution Engines. Following Instructions. Instruction Execution Engines. Anatomy of a Computer

Chapter 4. MARIE: An Introduction to a Simple Computer

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

INTRODUCTION TO MICROPROCESSORS

Digital System Design Using Verilog. - Processing Unit Design

Computer Organization and Assembly Language (CS-506)

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

Hardware Level Organization

INTRODUCTION TO COMPUTERS

About the Presentations

CMSC 1513 Lecture 1.2

Introduction to Microcontrollers

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

Introduction. Computer System Organization. Languages, Levels, Virtual Machines. A multilevel machine. Sarjana Magister Program


BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

Introduction to Microprocessor

Chapter 4 The Components of the System Unit

CC312: Computer Organization

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY (ICT) LECTURE 2 : WEEK 2 CSC-111-T

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Computer Basics/Algorithms

Summary of Computer Architecture

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

von Neumann Architecture Basic Computer System Early Computers Microprocessor Reading Assignment An Introduction to Computer Architecture

Basic Computer System. von Neumann Architecture. Reading Assignment. An Introduction to Computer Architecture. EEL 4744C: Microprocessor Applications

THE MICROCOMPUTER SYSTEM CHAPTER - 2

Computer Systems Organization

EE 3170 Microcontroller Applications

Transcription:

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

Basic Machine Architecture In these lectures we aim to: understand the basic architecture of a simple computer. understand the components: CPU, Main Memory, I/O Controllers. understand concepts of stored program, machine cycle, memory mapped I/O. ITNP23 - Autumn 2014 Lectures 2&3, Slide 2

What is a computer? wikipedia A computer is a programmable machine that receives input, stores and manipulates data or information, and provides output in a useful format. While a computer can, in theory, be made out of almost anything, and mechanical examples of computers have existed through much of recorded human history, the first electronic computers were developed in the mid-20th century (1940 1945). http://www.youtube.com/watch?v=0aniyvgewoi&nr=1&feature=fvwp http://www.youtube.com/watch?v=kl_wy-cxbp8&feature=related ITNP23 - Autumn 2014 Lectures 2&3, Slide 3

Background: computers and digital hardware Digital computers consist of large number of gates AND, OR, NOT, NAND And other circuitry that (e.g.) generates digital signals Clocks, lines carrying data These all need switching circuitry And switching circuitry can be built from may different technologies. ITNP23 - Autumn 2014 4 Machine hardware: April 2016

Konrad Zuse s 1st computer 1941 Zuse (1910-1995) Built the Z3 in 1941 (inspecting rebuilt Z3 at Deutsches Museum, 1991) ITNP23 - Autumn 2014 5 Machine hardware: April 2016

IBM 7090 series: from 1959 For large scale scientific and technological applications $2.9 million (equivalent to $23 million now) 50,000 Germanium transistors 6x faster than IBM 709, much lower power consumption: world s most powerful computer in 1960 IBM7090, from1965: credit Australian news and information bureau ITNP23 - Autumn 2014 6 Machine hardware: April 2016

The era of the minicomputer Data General NOVA minicomputer, early 1970 s ITNP23 - Autumn 2014 7 Machine hardware: April 2016

Structure of a simple computer CPU Screen controller Control Unit ALU Bus Main Memory Registers Keyboard controller Disk controller ITNP23 - Autumn 2014 Lectures 2&3, Slide 8

Microcomputers, smartphones, The basic architecture of all of these is the same ITNP23 - Autumn 2014 Lectures 2&3, Slide 9

Basic architecture of a computer Memory unit contains both programs and data CPU runs the program by executing instructions using ALU. Conceptually, this is a von Neumann computer There are alternative designs, e.g. Harvard architecture: separate memory for data and instructions. ITNP23 - Autumn 2014 CSCU9A1: (c) LSS

Execution of a program A program is a sequence of instructions. A machine-code program is a sequence of machine-code instructions. To be executed, a machine-code program must be stored in main memory. Execution takes place within the CPU. Execution follows Fetch-Decode-Execute cycle ITNP23 - Autumn 2014 Lectures 2&3, Slide 11

The CPU The Central Processing Unit (CPU) is where the work takes place. It has three components: Control Unit organises the actions of the CPU, and sequences the actions of the other components to execute programs Arithmetic/Logic Unit (ALU) acts as a calculator, under the direction of the control unit. All data alteration takes placec in the ALU. Registers: individual high-speed storage locations, internal to the CPU, used to hold transient data. Some are dedicated for particular purposes, others are used as temporary stores during computations ITNP23 - Autumn 2014 Lectures 2&3, Slide 12

The CPU : control unit It is the task of the control unit to : 1. Fetch from memory the next instruction to be executed 2. Decode it, that is, determine what should be done 3. Execute it by issuing the appropriate command to the ALU, memory, and I/O Controllers These 3 steps are repeated over and over again until we reach the last instruction of a program (usually HALT, STOP, or QUIT). ITNP23 - Autumn 2014 Lectures 2&3, Slide 13

The Fetch-Execute Cycle ITNP23 - Autumn 2014 CSCU9A1: (c) LSS

The CPU : ALU The subsystem that performs such mathematical and logical operations as addition, subtraction, and comparison for equality. In modern machines, the ALU, control unit and registers are fully integrated into a single component called the processor. For reasons of clarity and convenience, the functions of each are described separately. ITNP23 - Autumn 2014 Lectures 2&3, Slide 15

Main Memory : RAM Main Memory is also called random-access memory (RAM) It traditionally has the following characteristics: It is divided into fixed-sized units called cells. Each cell is associated with a unique identifier called an address. Any location in the memory can be accessed very fast just by specifying the address of the location The time it takes to fetch or store a cell is the same for all cells in memory Programs (and data) are stored in main memory when they are running RAM is linked to CPU in such a way that data can be moved from one to the other very quickly ITNP23 - Autumn 2014 Lectures 2&3, Slide 16

Main Memory : ROM A small part of main memory is non-volatile, read-only memory (ROM) Simply RAM where the ability to store information has been disabled It is only possible to fetch information: it cannot be overwritten In most computers, a section of RAM is set aside as ROM to store essential system instructions which the user cannot overwrite ITNP23 - Autumn 2014 Lectures 2&3, Slide 17

Buses Buses: Each bus consists of several signal wires, so a large number of bits (perhaps 64 bits or more) can be sent simultaneously between the components, making communication between them very fast CPU Screen controller Control Unit ALU Bus Main Memory Registers Keyboard controller Disk controller ITNP23 - Autumn 2014 Lectures 2&3, Slide 18

I/O controllers CPU Screen controller Control Unit ALU Bus Main Memory Registers Keyboard controller Disk controller ITNP23 - Autumn 2014 Lectures 2&3, Slide 19

I/O controllers Input and output operations are slow in comparison with computations done in the CPU Communication with a peripheral is done via a special hardware controller. This can be nearly as complex as the CPU. An I/O controller is like a special-purpose computer with a responsibility to handle the details of input/output, and to compensate for any speed differences between I/O devices and other parts of the computer. It has a small amount of memory known as an I/O buffer and enough I/O control and logic processing capability to handle mechanical functions of the I/O device, such as the read/write head (on a disk), paper feed mechanism (on a printer), and screen display. It is also able to transmit an interrupt signal (see later) when an I/O operation is complete. ITNP23 - Autumn 2014 Lectures 2&3, Slide 20

I/O example: display 1 line of text on a display 1. Transfer the 80 characters from their current location in memory to the I/O buffer storage within the I/O controller (takes place at high speed ~ 10s or 100s of millions of chars per second) 2. The processor then instructs the I/O controller to begin the output operation. 3. The control logic of the I/O controller handles the actual transfer of the 80 chars to the screen (this takes place perhaps at a much slower rate ~100s /1000s of chars per second, depending on the display type) Note that the processor continues to execute instructions while this is going on 4. When all 80 characters have been displayed, the I/O controller sends an interrupt signal to the processor 5. The appearance of this special signal indicates to the processor that the I/O operation is complete. ITNP23 - Autumn 2014 Lectures 2&3, Slide 21

Machine Instruction Set Each type of processor (e.g., Core i7, PowerPC, ARM) has a repertoire of instructions that the CPU is built to recognise and execute This is the instruction-set of the processor A program that is expressed in this instruction-set is in machine code In the first days of computers, programmers wrote in machine code (because there wasn t anything else) Now, we write programs in languages that other programs translate into machine code ITNP23 - Autumn 2014 Lectures 2&3, Slide 22

Machine Code Machine code is binary code not readable by people (without extreme difficulty or training) very readable by machines Binary literally only 1s and 0s like 11100111100000011110010111110000 Internally held as a pattern of voltages representing 1 s and 0 s ITNP23 - Autumn 2014 Lectures 2&3, Slide 23

Machine Code Instructions Instructions in this language have a typical format: operation code field (or op code) address field (s) Operation code: A unique number assigned to each machine language operation recognised by the hardware Address field (s): Memory addresses of the values on which the operation will work Machine code (lines of numbers!) is very hard to read, so instead programmers use a set of mnemonics called assembly language to represent the numerical instructions. ITNP23 - Autumn 2014 Lectures 2&3, Slide 24

Assembly language instructions Some examples from the Intel 8021 instruction set: MOV A, 4 Copy contents of memory location 4 to register A DEC A Take away 1 from (decrement) the contents of register A MOV B, A Copy contents of register A to register B ADD A, B Add contents of register B to register A MOV 4, A Copy contents of register A to memory location 4 Example Let s try this out with the following values: A : initial value 2 B : initial value 4 Memory location 4: initial value 3 In a modern programming language this could be written as x = (x-1)*2! ITNP23 - Autumn 2014 Lectures 2&3, Slide 25

Running a Program Each processor (of any type) has two special registers: The Program Counter (PC): this holds the address in memory of the next instruction to be obeyed The Instruction Register (IR): holds the instruction currently being obeyed At the dawn of time (when your computer is switched on) There is a program sitting in memory, starting at some location in RAM (or ROM, at the dawn of time) The address of this location (probably zero, at the dawn of time) is in the PC The control unit starts the machine cycle (see later) and the machine executes the program (ditto) At the dawn of time, this program will be the bootstrap (it loads the operating system program from disk to memory when you start up your computer), but as the machine continues, the programs will be user programs ITNP23 - Autumn 2014 Lectures 2&3, Slide 26

The Machine Cycle Also known as the fetch/decode/execute cycle Also known as the Von Neumann cycle (see later slide for further information). The processor (all types) endlessly executes the following loop Repeat Fetch instruction from location in PC Increment PC by instruction length Decode instruction Execute instruction The point of the Increment step: the next time round the cycle it fetches the next instruction in the program The machine (unless it s switched off) is always executing this loop (even if apparently idle) It does it at a fixed rate: the clock speed When we say a processor is running at (say) 3 GHz, we mean it executes the cycle 3,000,000,000 times a second... or faster with later versions! ITNP23 - Autumn 2014 Lectures 2&3, Slide 27

Fetch->Decode->Execute a little more detail Each instruction is executed in a number of small steps: 1. Fetch the next instruction from memory into the Instruction Register 2. Change the Program Counter to point to the next instruction 3. Decode the current instruction 4. If the instruction uses a word in memory, determine where it is 5. Fetch the word (in a CPU register if needed) 6. Execute the instruction and repeat until the instruction is Halt 3 Control Unit ALU 6 Instruction Register Program Counter Register Register Register 5 1 4 2 M e m o r y ITNP23 - Autumn 2014 Lectures 2&3, Slide 28

Running Programs So, to run a program: we arrange that its instructions are in contiguous locations in memory place the start address in the PC. stand clear! ITNP23 - Autumn 2014 Lectures 2&3, Slide 29

Machine Cycle Example Here is a snapshot of the state of a simple computer showing the contents of main memory. Trace the execution of the program stored in the main memory. At each step, show the contents of main memory and of all registers used in executing this program. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 MOV A 34 DEC A MOV B A ADD A B MOV 34 A 16 32 4 ITNP23 - Autumn 2014 Lectures 2&3, Slide 30

von Neumann In 1946 he proposed a radically different computer design based on a model called the stored program computer. Until then, all computers were programmed externally using wires, connectors, and plugboards. The memory unit stored only data, not instructions. To solve a different problem on these computers, the user had to rewire virtually the entire machine. For example, the plugboards contained 6000 different switches, and reprogramming involved specifying the new settings for all these switches. Von Neumann proposed that the instructions that control the operation of the computer be encoded as binary values and stored internally in memory along with the data. Now to solve a different problem you would simply rewrite the sequence of instructions, that is, create a new program. Von Neumann invented programming as it is today! ITNP23 - Autumn 2014 Lectures 2&3, Slide 31

Clock Speed versus Instruction Rate Clock speed: Measured in either millions of cycles per second (megahertz (MHz)) or billions of cycles per second (gigahertz (GHz)) The actions of every computer are controlled by a central clock, and the tick rate of this clock is one possible speed measure. Typical clock speeds of today s computers - from 500MHz through to 2-3 GHz but this figure can be misleading as a machine s capability is also how much work it can do between ticks, not just how fast it ticks. Machine Speed Instruction Rate:..is a better measure than clock speed alone It s measured in MIPS (millions of instructions per second) measures how many machine language instructions can be fetched, decoded, and executed in one second. ITNP23 - Autumn 2014 Lectures 2&3, Slide 32

Cache - 1 Not included in our machine architecture diagram, but certainly plays a part in program execution. It is located on or near the processor. Computer designers observed that when a program fetches a piece of data or instruction, there is a high likelihood that: 1. It will access that same instruction or piece of data in the very near future 2. It will likely access the instructions or data that are located near this one. This is known as the principle of locality. ITNP23 - Autumn 2014 Lectures 2&3, Slide 33

Cache - 2 To exploit this, when the computer references a piece of data, it should move the data from RAM to cache. It should also move data in the memory cells located near this item into cache. Cache memory is typically 10 times faster than RAM, but is much smaller (100s of Kilobytes of storage, rather than 100s or Megabytes or Gigabytes.. See later for more on bytes) ITNP23 - Autumn 2014 Lectures 2&3, Slide 34

Cache - 3 When the computer needs a piece of information, it does the following: 1. Looks first in cache to see if the information is there. 2. If it is not, then access the information in RAM 3. Copy the data just fetched into cache along with the k immediately following memory locations. If the cache is full, discard some of the older items that have not been accessed recently. A good analogy to cache is a fridge! Without one, we d have to go to the supermarket every time we needed an item (that usually requires cool storage). With a fridge, we can store food for now, and food we will need in the immediate future, reducing trips to the supermarket (Schneider & Gersting, 2004) Cache size on CPUs and devices (e.g. hard drives) can have a large impact on speed ITNP23 - Autumn 2014 Lectures 2&3, Slide 35

Summary we have discussed the structure of a simple computer its basic components (CPU, Main Memory, I/O controllers) its operation (stored program concept, program execution). ITNP23 - Autumn 2014 Lectures 2&3, Slide 36

end of lecture ITNP23 - Autumn 2014 Lectures 2&3, Slide 37