Title: Computer Architecture CSE 3322
1Computer Architecture CSE 3322
Course WEB SITE http//crystal.uta.edu/jpatter
s/cse3322/index.html
2Why Study Computer Architecture
- Learn to Design Computers
- Processors Designed by Few Semiconductor
Companies
3Why Study Computer Architecture
- Learn to Design Computers
- Processors Designed by Few Semiconductor
Companies - Learn to Design Device Controllers
4Why Study Computer Architecture
- Learn to Design Computers
- Processors Designed by Few Semiconductor
Companies - Learn to Design Device Controllers
- Learn to Design More Optimum Software!
5Why Study Computer Architecture
- Learn to Design Computers
- Processors Designed by Few Semiconductor
Companies - Learn to Design Device Controllers
- Learn to Design More Optimum Software!
- Learn to Design More Optimum Systems!
6How to Improve Application Performance ?
7How to Improve Application Performance ?
- Algorithm
- Language and Compiler
- Processor and Memory System
- I/O System and Devices
8Computer Generations Overview
9Computer Generations Overview
10Computer Generations Overview
11Computer Generations Overview
12Computer Generations Overview
13Technological Growth
- DRAM Growth
- 4X Capacity Every 3 Years
14Technological Growth
- DRAM Growth
- 4X Capacity Every 3 Years
- Workstation Performance Improvement 54
per year or 2X every18 months
15Technological Growth
- DRAM Growth
- 4X Capacity Every 3 Years
- Workstation Performance Improvement 54
per year or 2X every18 months - Disk Drive Growth
- Capacity More than 2x every year
16Technological Growth
- DRAM Growth
- 4X Capacity Every 3 Years
- Workstation Performance Improvement 54
per year or 2X every18 months - Disk Drive Growth
- Capacity More than 2x every year
- All Continue to Drive Price /Performance
Improvements
17(No Transcript)
18Five Components of Computers
Memory
Control
Input
Datapath
Output
Processor
19Instruction Set Design
- Key Element in the Architecture
- Function, Cost, Performance, etc.
-
20Instruction Set Design
- Key Element in the Architecture
- Function, Cost, Performance, etc.
- Typical Machine Instructions
- Data Transfers ( reg-reg, reg-mem, mem-reg)
- Arithmetic (add, subtract, multiply)
- Logic String (boolean, bit manipulations)
- Program Control ( branches, jumps)
- Input/Output Operations
-
21Instruction Set Design
Study the MIPS Architecture
22Instruction Set Design
Study the MIPS Architecture
- A WORD is 32 bits or 4 bytes wide for
- Registers and Memory
23Instruction Set Design
Study the MIPS Architecture
- A WORD is 32 bits or 4 bytes wide for
- Registers and Memory
- Each byte has Memory Address starting at 0
24Instruction Set Design
Study the MIPS Architecture
- A WORD is 32 bits or 4 bytes wide for
- Registers and Memory
- Each byte has Memory Address starting at 0
- WORD Addresses start at 0 and are multiples of 4
25Instruction Set Design
Study the MIPS Architecture
- A WORD is 32 bits or 4 bytes wide for
- Registers and Memory
- Each byte has Memory Address starting at 0
- WORD Addresses start at 0 and are multiples of
4 - Big-endian Byte 0, Byte 1, Byte 2, Byte 3
- Little-endian Byte 3, Byte 2, Byte 1, Byte 0
26Instruction Set Design
Study the MIPS Architecture
- A WORD is 32 bits or 4 bytes wide for
- Registers and Memory
- Each byte has Memory Address starting at 0
- WORD Addresses start at 0 and are multiples of
4 - Big-endian Byte 0, Byte 1, Byte 2, Byte 3
- Little-endian Byte 3, Byte 2, Byte 1, Byte 0
- 32 Registers with Conventions on Use
27Memory
bM
N
Registers
31
b11 b10 b9 b8
8
b7 b6 b5 b4
4
1
0
0
b3 b2 b1 b0
32 bits
32 bits
28MIPS Assembly Instructions
Instruction Example Meaning add add
s1, s2, s3 s1 s2 s3 subtract sub
s1, s2, s3 s1 s2 - s3 s1, s2, s3,
are registers. The indicates a Register in
the MIPS Assembly Language
29MIPS Assembly Instructions
Instruction Example Meaning add add
s1, s2, s3 s1 s2 s3 subtract sub
s1, s2, s3 s1 s2 - s3 s1, s2, s3,
are registers. The indicates a Register in
the MIPS Assembly Language Also s2 s3
s1
30Machine Instruction Format
R Type Instruction
Instr Format op rs rt rd shamt
funct
add R 0 reg reg reg
0 32
sub R 0 reg reg reg
0 34
bits 6 5 5 5 5
6
op opcode rd register destination
operand rs reg source 1 operand shamt
shift amount rt reg source 2 operand funct
function code variant
of operation
31Machine Instruction Format
add t0, s2, t0 where t0 is reg 8, s2 is
reg 18 t0 s2 t0
Instr Format op rs rt rd shamt
funct
add R 0 18 8 8
0 32
bits 6 5 5 5 5
6
32Machine Instruction Format
add t0, s2, t0 where t0 is reg 8, s2 is
reg 18 t0 s2 t0
Instr Format op rs rt rd shamt
funct
add R 0 18 8 8
0 32
bits 6 5 5 5 5
6
Example of Machine Language Instruction
op rs rt rd shamt
funct
0 18 8 8 0
32
000000 10010 01000 01000 00000 100000
33MIPS Assembly Instructions
Instruction Example Meaning load word
lw s1, 300 (s2) s1 Mems2300 store
word sw s1, 300 (s2) Mems2300
s1 s1, s2, s3, are registers 300 is a
constant
34Machine Instruction Format
I Type Instruction
lw s1, 300 (s2)
Instr Format op rs rt address/
immediate
lw I 35 reg reg
constant
sw I 43 reg reg
constant
bits 6 5 5 16
op opcode rs reg address operand rt reg
destination or source operand
35 C statement Ai h Ai Ai h
are integers where A is an array with base in
s3 h is in s1 i is in s2
36 C statement Ai h Ai, Ai
h are integers where A is an array with base in
s3 h is in s1 i is in s2
Words in an Array in memory are 4 bytes apart,
so the Address increments by 4.
Ai A3 A2 A1 A0
Base 4 i Base 12 Base 8 Base 4 Base
37 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code denotes
comments
38 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code denotes
comments Compute Address of Ai Base 4i
39 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code Compute Address
of Ai Base 4i add t1, s2, s2
Temp reg t1 i i 2i add t1, t1, t1
Temp reg t1 2i 2i 4i
40 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code Compute Address
of Ai Base 4i add t1, s2, s2
Temp reg t1 i i 2i add t1, t1, t1
Temp reg t1 2i 2i 4i add t1, t1, s3
t1 address of Ai
41 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code Compute Address
of Ai Base 4i add t1, s2, s2
Temp reg t1 i i 2i add t1, t1, t1
Temp reg t1 2i 2i 4i add t1, t1, s3
t1 address of Ai Compute the new Ai lw
t2, 0(t1) Temp reg t2 Ai
42 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code Compute Address
of Ai Base 4i add t1, s2, s2
Temp reg t1 i i 2i add t1, t1, t1
Temp reg t1 2i 2i 4i add t1, t1, s3
t1 address of Ai Compute the new Ai lw
t2, 0(t1) Temp reg t2 Ai add t2,
t2, s1 t2 Ai h
43 C statement Ai h Ai where A
is an array with base in s3 h is in
s1 i is in s2
Compiles into assembly code Compute Address
of Ai Base 4i add t1, s2, s2
Temp reg t1 i i 2i add t1, t1, t1
Temp reg t1 2i 2i 4i add t1, t1, s3
t1 address of Ai Compute the new Ai lw
t2, 0(t1) Temp reg t2 Ai add t2,
t2, s1 t2 Ai h sw t2, 0(t1)
Store t2 into Ai
44lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct
45lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35
46lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35 9
10 0
47lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35 9
10 0 0 10
17 10 0
32
48lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35 9
10 0 0 10
17 10 0
32 43 9 10
0
49lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35 9
10 0 0 10
17 10 0
32 43 9 10
0
Translate to MIPS Machine language using binary
100011 01001 01010 0000000000000000
50lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35 9
10 0 0 10
17 10 0
32 43 9 10
0
Translate to MIPS Machine language using binary
100011 01001 01010 0000000000000000 000000
01010 10001 01010 00000 100000
51lw t2, 0(t1) Temp reg t2 Ai add
t2, t2, s1 t2 Ai h sw t2,
0(t1) Store t2 into Ai
s117, t19, t210
Translate to MIPS Machine language using decimal
op rs rt rd
address/shamt funct 35 9
10 0 0 10
17 10 0
32 43 9 10
0
Translate to MIPS Machine language using binary
100011 01001 01010 0000000000000000 000000
01010 10001 01010 00000 100000 101011 01001
01010 0000000000000000
52Two Key Principles
- Instructions are represented the same as numbers
- Programs are stored in memory to be read or
written just like numbers
53Two Key Principles
- Instructions are represented as numbers
- Programs are stored in memory to be read or
written just like numbers - This is the Stored Program Concept
- Programs can operate on other programs!