Professional Documents
Culture Documents
Lec06 - Instruction Set Archi Examples
Lec06 - Instruction Set Archi Examples
Lec06 - Instruction Set Archi Examples
3
Computer Organization & Architecture
Example:1
4
Computer Organization & Architecture
Example:2
5
Computer Organization & Architecture
Example:2
6
Computer Organization & Architecture
Example: 3
B[8] = A[i−j];
7
Computer Organization & Architecture
Solution:
8
Computer Organization & Architecture
Example:4
9
Computer Organization & Architecture
Part:1
10
Computer Organization & Architecture
Solution Part 1:
• temp = Array[0];
• temp2 = Array[1];
• Array[0] = Array[4];
• Array[1] = temp;
• Array[4] = Array[3];
• Array[3] = temp2;
11
Computer Organization & Architecture
Part:2
12
Computer Organization & Architecture
Solution Part 2:
• lw $t0, 0($s6)
• lw $t1, 4($s6)
• lw $t2, 16($s6)
• sw $t2, 0($s6)
• sw $t0, 4($s6)
• lw $t0, 12($s6)
• sw $t0, 16($s6)
• sw $t1, 12($s6)
13
Computer Organization & Architecture
Example:5
Solution:
14
Computer Organization & Architecture
Example:6
Solution: f = 2*(&A);
16
Computer Organization & Architecture