Title: HOW COMPUTERS WORK
1HOW COMPUTERS WORK
- For Pensacola High School - IB
- By Dr. Ed Rodgers, Chairperson
- From Dept. of Computer Science
- At University of West Florida
2HOW COMPUTERS WORK
- LOOK INSIDE THE COMPUTER
- SEE HOW DATA IS STORED
- SEE HOW PROGRAMS ARE STORED
- SEE HOW PROGRAMS ARE RUN
3 4Central Processing Unit
CPU
5Random Access Memory
RAM
CPU
6ADDRESS BUS
RAM
RAM
CPU
7ADDRESS BUS
RAM
RAM
DATA BUS
CPU
8ADDRESS BUS
Addresses
RAM
RAM
0000
0001
0002
0003
DATA BUS
0004
0005
0006
0007
0008
0009
000A
0056
0057
CPU
0058
9ADDRESS BUS
CPU Components
RAM
0000
0001
MAR
PC
0002
0003
DATA BUS
0004
MDR
IR
0005
0006
0007
ACCA
0008
CONTROL UNIT
0009
ACCB
000A
ROM
MICROCODE
0056
ALU
0057
CC
CPU
0058
10 11HOW PEOPLE STORE DATA
- Numbers based on ten symbols DECIMAL
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- to add one more.......10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20,. . . .
12HOW PEOPLE STORE DATA
- So DECIMAL numbers are positioned by powers of
ten - 1,584 is interpreted as 1x10 to the 3rd power
5x10 to the 2nd power 8x10 to the first power
4X10 to the zero power 1000500804
13HOW THE COMPUTER STORES DATA
- Numbers based on two symbols BINARY
- 0, 1
- to add one more.............10, 11, 100, 101,
110, 111, 1000, - 1001, 1010, 1011, 1100, 1101, 1110, 1111,
. . .
14HOW THE COMPUTER STORES DATA
- So BINARY numbers are positioned by powers of
two - The BINARY number 11011 is interpreted as 1x2 to
the fourth power 1x2 to the 3rd power 0x2 to
the 2nd power 1x2 to the first power 1X2 to
the zero power 168021 27 in decimal
15HOW THE COMPUTER STORES DATA
- For convenience group 4 BINARY digits 0000,
0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000,
1001, 1010, 1011, 1100, 1101, 1110, 1111, . . . - and use 16 symbols
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
- to represent the groups of four binary digits
- to add one more......10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 1A, 1B, . . .
16HOW THE COMPUTER STORES DATA
- This HEXADECIMAL system, a condensed version of
BINARY based on 16 symbols, is the way we
illustrate how the computer stores data - The HEX number 2B8 is interpreted as 2x16 to the
2nd power 11x16 to the first power 8X16 to
the zero power 5121768 696 in decimal---This
would have been 0010 1011 1000 in BINARY!
17- SUMMARIZE NUMBER SYSTEMS
- DECIMAL BINARY HEXADECIMAL
- (10 sym) (2 sym) (16 sym)
- 0000 0000 0000
- 0001 0001 0001
- 0002 0010 0002
- 0003 0011 0003
- 0004 0100 0004
- 0005 0101 0005
- 0006 0110 0006
- 0007 0111 0007
- 0008 1000 0008
18- SUMMARIZE NUMBER SYSTEMS
- DECIMAL BINARY HEXADECIMAL
- (10 sym) (2 sym) (16 sym)
- 0009 1001 0009
- 0010 1010 000A
- 0011 1011 000B
- 0012 1100 000C
- 0013 1101 000D
- 0014 1110 000E
- 0015 1111 000F
- 0016 00010000 0010
- 0017 00010001 0011
- 0018 00010010 0012
19ADDRESS BUS
Data Storage
RAM
0000
0001
MAR
PC
0002
0003
DATA BUS
0004
MDR
IR
0005
0006
0007
ACCA
0008
CONTROL UNIT
0009
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
20- SEE HOW PROGRAMS ARE STORED
21Sample Program Step
- Suppose we want to find the sum of two numbers
- In a language such as BASIC
- LET C A B
- More specifically
- add the value of the memory location containing
- A to the value of the memory location containing
B - and store the results at the memory location for
C.
22Sample Program Step
- The computer needs more specific steps
- move the contents of the address for A to the
accumulator - add the contents of the address for B to the
accumulator - store the contents of the accumulator at the
address for C - The computer needs to have LET C A B
- translated to the specific codes it understands
- (Each microprocessor has its own set of machine
code)
23Sample Program Step
- move the contents of the address for A to the
accumulator - BINARY 1011 0110 or HEXADECIMAL B6
- followed by the address for A in HEXADECIMAL B6
XXXX - add the contents of the address for B to the
accumulator - BINARY 1011 1011 or HEXADECIMAL BB
- followed by the address for B in HEXADECIMAL BB
XXXX - store the contents of the accumulator at the
address for C - BINARY 1011 0111 or HEXADECIMAL B7
- followed by the address for B in HEXADECIMAL B7
XXXX
24ADDRESS BUS
Program Storage
RAM
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
25 26ADDRESS BUS
RAM
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
27ADDRESS BUS
RAM
Program Counter
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
28ADDRESS BUS
RAM
Instruction Register
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
29ADDRESS BUS
Arithmetic/Logic Unit and Micro- programs in Read
Only Memory
RAM
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
30ADDRESS BUS
RAM
Memory Address Register
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
31ADDRESS BUS
RAM
Memory Data Register
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
32ADDRESS BUS
RAM
Accumulators
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
33ADDRESS BUS
RAM
Condition Code Register
0000
B6
0001
00
MAR
PC
0002
56
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
34- LETS LOOK AT THE PROGRAM C A B
- ONE STEP AT A TIME
35ADDRESS BUS
0000
PROGRAM STARTS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
00
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
36ADDRESS BUS
0000
FIRST INSTRUCTION FOUND
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
01
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
37ADDRESS BUS
0000
INSTRUCTION MOVED TO IR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
01
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
B6
B6
B6
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
38ADDRESS BUS
0000
INSTRUCTION INTERPRETED LOAD ACCUMULATOR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
01
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
B6
B6
B6
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
39ADDRESS BUS
0001
LOOK FOR HIGHER PART OF ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
02
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
B6
B6
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
40ADDRESS BUS
0001
MOVE HIGH PART OF ADDRESS TO MAR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
00
02
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
00
B6
00
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
41ADDRESS BUS
0002
LOOK FOR LOWER PART OF ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
00
03
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
00
B6
00
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
42ADDRESS BUS
0002
MOVE LOWER PART OF ADDRESS TO MAR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
03
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
56
B6
56
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
43ADDRESS BUS
0056
LOOK FOR DATA VALUE AT MAR ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
03
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
56
B6
56
0006
B7
0007
00
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
44ADDRESS BUS
0056
LOAD ACCUMULATOR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
03
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
09
B6
09
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
45ADDRESS BUS
0003
LOOK FOR NEXT INSTRUCTION
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
04
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
09
B6
09
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
46ADDRESS BUS
0003
MOVE INSTRUCTION TO IR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
04
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
BB
BB
BB
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
47ADDRESS BUS
0003
INSTRUCTION INTERPRETED ADD TO ACCUMULATOR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
04
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
BB
BB
BB
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
48ADDRESS BUS
0004
LOOK FOR HIGHER PART OF ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
05
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
BB
BB
BB
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
49ADDRESS BUS
0004
MOVE HIGHER PART OF ADDRESS TO MAR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
05
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
00
BB
00
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
50ADDRESS BUS
0005
LOOK FOR LOWER PART OF ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
56
00
06
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
00
BB
00
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
51ADDRESS BUS
0005
MOVE LOWER PART OF ADDRESS TO MAR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
06
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
57
BB
57
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
52ADDRESS BUS
0057
LOOK FOR DATA VALUE AT MAR ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
06
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
57
BB
57
0006
B7
0007
00
09
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
53ADDRESS BUS
0057
ADD DATA VALUE TO ACCUMULATOR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
06
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
01
BB
01
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
54ADDRESS BUS
0006
LOOK FOR NEXT INSTRUCTION
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
07
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
01
BB
01
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
55ADDRESS BUS
0006
MOVE INSTRUCTION TO IR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
07
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
B7
B7
B7
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
56ADDRESS BUS
0006
INSTRUCTION INTERPRETED MOVE ACCUM SUM TO MAR
ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
07
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
B7
B7
B7
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
57ADDRESS BUS
0007
LOOK FOR HIGHER PART OF ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
08
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
B7
B7
B7
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
58ADDRESS BUS
0007
MOVE HIGHER PART OF ADDRESS TO MAR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
08
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
00
B7
00
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
59ADDRESS BUS
0008
LOOK FOR LOWER PART OF ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
57
00
09
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
00
B7
00
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
60ADDRESS BUS
0008
MOVE LOWER PART OF ADDRESS TO MAR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
58
00
09
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
58
B7
58
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
61ADDRESS BUS
0058
LOOK FOR MAR ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
58
00
09
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
58
B7
58
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
62ADDRESS BUS
0058
MOVE ACCUMULATOR VALUE TO MAR ADDRESS
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
58
00
09
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0A
B7
0A
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
0A
63ADDRESS BUS
0009
LOOK FOR NEXT INSTRUCTION
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
58
00
0A
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
0A
B7
0A
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
0A
64ADDRESS BUS
0009
MOVE INSTRUCTION TO IR
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
58
00
0A
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
3E
3E
3E
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
0A
65ADDRESS BUS
0009
INSTRUCTION INTERPRETED STOP PROGRAM
RAM
0000
B6
0001
00
MAR
PC
0002
56
00
58
00
0A
0003
BB
DATA BUS
0004
00
MDR
IR
0005
57
3E
3E
3E
0006
B7
0007
00
0A
ACCA
0008
58
CONTROL UNIT
0009
3E
ACCB
000A
ROM
MICROCODE
0056
09
ALU
0057
01
CC
CPU
0058
0A
66SO COMPUTERS UNDERSTAND ONLY THE MOST ELEMENTARY
COMMANDS
- Programs are put together as building blocks
made up of these elementary machine-level codes - Programming at this level is very tedious and
time-consuming - It is a creative process which requires a knack
for analyzing and solving puzzle-like problems
67WHY LEARN THIS HEXADECIMAL MACHINE CODE?
- SPEED
- (IT TAKES TIME TO CONVERT C A B) TO
- B6 0056 1011 0110 0000 0000 0101 0110
- BB 0057 1011 1011 0000 0000 0101 0111
- B7 0058 1011 0111 0000 0000 0101 1000
- 3E 0011 1110
- CONTROL
- RELIABILITY
- FLEXIBILITY
68NOW THAT YOU KNOW HOW IT WORKS
- YOU CAN CONTROL THE COMPUTER
69BEFORE IT CONTROLS YOU!