![Page 1: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/1.jpg)
Computer Systems
2009-2010
Week 6: The Computer System
Alma Whitfield
![Page 2: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/2.jpg)
2
What we shall do today The computer as a processor (Chptr 2, 3)
Input devices Processing Instructions Outputting
Computer components (Chptr 4) The BUS system Memory Secondary Storage
Computer system simulator (Chptr 14) Threebit
![Page 3: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/3.jpg)
3
What is a computer ? Device that is told stuff INPUT Device that does stuff PROCESS Device that produces stuff OUTPUT Stuff ?
words pictures sounds numbers mouse movements joystick movements
![Page 4: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/4.jpg)
4
Computer as processor Supermarket checkout
Stuff coming in
Stuff coming out
Stuff getting
processed
![Page 5: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/5.jpg)
5
INPUT = WOOL
HUMAN BEING WITH KNITTING NEEDLES
OUTPUT = SOCKS
Human beings as processors Knitting
Stuff coming in
Stuff getting
processed
Stuff coming out
![Page 6: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/6.jpg)
6
INPUT=WOOL
HUMAN BEING WITHKNITTING NEEDLES
OUTPUT=SOCKS KNITTING PATTERN
Processors need instructions knit 2, purl 1
Instructions
![Page 7: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/7.jpg)
7
Another example Baking a cake
INPUT=INGREDIENTS
HUMAN BEING WITH KITCHEN
OUTPUT=CAKE RECIPE
Instructions
![Page 8: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/8.jpg)
8
Aircraft controlled by computer
![Page 9: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/9.jpg)
9
Airbus A320 First “fly-by-wire” commercial
airliner introduced 1988 Virtually all commercial airlines now
use fly-by-wire
![Page 10: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/10.jpg)
10
Computers as processors Aircraft computer
Stuff getting
processed
Stuff coming in
Stuff coming out
![Page 11: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/11.jpg)
11
Computers need instructions
Human with
kitchen
Recipe
Compare with
Hardware
Software
Programs
![Page 12: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/12.jpg)
12
Early computers: Harvard Mark I
1944 55 feet long 8 feet high 5-tons Used by the US Navy for gunnery calculations In operation until 1959
PeopleComputer
![Page 13: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/13.jpg)
13
Computer layout: old style
Everything plugged into processor Processor became known as
Central Processing Unit (CPU)
STORAGE DEVICE TO HOLD INSTRUCTIONS
PROCESSORINPUT
DEVICEOUTPUT DEVICE
INPUT OUTPUT
e.g. Keyboard e.g. Monitor
![Page 14: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/14.jpg)
14
KEYBOARD CPU STORAGE DEVICE
MONITOR
INPUTOUTPUT
HARD DISC
Computer layout: new style
Bus(Bundle of wires)
Stuff coming in
Stuff coming out
Stuff getting processed
![Page 15: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/15.jpg)
15
A desktop computer system: with fancy words
Input device
Output device
Processor inside system
box
![Page 16: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/16.jpg)
16
Input devices mouse
• scanner
• keyboard
![Page 17: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/17.jpg)
17
Output devices printer
• speakers
![Page 18: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/18.jpg)
18
Storage devices This is where we store instructions
STORAGE DEVICE TO HOLD INSTRUCTIONS
PROCESSORINPUT
DEVICEOUTPUT DEVICE
INPUT OUTPUT
e.g. Keyboard e.g. Monitor
![Page 19: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/19.jpg)
19
Storage device problems CPU can perform millions of
instructions per second Storage device needs to keep up
the supply of instructions Modern computers need to store
thousands of programs
![Page 20: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/20.jpg)
20
Solution Use two kinds of storage device:
smaller, faster, expensive part
larger, slower, cheaper part
Main memory - very fast (purely electronic), expensive.
RAM
Secondary storage – slower, (electro-mechanical), cheaper.
e.g. hard disc, CD
![Page 21: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/21.jpg)
21
Solution Keep the programs on the
secondary storage Copy a program into main memory
when we want the CPU to run it
![Page 22: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/22.jpg)
22
Typical devices attached to the bus CD Drive Hard Disc Drive Floppy Disc Drive CPU RAM (Main memory) Monitor Keyboard Mouse
Can you classify them?
(a) input device
(b) output device
(c) storage device
(d) processor
![Page 23: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/23.jpg)
23
Inside the system boxPower supply
Fan on top of CPU
Main memory
DVD and CD Drives
Hard disc
Slots for cardse.g.
Network card
Graphics card
Floppy disc drive
Motherboard(contains the
bus)
![Page 24: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/24.jpg)
24
CD Drive Compact Disc
CD is a plastic disc coated with special optical material
also known as CD-ROM (Read Only Memory)
Data is read from it using a laser light inside a CD Drive
Replaced now by DVD which has more storage capacity
![Page 25: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/25.jpg)
25
Hard disc drive
taking the lid off hard aluminium discs
coated with magnetizable material
![Page 26: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/26.jpg)
26
Floppy disc drive Floppy disc is a cheap version of
the hard disc Made of plastic Low capacity Read by a floppy disc drive Very slow Rapidly becoming obsolete
![Page 27: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/27.jpg)
27
CPU
Central processing unit carries out the instructions e.g. Intel Pentium e.g. AMD Pentium clone
Note gold plated legs
![Page 28: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/28.jpg)
28
CPU
CPU installed with fan removed
![Page 29: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/29.jpg)
29
CPU
CPU Socket on the
motherboard
![Page 30: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/30.jpg)
30
RAM (Main memory)
Where programs are stored while they are running
Main memory card in slot on motherboard
![Page 31: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/31.jpg)
31
RAM (Main memory) A main memory card
Note the gold plated connectors that will slot into
the computer’s bus on the motherboard
![Page 32: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/32.jpg)
32
What have we learned so far this week Computer systems consist of devices
attached to a bus Devices include:
processor storage devices input and output devices
Computers execute sets of instructions stored in programs
Programs are copied from Secondary Storage to RAM before execution of instructions
![Page 33: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/33.jpg)
33
KEYBOARD CPU STORAGE DEVICE
MONITOR
INPUTOUTPUT
HARD DISC
Computer layout
Bus(Bundle of wires)
Stuff coming in
Stuff coming out
Stuff getting processed
![Page 34: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/34.jpg)
34
Computer system simulator
![Page 35: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/35.jpg)
35
KEYBOARD CPU STORAGE DEVICE
MONITOR
INPUTOUTPUT
HARD DISC
![Page 36: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/36.jpg)
36
3-bit Simulator Demo A program is a collection of
instructions Instructions are stored in main
memory (RAM) Instructions are fetched into CPU
(Central Processing Unit) Instructions are executed by CPU
possibly resulting in new data being placed in main memory or moved elsewhere
![Page 37: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/37.jpg)
37
3-bit Instruction fetching and executing
done repeatedly This is known as the fetch-execute
cycle
![Page 38: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/38.jpg)
38
A computer instruction Instructions are represented at patterns of
0s and 1s 0s and 1s are binary digits binary digit abbreviated to bit
In 3-bit each instruction consists of 8 bits In a standard PC, instructions consists of 32 bits In a higher end machine, instructions can
consist of 64 bits In all cases an instruction has two parts:
operation code (usually abbreviated to op-code)
operand
![Page 39: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/39.jpg)
39
A computer instruction op-code
what the instruction will do e.g. add, multiply, move like a verb in English grammar
operand what the instruction will do it to e.g a number like a noun in English grammar
![Page 40: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/40.jpg)
40
A computer instruction in 3-bit
0 1 0 0 1 1 0 1
![Page 41: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/41.jpg)
41
A computer instruction in 3-bit
0 1 0 0 1 1 0 1
8 bits
![Page 42: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/42.jpg)
42
A computer instruction in 3-bit
0 1 0 0 1 1 0 1
8 bits
op-code
![Page 43: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/43.jpg)
43
A computer instruction in 3-bit
op-code is 3 bits long – hence the name 3-bit for the simulator
operand is 5 bits long
0 1 0 0 1 1 0 1
8 bits
op-code
operand
![Page 44: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/44.jpg)
44
8 available 3 bit op codesMnemonic
Brief meaning
000 STP halt
001 LDD load accumulator direct
010 LDI load accumulator immediate
011 STD store accumulator direct
100 ADD add to accumulator
101 SUB subtract from accumulator
110 JMP jump to next instruction
111 JEZ jump to next instruction if contents of accumulator is zero
![Page 45: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/45.jpg)
45
8 available 3 bit op codes Instructions carry out very simple
operations such as adding, storing Simplicity is not just a feature of 3-
bit – true for all kinds of computer system
A program such as a word processor may have millions of them combined to do useful things
![Page 46: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/46.jpg)
46
Lets look at the more obvious ones first! ADD – Will add the contents of the
memory address specified to whatever is in the ACCUMULATOR
SUB - Will subtract the contents of the memory address specified from the ACCUMULATOR
STP – Will stop the execution of the instructions
![Page 47: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/47.jpg)
47
The CPU Every CPU has at least 3 registers
Instruction register
(IR)
Accumulator
(AC)
Program counter
(PC)
![Page 48: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/48.jpg)
48
The CPU Every CPU has at least 3 registers
Instruction register
(IR)
Stores the current instruction when it is fetched from the main memory
Stored here so that the CPU can identify it and carry out the appropriate actions
![Page 49: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/49.jpg)
49
The CPU Every CPU has at least 3 registers
Accumulator
(AC)Stores data values fetched from main memory that may be:
• added to
• subtracted from
• moved elsewhere in main memory
![Page 50: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/50.jpg)
50
The CPU Every CPU has at least 3 registers
Program counter
(PC)
Contains of the address of the next instruction to be fetched from main memory when current instruction has completed its execution
![Page 51: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/51.jpg)
51
3-bit CPU Controls IR - clear the Instruction Register AC - set the Accumulator to 0 PC - set the Program Counter to 0 Run - start the fetch execute cycle Step - fetch and execute the next
instruction (whose address is in the PC)
Stop – stop fetching and executing instructions after current instruction has completed
![Page 52: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/52.jpg)
52
Main Memory Program instructions are stored in
main memory during program execution
Main memory was loaded from hard disk when the program was invoked
Instructions are fetched one at a time from main memory into the CPU to be executed
![Page 53: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/53.jpg)
53
3-bit Main Memory Our simulator has 32 Memory Locations
operands have 5 bits. These can be used to represent 32 different patterns of 0 and 1. Each different pattern can be used as an address to uniquely identify a memory location
Each location can store 8 bits i.e. one instruction 8 bits is also known as 1 byte
There is also enough memory in each location to store the ASCII code for a character
ASCII is an 8 bit code used to represent alphabetical characters, digits and other items
e.g. 65 is ASCII code for ‘A’ Real Memory has billions of locations.
![Page 54: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/54.jpg)
54
3-bit Main Memory Notice that some
of the memory locations have red lines coming from them.
This is to signify that that section of the memory has been reserved for use with the Video Card
![Page 55: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/55.jpg)
55
Back to the Instructions ADD – Will add the contents of the
memory address specified to the accumulator
SUB - Will subtract the contents of the memory address specified from the accumulator
It is very important to realise now that when you specify ADD x. The x refers to a memory location’s address. Not a value!
![Page 56: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/56.jpg)
56
For Example Question –
What will the AC become once the program has finished executing?
Address 16 holds value 10.
Address 10 holds value 2
![Page 57: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/57.jpg)
57
For example Demo
ADD 16 causes contents of location 16 (which is 14) to be placed in the Accumulator
ADD 10 causes contents of location 10 (which is 5) to be added to contents of the Accumulator giving 19
![Page 58: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/58.jpg)
58
Lets take a look at the other instructions LDD x
Copies contents of location x into the AC – loading the accumulator
STD x Copies the contents of the AC to
location x – storing the accumulator
![Page 59: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/59.jpg)
59
LDD Given the
program in memory, what will the accumulator’s contents be after the program has executed?
Answer 25
![Page 60: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/60.jpg)
60
STD Given the
following program.
What will happen?
![Page 61: Computer Systems 2009-2010 Week 6: The Computer System Alma Whitfield](https://reader036.vdocument.in/reader036/viewer/2022070413/5697bfd01a28abf838caaacb/html5/thumbnails/61.jpg)
61
LDI LDI is similar to LDD with one key
difference.
LDI 27 will load 27 into theaccumulator
LDD 27 will load contents of address
27 into the accumulator