CS107: Introduction to Computer Science
Download
Report
Transcript CS107: Introduction to Computer Science
CSE 102
Introduction to
Computer Engineering
Central Processing Unit
Classes of Computers
•
•
•
•
•
•
•
Supercomputer
Mainframe
Server
PC/Workstation
Game console
Embedded device
Future disposable
$5-20 million
$0.5-4 million
$10-200 thousand
$1-10 thousand
$300-$1000
$1-$100
1-100 cents
Building Computer Chips
• Complex multi-step process
–
–
–
–
–
–
–
Slice ingots into wafers
Process wafers into patterned wafers
Dice patterned wafers into dies
Test dies, select good dies
Bond to package
Test parts
Ship to customers and make money
Building Computer Chips
Microprocessors and
Memory
Microprocessor Performance Factors: What
makes one microprocessor perform better than
another?
• CPU speed is influenced by several factors:
– clock speed – Megahertz, Gigahertz
– word size
• 8-bit, 16-bit, 32-bit or 64-bit word sizes
– Cache – Level 1, Level 2 caches
– instruction set size
Performance vs. Design Time
• Time to market is critically important
• E.g., a new design may take 3 years
–
–
–
–
It will be 3 times faster
But if technology improves 50%/year
In 3 years 1.53 = 3.38
So the new design is worse!
(unless it also employs new technology)
Moore’s Law
• Considering the rate of technological
development, the complexity of an
integrated circuit, with respect to minimum
component cost will double in about 24
months (18-24).
Computer System Components
Central Processing Unit
Input
Devices
Processing
Data into
Information
Keyboard
Mouse
Touch Screen
Voice...
Output
Devices
Monitor
Printer
Disks, Tapes, Optical Disks
Secondary Storage Devices
CPU (Central Processing Unit)
•
•
•
•
The CPU executes computer instructions
Popular CPU’s: Intel-Pentium, AMD, Power PC
It is on a chip called the microprocessor
System clock
–
•
Megahertz
Has three parts:
1. Control Unit
2. ALU (Arithmetic Logic Unit)
3. Registers
How Computers Work
CD on CPU simulation
The Instruction Cycle The Execution Cycle
Fetch the Instruction
1. Fetch
Interpret the Instruction
2. Decode
Prepare Circuitry to
Execute Instruction
Fetch the Data
3. Execute
Manipulate the Data
4. Store
Store the Result
Code Translation
(C to Assembly Language)
#include<stdio.h>
int main( )
{
int a=10;
int b=20;
int c;
c=a+b*2;
return 0;
}
MOV R1, #10
MOV R2, #20
MOV R3, #2
MUL R4, R2, R3
ADD R5, R1, R4
BREAK
Code Translation
(C to Machine Code)
#include<stdio.h>
int main( )
{
int a=10;
int b=20;
int c;
c=a+b*2;
return 0;
}
MOV R1, #10
MOV R2, #20
MOV R3, #2
MUL R4, R2, R3
ADD R5, R1, R4
BREAK
Adress
Data
==============
1000
110A
1002
1214
1004
1302
1006
3423
1008
2514
100A
0000
MEMORY
CPU Control Unit
Adress
Data
==============
1000
110A
1002
1214
1004
1302
1006
3423
1008
2514
100A
0000
Fetch from PC
DECODE
0001 Opcode MOV
0001 Register
0110 Data1
0100 Data2
Program Counter
MEMORY
110A
PC = 1000
CPU
Registers and MOV operation
1
0001
MOV
1
0001
REGISTERS
DATA
R0
R1
0
0000
A
1010
00001010
= 10 in decimal
00001010
R2
R3
R4
R5
R6
R7
PC = 1000
CPU
Registers and MOV operation
1
0001
MOV
2
0010
REGISTERS
DATA
R0
R1
R2
1
0001
4
0100
00010100
= 20 in decimal
00001010
00010100
R3
R4
R5
R6
R7
PC = 1002
CPU
Registers and MOV operation
1
0001
MOV
3
0011
REGISTERS
DATA
R0
R1
R2
R3
R4
R5
R6
R7
0
0000
2
0010
00000010
= 2 in decimal
00001010
00010100
00000010
PC = 1004
CPU
Registers and MUL operation
3
0011
MUL
4
0100
REGISTERS
2
0010
DATA
ALU
R0
R1
R2
R3
R4
00001010
00010100
00000010
00101000
3
0011
20
Mul
40 = 00101000
2
R5
R6
R7
PC = 1004
CPU
Registers and ADD operation
2
0010
ADD
5
0101
REGISTERS
DATA
R0
R1
R2
R3
R4
R5
R6
R7
1
0001
00001010
00010100
00000010
00101000
00110010
10
4
0100
ALU
Add 50 = 00110010
40
PC = 1006
CPU