Professional Documents
Culture Documents
Tutorial Computer Architecture
Tutorial Computer Architecture
Write the program to compute the function using the address instruction types below. Do
not modify the values of A, B, C, D and E. You may use X or any temporary location T to
store intermediate results.
i.
3 address instructions
ii.
SUB A, B, X
SUB C, D, T
ADD X, T, X
MULT X, E, X
2 address instructions
(1 mark)
(1 mark)
LOAD A, X
SUB B, X
ADD C, X
SUB D, X
MULT E, X
iii.
1 address instruction
(1 mark)
LOAD
SUB
ADD
SUB
MULT
STORE
b)
A
B
C
D
E
X
Given the time to fetch, decode and execute each instruction as follows:
Instruction type
3 address instruction
2 address instruction
1 address instruction
Calculate the time to compute the above function for each addressing instructions.
(3 marks)
Ans:
100ns x 4 = 400ns (3 address instruction)
70ns x 5 = 350ns(2 address instruction)
50ns x 6 = 300ns(1 address instruction)
c)
(3 marks)
3 address instruction
(3 marks)
Instruction
SUB A, B, X
SUB C, D, T
ADD X, T, X
MULT X, E, X
Instruction fetch
7
7
7
7
Data traffic
6
6
6
6
Total
13
13
13
13
28
24
52 bytes
Instruction fetch
Data traffic
Total
5
5
5
5
5
4
6
6
6
6
9
11
11
11
11
25
28
53 bytes
Instruction fetch
3
3
3
3
3
3
Data traffic
2
2
2
2
2
2
Total
5
5
5
5
5
5
18
12
30 bytes
2 address instruction
Instruction
LOAD A, X
SUB B, X
ADD C, X
SUB D, X
MULT E, X
1 address instruction
Instruction
LOAD A
SUB B
ADD C
SUB D
MULT E
STORE X
Question 2
Below is an ARC assembly program to compute X which is a function of A, B and D.
.begin
.org 1200
ld [C],%r1
ld [A], %r2
ld [B], %r3
ld [D], %r4
label1: orncc %r2, %r2, %r5
orncc %r3, %r2, %r6
orncc %r4, %r5, %r7
andcc %r4, %r3, %r8
orncc %r6, %r7, %r9
orcc %r6, %r8, %r10
st %r10, [X]
addcc %r1, -1, %r1
be label2
ba label1
label2: halt
A:
2
B:
3
C:
4
D:
1
X:
0
.end
HexLoc
i.
c20024f4
iv. be label2
02800002
v. ba label1
10bffff7
(18 marks)
Address
1216
1256
1260
1264
1268
1272
1276
(4 marks)