Module 5 Central Processing Unit 1. Binary representation of data 2. The components of the CPU 3. CPU and Instruction set 4. Important features of CPUs
2 Data representation All modern digital equipment work on binary digits, 0, 1, based on the two measurable/recogniable states: such as circuitry voltage, high voltage (ON): 1 Low voltage (Off) : 0 Why? Simple, reliable, and available technology The fundamental component made of silicon: Transister Logic gates AND, OR, NOT can be constructed from transistor
3 Data representation All modern digital equipment work on binary digits, i.e., 0, 1, based on the two states of a circuitry, e.g. High voltage (ON): 1 Low voltage (Off) : 0 Why? Simple, reliable, and available technology CPU can only understand 0 and 1 Data must be represented in binary form before it is processed by a CPU –How to representation number? Binary (base 2) number, containing only two digits, 0 and 1 –How to represent characters? English text for example
4 Binary number In decimal (base 10) we indicate place values by the order of digits –135 = (1*10 2 ) + (3*10 1 ) + (5*10 0 ) In binary only 0’s and 1’s exist we do the same thing but since we use only two digits the place values change. –10011 = (1*2 4 )+(0*2 3 )+(0*2 2 )+(1*2 1 )+(1*2 0 ) = = 19
5 Conversion between binary and decimal = (1x2 0 )+(1x2 1 )+(0x2 2 )+(1x2 3 ) = = 11 Decimal to binary: repeatedly divide the quote by 2, read the remainder backward = Read up = Read up 01
6 One binary digit can represents two numbers, 0, 1 Two binary digits can represent four numbers 00, 01, 10, Three binary digits can represent ___numbers Fixed length binary representation
7 Example of 4 binary digits numbers
8 Binary number facts BitsRange 80 to = to = to = to = It takes more digits to represent a number in binary than it does in decimal
9 Binary number operations Add, subtract, multiply, division Example of add _____ 10110
10 Binary representation for characters Coding schemes provide a common way of representing a character of data Common Schemes –ASCII, 7 bits –Stands for American Standard Code for Information Interchange –Most widely used standard –Used on virtually all personal computers
11 ASCII coding scheme 7 bits, 127 different symbols Examples Dec BinarySymbols : (colon) ; (semi-colon) < (less than) = (equal sign) > (greater than) ? (question mark) 064 (AT symbol) A A B B C C D D E E F F G G H H I I J J K K L L M M N N O O P P Q Q R R S S T T U U V V W W X X Y Y Z Z
12 Unicode Designed to accommodate alphabets of more than 256 characters Uses 16 bits to represent one character –65,536 possible values Requires twice as much space to store data
13 The unit of information Bit: short for binary digit –Two possible values: 0 and 1 –Can never be empty –Basic unit for storing data, information Byte: a group of 8 bits –Each byte has 256 (2 8 ) possible values –For text, stores one character Can be letter, digit, or special character –Memory and storage devices measured in number of bytes
14 Word Word is the number of bits the CPU processes as a unit. A word usually consists of several bytes. It is CPU dependent. The larger the word, the more powerful the computer. We say a 32 bits processor. Here 32 is the size of the word. It is equal to the size of a register. in length
15 The units for information storage sizes One kilobyte (1 KB) = 1024 (2 10 ) bytes = 2 13 bits –Memory capacity of older personal computers One Megabyte (1 MB) = 2 20 bytes ≈ 10 6 bytes (one million bytes) –Personal computer memory –Portable storage devices (diskette, CD-ROM) One gigabyte (1 GB) = 2 30 bytes ≈ 10 9 bytes (one billion bytes) –Storage devices (hard drives) –Mainframe and network server memory One terabyte (1 TB) = 2 40 bytes ≈ bytes (one trillion bytes) –Storage devices on very large systems
16 Central Processing Unit (CPU) Consists of complex set of electronic circuitry Executes stored program instructions Three components –Registers –Control unit –Arithmetic/Logic Unit (ALU) Control Unit ALU Registers Memory CPU
17 Registers Registers: temporary place for instructions and data. All instructions and data must be placed in registers before being executed and processed High-speed temporary storage areas –Storage locations located within the CPU Work under direction of control unit –Accept, hold, and transfer instructions or data –Keep track of where the next instruction to be executed or needed data is stored
18 Control unit Control unit: directs the computer system to execute stored program instructions Must communicate with memory and ALU Storage operations –Moving data/instructions from/to register to/from registers –Sends data and instructions from secondary storage to memory as needed
19 ALU Executes all arithmetic and logical operations –Arithmetic operations Addition, subtraction, multiplication, division –Logical operations Compare numbers, letters, or special characters Tests for one of three conditions –Equal-to condition, Less-than condition, Greater-than condition –Branch to different instructions
20 Memory Also known as primary storage and main memory –Often expressed as random-access memory (RAM) –Not part of the CPU Holds data and instructions for processing Stores information only as long as the program is in operation
21 The CPU and memory CPU cannot process data from disk or input device –It must first reside in memory –Control unit retrieves data from disk and moves it into memory Items sent to ALU for processing –Control unit sends items to ALU, then sends back to memory after processing Data and instructions held in memory until sent to an output or storage device or program is shut down
22 Data storage and the CPU Two types of storage: –Primary storage (memory) Stores data temporarily CPU refers to it for both program instructions and data –Secondary storage Long-term storage Stored on external medium, such as a disk
23 How the CPU executes instructions Four steps performed for each instruction –Machine cycle: the amount of time needed to execute an instruction –Personal computers execute in less than one millionth of a second –Supercomputers execute in less than one trillionth of a second Each CPU has its own instruction set –those instructions that CPU can understand and execute
24 The machine cycle The time required to retrieve, execute, and store an operation Components –Instruction time –Execution time System clock synchronizes operations
25 Instruction time Also called I-time Control unit gets instruction from memory and puts it into a register Control unit decodes instruction and determines the memory location of needed data
26 Execution time Control unit moves data from memory to registers in ALU –ALU executes instruction on the data Control unit stores result of operation in memory or in a register
27 Microprocessor Central processing unit etched on silicon chip Contain hundreds of millions of tiny transistors Key components: –ALU –Registers –Control unit –System clock
28 Transistors Electronic switches that may or may not allow electric current to pass through –If current passes through, switch is on, representing a 1 bit –Otherwise, switch is off, representing a 0 bit The size of a transistor –New technology makes the size of a transistor smaller and smaller! –Current: 0.13 micro meter or 130 nano meter Moving to 0.09 micro meter 90 nano meter Next a few years: 60 nano meters
29 Types of chips Intel makes a family of processors –Pentium III and Pentium4 processors in most PCs –Celeron processor sold for low-cost PCs –Xeon and Itanium for high-end workstations and network servers Other processors –Cyrix and AMD make Intel-compatible microprocessors –PowerPC chips used primarily in Macintosh computers –Compaq’s Alpha microprocessor used in high-end servers
30 Computer processing speeds Instruction speeds measured in fractions of seconds –Millisecond: one thousandth of a second –Microsecond: one millionth of a second –Nanosecond: one billionth of a second Modern computers have reached this speed –Picoseconds: one trillionth of a second
31 Microprocessor speeds Measure of system clock speed –How many electronic pulses the clock produces per second (clock frequency) –Usually expressed in frequency Gigahertz (GHz), Megahertz (MHz), Kilohertz (KHz) –Or how much time for each cycle: clock cycle time clock cycle time = 1 / clock frequency Second, millisecond, microsecond, nanosecond, picoseconds Comparison of clock speed only meaningful between identical microprocessors
32 Other performance measures Millions of Instructions per Second (MIPS) –High-speed personal computers can perform over 500 MIPS –Typically a more accurate measure of performance than clock speed Megaflop: one million floating-point operations –Measures ability of computer to perform complex mathematical operations
33 Cache A temporary storage area –Speeds up data transfer within computer Processor cache Control Unit ALU Registers Memory CPU Cache L1 Cache L2
34 Processor cache A small block of high-speed memory –Stores most frequently and most recently used data and instructions Microprocessor looks for what it needs in cache first –Transferred from cache much faster than from memory –If not in cache, control unit retrieves from memory The more cache “hits” the faster the system performance Internal (Level 1) cache built into microprocessor –Fastest access, but highest cost External (Level 2) cache on separate chip –Incorporated into processor on some current microprocessors