Download presentation
Presentation is loading. Please wait.
Published byNatalie Harrison Modified over 9 years ago
1
COMP 1321 Digital Infrastructure Richard Henson University of Worcester October 2015
2
Week 2: Binary Numbers and CPUs n n Objectives: Explain the CPU as the fundamental part of the computer Explain why binary numbers are fundamental to computing Convert between binary and hexadecimal numbers Explain the structure of typical CPU
3
Origins of the CPU n All about processing data n Also needs a mechanism for adding data (input) removing processed data (output) storing data outside the CPU n In early days (e.g. Bletchley Park) data input, output, movement, storage all paper-based… very slow!
4
Binary Numbers n n Base 2… based on 0 and 1 perfect fit with Boole & logic states n n To represent binary in real world need “on/off” switches mechanical… slow but gotta start somewhere…
5
Electrical Storage of Binary? n Possible using: Relays »on – magnet has current/off – magnet no current binary numbers »relay off = 0 »relay on = 1
6
Shannon & Relays n 1938: first scientist to use Boolean Logic with relays: on/off 1/0 realised binary numbers could replace decimal numbers & represent real data values n Figured that relays could be wired together to create logic gates and do Boolean Algebra (!) n Problem… relays slow
7
A Fast Switch Electronic… » »called valves, but actually glass tubes » »Air taken out; near vacuum » »needed a lot of energy to work » »took up lots of space But it was fast, and it did work… » »Head of IBM (1950s) said that the world needed only four of these computers anyway (!)
8
More from Shannon (1948) n Demonstrated the essential unity of all information media: text telephone signals radio waves pictures, film, etc… n All could be encoded in the universal language of binary digits used “bits” to describe them
9
Binary Logic and CPU Design n n Data stored as blocks of ‘cells’ (effectively switches) voltage off/on » »in binary either “0” or “1” n n If memory and data are binary… so must the processing!
10
Number Systems n Number of different items… “base” of number system n Examples: base 2: binary (2 items) base 10: decimal (10 items) base 16: hexadecimal (16)
11
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 4 2314 ThousandsHundredsTensunits 10x10x1010x10101 10 3 10 2 10 1 10 0
12
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)
13
Binary representation of the four bit word 1101 1 1 01 2x2x22x2 21 2 3 2 2 2 1 2 0 bracket form: (1 x 2 3 ) + (1 x 2 2 ) + (0 x 2 1 ) + (1 x2 0 ) 8 + 4 + 0 + 1 = 13 in denary (decimal)
14
Binary representation of the 8 bit word 1011 0101 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 10110101 128 + 0 + 32 + 16 + 0 + 4+ 0 + 1 = 181 Q. How many different binary numbers can an 8 bit word hold? A. 256 (= 2 8 ) ranging from 0000 0000 to 1111 1111
15
The 16 bit number 0000 0000 0011 0101 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?
16
The 16 bit number 0000 0000 0011 0101 n n (a) To what decimal number is it equal? Answer: 32 + 16 + 0 + 4 + 0 + 1 = 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 = 65536 (which is 64 k)
17
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
18
Hexadecimal notation DecimalBinaryHexadecimal 000000 100011 200102 300113 401004 501015 601106 701117 810008 910019
19
Hexadecimal notation DecimalBinaryHexadecimal 101010A 111011B 121100C 131101D 141110E 151111F
20
Notation n n Useful to know what type of number we are dealing with e.g. “110” use subscript at the end 110 10 = 110 (denary) 110 2 = 110 (binary) = 6 (denary) 110 H or 110 16 = 110 (hexadecimal) = 272 (denary) n n So now you know!
21
Binary Logic & the CPU n Binary logic + Boolean algebra logic gates mathematically predictable effects of combining them documented as truth tables n Problem: valves wired together produce pretty large, energy hungry logic gates: »CPU would be very large & use a lot of energy!
22
Hey Presto… the Transistor n Same effect as valves n much smaller n use much less energy n Wonderful discovery n must have been very exciting for Shannon n computers could be much smaller than he expected http://www.technologyreview.com/featuredstory/4011 12/claude-shannon-reluctant-father-of-the-digital-age
23
Miniaturisation n Transistors first used in radios very popular with “teenagers” n Took some time to become part of more sophisticated devices breakthrough: integrated circuits (ICs) many transistors on a single component first IC with enough transistors to be a CPU with programmed instructions… Intel (1972)
24
Now, let’s make a Computer … or at least the CPU (millions of transistors) Pentium 4 Opteron Ultra Sparc 1 21364 Itanium 2 McKinley
26
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
27
Pentium Data Cache Code Cache Instruction Fetch Instruction Decode Execution Unit
28
Minimalist CPU What do I need to build a CPU? “Execution Unit” ALU (Arithmetic Logic Unit) Memory (to store intermediate data)) Input Output A Good Name! Intel’s first was called… “4004”… because it had a 4-bit bus!
29
Arithmetic Logic Unit (ALU) Input AInput B Output (or… more sophisticated… Integer Execution Unit) 5 32 add 1 32 sub How could these numbers be represented as data that passes into the ALU?
30
5 32 add 0 1 2 3 4 3 2 5 Processing Idea Nr. 1 Move data from memory Move data into memory 3. 2. 1. Memory DRAM, Hard Disk.. Move data in and out of data memory store
31
5 32 add 0 1 2 3 4 3 2 5 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
32
Registers 0 1 4 6 8 6 8 4 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
33
ip Data Memory Instruction Memory 0 1 4 mar The computer so far …
34
Instruction Memory A couple of extra bits.. Data Memory 0 1 4 Instruction Register Memory Data Register 2 8 34 2 Data Address add ax,bx 1.Line of code goes in… 2.Electrical bit signals come out 2. 1. Energize ax Energize bx Select ALU “add"
35
Moving data into Registers Instruction Memory 0 1 2 mar 3 4 mov ax, [1] 8 5 8 7 6 1 BX AX mov ax, [1] mov bx, [2] 7 For example …
36
Moving data into Memory Instruction Memory 0 1 2 mar 3 4 mov [3], ax 8 5 8 7 6 1 BX AX mov [3], ax mov [0], bx 7 For example … 8 7
37
Adding Numbers Instruction Memory 0 1 2 mar 3 4 add ax, bx 8 5 7 6 1 BX AX Add ax,bx 7 For example … … this means ‘ add ax to bx, put the answer in ax’ 8 8 7 15
38
So THAT’S how it works! Next week: the programming part!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.