Professional Documents
Culture Documents
Group 3
COA Assignment :
Presented by :
Write an assembly language program to add R01 and R02 .Compare the resultant
contents with R03 for the following 2 cases
i) R01=10,R02=20 ,R03 = 40
1
Group 3 COA Assignment Section - A
2
Group 3 COA Assignment Section - A
If resultant is greater than R03, then increment R09 else increment R10
3
Group 3 COA Assignment Section - A
2)R01=10,R02=20 ,R03 = 20
4
Group 3 COA Assignment Section - A
Iteration 1
Address Instruction Hits Misses %Misses
0 MOV #10, R01 0 1 100
6 MOV #20, R02 1 0 50
12 MOV #20, R03 1 0 33.33333
18 ADD R01, R02 1 0 25
23 CMP R02, R03 0 1 40
28 JGT $L1 1 0 33.33333
32 INC R10 1 0 33.33333
35 HLT 1 0 33.33333
36 L1: 0 0 33.33333
36 INC R09 0 1 42.85714
39 HLT 1 0 37.5
When program is executed for the first time, it looks for the instructions in
memory cache. As the cache is empty, there is will be a miss. Hence, 4
instructions would be fetched from the memory to the cache. For next 3
instructions there would be a hit. Again, for the 4th instruction there will be a miss.
Therefore, next 4 instructions will be fetched with 1 miss and 3 hits. So, total 8
instructions will be fetched with 5 hits and 3 misses.
5
Group 3 COA Assignment Section - A
Iteration 2
Address Instruction Hits Misses %Misses
0 MOV #10, R01 0 1 33.33333
6 MOV #20, R02 1 0 30
12 MOV #20, R03 1 0 27.27273
18 ADD R01, R02 1 0 25
23 CMP R02, R03 0 1 23.07692
28 JGT $L1 1 0 21.42857
32 INC R10 1 0 21.42857
35 HLT 1 0 21.42857
36 L1: 0 0 21.42857
36 INC R09 0 1 20
39 HLT 1 0 18.75
In second iteration all instructions will be in the Cache hence 0 misses and 8 hits
would be there.
6
Group 3 COA Assignment Section - A
Iteration 3
Address Instruction Hits Misses %Misses
0 MOV #10, R01 0 1 6.666667
6 MOV #20, R02 1 0 6.25
12 MOV #20, R03 1 0 5.882353
18 ADD R01, R02 1 0 5.555556
23 CMP R02, R03 0 1 10
28 JGT $L1 1 0 9.52381
32 INC R10 1 0 100
35 HLT 1 0 100
36 L1: 0 0 100
36 INC R09 0 1 13.04348
39 HLT 1 0 12.5
Similarly iteration all instructions will be in the Cache hence 0 misses and 8 hits
would be there. But the total number of hits have increased and misses have
remain same hence hit miss ratio reduces every time we execute same program
again.
7
Group 3 COA Assignment Section - A
Ans.
II) R01=10,R02=20 ,R03 = 40
Total of 32 instruction can be loaded in the cache.As block size is 8
therefore total eight instruction would be fetched in each time there is a
miss in the cache.
Iteration 1
Address Instruction Hits Misses %Misses
0000 MOV #10, R01 0 1 18.18
0006 MOV #20, R02 1 0 16.67
0012 MOV #20, R03 1 0 15.38
0018 ADD R01, R02 1 0 14.29
0023 CMP R02, R03 1 0 13.33
0028 JGT $L1 1 0 12.50
0032 INC R10 1 0 11.76
0035 HLT 1 0 11.11
0036 L1: 0 0 11.11
0036 INC R09 0 1 10.53
0039 HLT 1 0 10.00
8
Group 3 COA Assignment Section - A
When program is executed for the first time, it looks for the instructions in
memory cache. As the cache is empty, there is will be a miss. Hence, 8
instructions would be fetched from the memory to the cache. For next
7instructions there would be a hit. So, total 8 instructions will be fetched with 6
hits and 2 misses.
Iteration 2
Address Instruction Hits Misses %Misses
0000 MOV #10, R01 1 1 18.18
0006 MOV #20, R02 2 0 16.67
0012 MOV #20, R03 2 0 15.38
0018 ADD R01, R02 2 0 14.29
0023 CMP R02, R03 2 0 13.33
0028 JGT $L1 2 0 12.50
0032 INC R10 2 0 11.76
0035 HLT 2 0 11.11
0036 L1: 0 0 11.11
0036 INC R09 1 1 10.53
0039 HLT 2 0 10.00
9
Group 3 COA Assignment Section - A
In second iteration all instructions will be in the Cache hence 0 misses and 8 hits
would be there.
Iteration 3
Address Instruction Hits Misses %Misses
0000 MOV #10, R01 2 1 9.52
0006 MOV #20, R02 3 0 9.09
0012 MOV #20, R03 3 0 8.70
0018 ADD R01, R02 3 0 8.33
0023 CMP R02, R03 3 0 8.00
0028 JGT $L1 3 0 7.69
0032 INC R10 3 0 7.41
0035 HLT 3 0 7.14
0036 L1: 0 0 7.14
0036 INC R09 2 1 6.90
0039 HLT 3 0 6.67
Similarly iteration all instructions will be in the Cache hence 0 misses and 8 hits
would be there. But the total number of hits have increased and misses have
remain same hence hit miss ratio reduces every time we execute same program
again.
10
Group 3 COA Assignment Section - A
d)Show, explain and justify with pipelining and without pipelining stages w.r.t the
below table parameters
When the program is executed without pipeline all the resource are used only by single
instruction hence would sit idle if that instruction has not finished its execution. So would take
longer to complete.
Using pipeline no resources will sit idle and hence would complete the program much faster.
11