Professional Documents
Culture Documents
Lecture On Global Informatics and Electronics
Lecture On Global Informatics and Electronics
and Electronics Ⅱ
Jubee Tada
Graduate School of Science and Engineering,
Yamagata University
Tel:0238-26-3576
E-mail:jubee@yz.yamagata-u.ac.jp
Introduction
• Contents
– Basis of Computer Architecture
– Methods for Performance Improvement
– Effects of Memory Hierarchy
– Trends of Microprocessors
1
What is a Computer?
• Computer
– A machine that does computations.
• Computation
– Process the input data according to an algorithm,
outputting the results.
• Program
– An algorithm expressed by a combination of
instructions.
• Instructions
– each process that a computer can execute.
– Arithmetic instructions:+, ×, &, etc.
– Load/Store instructions:read and write data
between a memory and a processor.
– Branch instructions:change the next instruction.
3
Example of a program
C = A + B;
4
Structure of a Computer (1/3)
• Processor
– A part of processing instructions
• Memory (Main memory)
– All instructions and data are stored in main
memory
Processor Memory
(Main memory)
5
Structure of a Computer (2/3)
• Address:position in a memory
• Register:storage device in a processor
• ALU(Arithmetic Logic Unit)
:device that performs calculations
# Register
Address Address Data
0
1 Variable A
0 Instruction 1
Data 4 Instruction 2
…
…
15
Data 100 Variable A
104 Variable B
…
…
ALU
6
Instruction processing flow
8
Structure of a Computer (3/3)
Address
PC Main Memory
Instruction Address Data
Decoder 0 Instruction1
4 Instruction2
# of Register 8 Instruction3
# register Data 12 Instruction4
0
…
1 Variable A Data 100 Variable A
…
104 Variable B
15 108 Variable C
112 Variable D
Data
…
…
Address
ALU
9
An Example: Execute C=A+B; (1/5)
Address
PC=0 Main Memory
Instruction Address Data
Decoder 0 Load A to R1
4 Load B to R2
# of Register 8 R3=R1+R2
register Data 12 Store R3 to C
R0
…
R1 Data 100 A=4
R2 104 B=6
R3 108 C=?
112
Data
…
…
Address
ALU
10
An Example: Execution of C=A+B; (2/5)
Address
PC=0 Main Memory
Instruction Address Data
Decoder 0 Load A to R1
4 Load B to R2
# of Register 8 R3=R1+R2
register Data 12 Store R3 to C
R0
…
R1 4
Data 100 A=4
R2 104 B=6
R3 108 C=?
112
Data
…
…
Address
ALU
11
An Example: Execution of C=A+B; (3/5)
Address
PC=4 Main Memory
Instruction Address Data
Decoder 0 Load A to R1
4 Load B to R2
# of Register 8 R3=R1+R2
register Data 12 Store R3 to C
R0
…
R1 4
Data 100 A=4
R2 6 104 B=6
R3 108 C=?
112
Data
…
…
Address
ALU
12
An Example: Execution of C=A+B; (4/5)
Address
PC=8 Main Memory
Instruction Address Data
Decoder 0 Load A to R1
4 Load B to R2
# of Register 8 R3=R1+R2
register Data 12 Store R3 to C
R0
…
R1 4
Data 100 A=4
R2 6 104 B=6
R3 10 108 C=?
112
Data
…
…
Address
ALU
13
An Example: Execution of C=A+B; (5/5)
Address
PC=12 Main Memory
Instruction Address Data
Decoder 0 Load A to R1
4 Load B to R2
# of Register 8 R3=R1+R2
register Data 12 Store R3 to C
R0
…
R1 4
Data 100 A=4
R2 6 104 B=6
R3 10 108 C=10
112
Data
…
…
Address
ALU
14
Instruction processing flow and five stages
1 2 4
3
15
Components required to execute instructions
• Reading instructions IF
– instruction fetch(IF: Instruction Fetch)
• Reading the instruction decode register ID
– instruction decoding(ID: Instruction Decode)
• ALU operation
– Calculation execution(EX: EXecute) EX
17
Each component and behavior (2/4)
18
Each component and behavior (3/4)
19
Each component and behavior (4/4)
20
Components used when executing each instruction(1/2)
21
Components used when executing each instruction(2/2)
• Store instructions:IF・ID・EX・MEM
– Read the instruction, decode it, read the register,
execute the operation (calculate the address) and
write the data to memory
• Load instruction:IF・ID・EX・MEM・WB
– Read the instruction, decode it, read the register,
Perform the operation (calculate the address), read the
data from memory, and write it to the register.
22
total time for each instruction type
load
200ps 100ps 200ps 200ps 100ps 800ps
(lw)
store
200ps 100ps 200ps 200ps 700ps
(sw)
arithmetic
(add, sub, 200ps 100ps 200ps 100ps 600ps
etc.)
branch
200ps 100ps 200ps 500ps
(beq, etc.)
ps = picosecond (10-12)
23
Single clock cycle method
24
The processing time for instructions in single clock method
time 200 400 600 800 1000 1200 1400 1600 1800
execution order
lw IF ID EX MEM WB
$s1,100($0)
lw 800ps
IF ID EX MEM WB
$s2,200($0)
lw 800ps
IF
$s3,300($0)
800ps
25