Copyright Suzanne Tomlinson and Curt Hill 1 CPU The Central Processing Unit
Copyright Suzanne Tomlinson and Curt Hill 2 Computer Diagram Bus Memory Peripheral Storage Disk Tape CD/DVD Network HCI Keyboard Display Pointers Cache CPU
Copyright Suzanne Tomlinson and Curt Hill 3 How the Pieces Connect n The CPU connects to all other pieces of the computer through the Bus n Memory is short term storage n Peripherals (such as disk) are used for long term storage n The bus is a group of communication lines between the CPU and other pieces
Copyright Suzanne Tomlinson and Curt Hill 4 CPU and Cache n The CPU has increased in speed much faster than anything else n The cache is a short term memory that keeps recently used items n It keeps the CPU busy and off the bus
Copyright Suzanne Tomlinson and Curt Hill 5 Two Principal Sections of CPU n Arithmetic/Logic Unit –Performs arithmetic (addition, subtraction, multiplication and division) –Compares two items of data to determine if equal, or which is larger (works on numbers or letters) called a logic operation n Control Unit –Directs the flow of electronic traffic (coordinates computer's operation)
Copyright Suzanne Tomlinson and Curt Hill 6 Control Unit n Controls ALU and Memory n Fetches and decodes instructions n Directs data transfers n Has the ALU do operations n Contains two important registers: –Program Counter (PC) –Instruction Register (IR)
Copyright Suzanne Tomlinson and Curt Hill 7 Registers n Special temporary storage locations that act as high-speed staging (loading) areas n Part of the CPU, not main memory n Usually under direction of the control unit n Several types are available n Each has a different purpose n Some are accessible to programmer
Copyright Suzanne Tomlinson and Curt Hill 8 CPU Control Unit Registers Arithmetic Logic Unit Registers
Copyright Suzanne Tomlinson and Curt Hill 9 Register Types n Program Counter n Instruction Register n Status n Accumulator n Address n Segment n Index n General purpose n Stack Pointer n Floating point
Copyright Suzanne Tomlinson and Curt Hill 10 The IBM 360/370 n 16 General Purpose 32 bit –All integer arithmetic –Indexing (except R0) –Even/Odd pairs for 64 bit n Program Status Word –Program counter and status register n 8 Floating point registers n Lots of inaccessible registers
Copyright Suzanne Tomlinson and Curt Hill 11 Intel 8080 n An 8 bit processor with 16 bit address space (64K) –Itself an extension of 8008 and 4040 n Four 16 bit registers each partitioned into a High and Low 8 bit n AX (AL and AH) does most of arithmetic n BX is the Base register n CX is Count register n DX is Data register –Connects to AX for double length n Stack Pointer
Copyright Suzanne Tomlinson and Curt Hill 12 Intel 8086 n Four 16 bit general purpose (AX-DX) –AX evolved from accumulator n Pointer and index –Stack Pointer (SP) –Base Pointer (BP) –Source Index (SI) n Segment –Code Segment –Stack Segment –Data Segment –Extra Segment
Copyright Suzanne Tomlinson and Curt Hill Segments Code Segment Data Segment Stack Segment Stack Pointer Code Data Stack 1 M 64K
Copyright Suzanne Tomlinson and Curt Hill 14 Intel through Pentiums n Serious attempt to maintain upward compatibility –Each model adds capabilities n Register sizes increase to 32 bit n AX becomes low order 16 bits of the 32 bit EAX n The maximum addressable memory increases n Virtual memory has hardware support
Copyright Suzanne Tomlinson and Curt Hill 15 Memory n Also called "main memory" or Primary (internal) storage n Closely associated with CPU but physically separated n Holds or stores –Data and program instructions awaiting processing –Intermediate results –Processed output (ready to be transmitted to secondary storage or output device
Copyright Suzanne Tomlinson and Curt Hill 16 Memory Characteristics n Volatile –Loses value when power is removed n Has no history –Only the last value is retained n Always has a value –May be unknown n Each cell has a numbered address
Copyright Suzanne Tomlinson and Curt Hill 17 How can a piece of data be retrieved from memory? n Control Unit finds instructions or data by the use of addresses n n Analogy - departmental mail boxes –Two things to note »One item only may be stored »Addresses are always numbers n n Tells where stored
Copyright Suzanne Tomlinson and Curt Hill 18 Memory Commands n Memory interprets two commands: –Read and Write n Read requires an address –Returns the contents n Write requires an address and a value –Changes the address to contain the value n Unit is one byte (8 bits) –Several units may be ganged together –2, 4, 8 bytes
Copyright Suzanne Tomlinson and Curt Hill 19 Memory Example
Copyright Suzanne Tomlinson and Curt Hill 20 Memory n Short term storage of data occurs here n All data must be represented in memory n The organization of memory determines the data representation
Copyright Suzanne Tomlinson and Curt Hill 21 Data Representation n Binary - number system with two states –Two states (On or Off) n Bits (BInary digiTS) each 0 or 1 n Organization (small to large) –Bit (individual 1 or 0) –Byte (made up of 7 or 8 bits and represents a character) –Word (how much a computer can handle at one time - multiple bytes)
Copyright Suzanne Tomlinson and Curt Hill 22 Byte n Represents a single character of data n 7 or 8 bits (depending on code) n Used to indicate machines' storage capacity –Kilobyte (KB) - equal to 1024 bytes –Megabyte (MB) - equals bytes = 1,048,576 –Gigabyte (GB) - equals bytes –Terabyte (TB) - equals bytes –Petabyte (PB) - equals bytes
Copyright Suzanne Tomlinson and Curt Hill 23 Word n The number of bits that constitutes a common unit of data n Length varies by computer –Common word lengths »16 bits(micros, 286 and before) »32 bits(Pentiums, Power PC, mainframes) »64 bits(newer AMD micros, supercomputers)
Copyright Suzanne Tomlinson and Curt Hill 24 Digitization n Nothing can be processed by a computer unless it can be converted to digital representation n Graphics – pixels –Compression n Sounds – sampling n Music - MIDI n Characters – character codes
Copyright Suzanne Tomlinson and Curt Hill 25 Character Codes n Mechanism to represent character data numerically n BCD n EBCDIC n ASCII n UNICODE
Copyright Suzanne Tomlinson and Curt Hill 26 Machine Cycles n Series of operations involved in the execution of a single machine-level instruction n System clock - timing mechanism that governs transmission of instructions and data n Also known as Fetch-Execute Cycle n Made up of two parts: I-cycle and E-cycle n Microcode - mechanism to tailor the instruction set
Copyright Suzanne Tomlinson and Curt Hill 27 Fetch-Execute cycle: I- cycle n Take program counter and fetch next instruction from memory n Decode the particular instruction n Increment program counter to point at next instruction n Fetch operands n This part called I-cycle or I-time
Copyright Suzanne Tomlinson and Curt Hill 28 Fetch-Execute Cycle: E- cycle n Execute the instruction n Store results (if needed) n Go back to beginning and do it again n This is called the E-cycle or E-time
Copyright Suzanne Tomlinson and Curt Hill 29 Machine Instructions n Arithmetic n Comparison n Input and Output n Jumps
Copyright Suzanne Tomlinson and Curt Hill 30 Processing Speeds of cycle times n Milliseconds –Thousandths of a second n Microseconds –Millionths of a second n Nanoseconds –Billionths of a second n Picoseconds –Trillionths of a second
Copyright Suzanne Tomlinson and Curt Hill 31 Speed Ratings n Older micros rated in megahertz MHz –One MHz represents a million clock ticks per second »Original Apple ran at 1 MHz »Original IBM PC ran at 4.77 MHz –Today to 4500 »2000 MHz is 2 GHz n In mainframes rated in mips –One mip equals million instructions per second n In supercomputers rates in mflops –One mflop equals million floating-point operations per second
Copyright Suzanne Tomlinson and Curt Hill 32 Instruction Format n There are various components in each machine language instruction n Operation code –Defines which instruction n Operands –May be implied –Register –Immediate data –Memory location n Other things –Masks or flags –Lengths
Copyright Suzanne Tomlinson and Curt Hill 33 Instructions sizes n Instructions may be multiple sizes or single sizes n Single size –Easier to interpret –Wastes bits n Multiple sizes –More complicated CPU design –Better packing in memory