Computer Hardware - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

Computer Hardware

Description:

OpCodes. 0 - Halt. 1 - Load. 2 - Store. 3 - Add. 4 - Subtract. 5 - Divide. 6 - Multiply ... OpCodes. 0 - Halt. 1 - Load. 2 - Store. 3 - Add. 4 - Subtract. 5 ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 38
Provided by: danrol
Category:

less

Transcript and Presenter's Notes

Title: Computer Hardware


1
Computer Hardware
  • What goes on inside?

2
(No Transcript)
3
Deeper
4
Deeper
5
Not that deep
6
A simple Computer
Performs all calculations and decisions Add,
Subtract, gt, lt, decide what to do next
Central Processing Unit CPU
7
A simple Computer
Memory
Central Processing Unit CPU
Stores most information Memory is a large array
of integers
8
Memory - array of integers
  • How does it store text?
  • How does it store images?
  • How does it store audio?
  • How does it store a program?

9
A simple Computer
Memory
Central Processing Unit CPU
Address
Wires that pass the index of the location in
memory that the CPU wants to get or change
10
A simple Computer
Address
Memory
Central Processing Unit CPU
0
1
0
0
1
0
Wires that pass the index of the location in
memory that the CPU wants to get or change
11
A simple Computer
Address
Memory
Central Processing Unit CPU
0
1
0
0
1
0
Number of wires number of bits Number of bits
range of possible indexes total
possible memory
12
A simple Computer
Address
Memory
Central Processing Unit CPU
0
1
0
0
1
0
Twice as much memory adds how many more address
wires? 1 more
13
A simple Computer
Memory
Central Processing Unit CPU
Address
Data
Wires that pass numbers from CPU to Memory or
from Memory to CPU
14
A simple Computer
Memory RAM
Central Processing Unit CPU
Address
Data
RAM - Random Access Memory is the main memory of
a computer. The size of RAM is the length of the
array
15
How to represent a program in memory
  • Program is a series of simple instructions
  • Each instruction is an integer
  • CPU
  • Goes to a location in memory
  • Gets an instruction
  • Does what the instruction says
  • Moves to the next instruction
  • Does this millions of times per second

16
A simple fake computer
17
Program Counter - address (index) of the next
instruction
18
Registersprivate memory for the CPU
19
Every instruction has a number
  • OpCodes
  • 0 - Halt
  • 1 - Load
  • 2 - Store
  • 3 - Add
  • 4 - Subtract
  • 5 - Divide
  • 6 - Multiply
  • 7 - Is Greater Than 0?
  • 8 - Goto
  • 9 - Branch If Greater Than 0!

20
OpCodes 0 - Halt 1 - Load 2 - Store 3 -
Add 4 - Subtract 5 - Divide 6 - Multiply 7 -
Is Greater Than 0? 8 - Goto 9 - Branch If
Greater Than 0!
  • Instruction Format
  • Digit 1 OpCode
  • Digit 2 Register
  • Digit 3-4 Memory Address

21
OpCodes 0 - Halt 1 - Load 2 - Store 3 -
Add 4 - Subtract 5 - Divide 6 - Multiply 7 -
Is Greater Than 0? 8 - Goto 9 - Branch If
Greater Than 0!
  • Instruction Format
  • Digit 1 OpCode
  • Digit 2 Register
  • Digit 3-4 Memory Address

3 1 10
22
OpCodes 0 - Halt 1 - Load 2 - Store 3 -
Add 4 - Subtract 5 - Divide 6 - Multiply 7 -
Is Greater Than 0? 8 - Goto 9 - Branch If
Greater Than 0!
  • Instruction Format
  • Digit 1 OpCode
  • Digit 2 Register
  • Digit 3-4 Memory Address

3 1 10
23
Reg1Reg1Mem10
OpCodes 0 - Halt 1 - Load 2 - Store 3 -
Add 4 - Subtract 5 - Divide 6 - Multiply 7 -
Is Greater Than 0? 8 - Goto 9 - Branch If
Greater Than 0!
  • Instruction Format
  • Digit 1 OpCode
  • Digit 2 Register
  • Digit 3-4 Memory Address

3 1 10
24
?
OpCodes 0 - Halt 1 - Load 2 - Store 3 -
Add 4 - Subtract 5 - Divide 6 - Multiply 7 -
Is Greater Than 0? 8 - Goto 9 - Branch If
Greater Than 0!
  • Instruction Format
  • Digit 1 OpCode
  • Digit 2 Register
  • Digit 3-4 Memory Address

4 2 30
25
Reg2Reg2-Mem30
OpCodes 0 - Halt 1 - Load 2 - Store 3 -
Add 4 - Subtract 5 - Divide 6 - Multiply 7 -
Is Greater Than 0? 8 - Goto 9 - Branch If
Greater Than 0!
  • Instruction Format
  • Digit 1 OpCode
  • Digit 2 Register
  • Digit 3-4 Memory Address

4 2 30
26
A simple program
1 0 07
Load location 7 into register 0
Reg0Mem7 PC PC1
27
A simple program
1 2 08
Load location 8 into register 2
Reg2Mem8 PC PC1
28
A simple program
3 0 07
Add location 7 to register 0
Reg0Reg0Mem7 PC PC1
29
A simple program
8 2 00
GOTO the address stored in register 2
PC Reg2
30
A simple program
3 0 07
Add location 7 to register 0
Reg0Reg0Mem7 PCPC1
31
A simple program
8 2 00
GOTO the address stored in register 2
PC Reg2
32
A simple program
3 0 07
Add location 7 to register 0
Reg0Reg0Mem7 PCPC1
33
Clock speed of a processor
  • Number of instructions per second that can be
    performed
  • 100 MHz 100 Million times per second
  • 1.5 GHz 1.5 Billion instructions per second

34
So what is a program?
  • A file of bytes
  • Operating system copies the file into memory
  • When select the program from Start menu
  • When you double click on the program
  • Operating system sets PC to address of first byte
    of the program in memory
  • Program begins to run

35
Programs and Data
Program (instructions)
  • Data

What is the difference?
If the PC points to it then it is an instruction
36
Review
  • CPU - Central Processing Unit
  • Does calculating and deciding
  • Memory - RAM
  • Stores data and programs
  • Array of integers
  • Size of RAM the length of this array

37
Review
  • Program
  • List of instructions
  • Each instruction is an integer that the CPU
    decodes
  • Program counter (PC) is the address of the next
    instruction
  • Copy program from file into memory
  • Set PC to start of the program
Write a Comment
User Comments (0)
About PowerShow.com