COMP 1321 Digital Infrastructure Richard Henson University of Worcester October 2012
Week 2: CPUs and Motherboards
Problem for Processor design n n Data needs to be stored n n Memory consists of ‘cells’ (effectively switches) Recorded digitally » »either a “0” or a “1” » »no middle way
Binary Numbers n n Base 2… based on 0 and 1 n n To represent binary, need “on/off” switches mechanical… too slow electronic… Ok if fast enough » »early electronic switches large and needed a lot of energy » »Head of IBM (1950s) said that the world needed only four of these computers anyway (!) » »use of transistors made the computer more widespread
Number Theory: decimal representation of 2,314 bracket form: (2 x 10 3 ) + (3 x 10 2 ) + (1 x 10 1 ) + (4 x10 0 ) most significant digit 2 least significant digit ThousandsHundredsTensunits 10x10x1010x
Some definitions… n n binary digit bit 0 or 1 n n byte: a group of 8 bits n n (nibble: a group of 4 bits) n n word: a group of bits of a fixed length (actual length of a word is rather arbitrary)
Binary representation of the four bit word x2x22x bracket form: (1 x 2 3 ) + (1 x 2 2 ) + (0 x 2 1 ) + (1 x2 0 ) = 13 in denary (decimal)
Binary representation of the 8 bit word = 181 Q. How many different binary numbers can an 8 bit word hold? A. 256 (= 2 8 ) ranging from to
The 16 bit number n n (a) To what decimal number is it equal? n n (b) What is the value of the most significant bit? n n (c) How many different 16 bit binary numbers can be represented?
The 16 bit number n n (a) To what decimal number is it equal? Answer: = 53 n n (b) What is the value of the most significant bit? Answer: 0 n n (c) How many different 16 bit binary numbers can be represented? Answer: 2 16 = (which is 64 k)
Shorthand n n Rows of 1s and 0s can be very confusing n n Easy to make mistakes n n Solution: divide into blocks of 4 digits use the decimal numbers corresponding to each block n n Problem: confusion with 10 or more n n Solution: use letters for 10 to 15
Hexadecimal notation DecimalBinaryHexadecimal
Hexadecimal notation DecimalBinaryHexadecimal A B C D E F
Notation n n Useful to know what type of number we are dealing with e.g. “110” use subscript at the end = 110 (denary) = 110 (binary) = 6 (denary) 110 H or = 110 (hexadecimal) = 272 (denary) n n So now you know!
Now, let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc Itanium 2 McKinley
CPU Memory Keyboard VDU Computer Program (Code) 1 do this… 2 do that 3 now this 4 goto 1 Plus Data… CPU with INPUT & OUTPUT
Pentium Data Cache Code Cache Instruction Fetch Instruction Decode Execution Unit
Minimalist CPU What is needed to build a CPU? “Execution Unit” ALU (Arithmetic Logic Unit) Memory (to store intermediate data) Input Output A Good Name !
Arithmetic Logic Unit Input AInput B Output ALU (or Integer Execution Unit) 5 32 add 1 32 sub
5 32 add Processing Idea Nr. 1 Move data from memory Move data into memory Memory DRAM, Hard Disk.. Move data in and out of data memory store
5 32 add Processing Idea Nr.2 IP (Code Memory) mov 3 in from memory mov 2 in from memory add the two numbers mov the result to memory Instruction Memory Program Move instructions into CPU from code memory
Registers Registers are high-speed memory on the CPU chip Parking places for data on the move AX and BX are used for ALU operations MAR is memory address register, here 4. So result, 6+8=14 will go into memory cell address 4 AX BX MAR
ip Data Memory Instruction Memory mar Our computer so far …
Instruction Memory A couple of extra bits Data Memory Instruction Register Memory Data Register Data Address add ax,bx 1.Line of code goes in 2.Electrical bit signals come out Energize ax Energize bx Select ALU “add"
Moving data into Registers Instruction Memory mar 3 4 mov ax, [1] BX AX mov ax, [1] mov bx, [2] 7 For example …
Moving data into Memory Instruction Memory mar 3 4 mov [3], ax BX AX mov [3], ax mov [0], bx 7 For example … 8 7
Adding Numbers Instruction Memory mar 3 4 add ax, bx BX AX Add ax,bx 7 For example … … this means ‘ add ax to bx, put the answer in ax’
So THAT’S how it works! Next week: the programming!