Software Pipeline: Problem C (10 Points) This problem involves the software pipe
ID: 3603180 • Letter: S
Question
Software Pipeline:
Problem C (10 Points) This problem involves the software pipelining of the MIPS loop code for the following loop written in C/C++ for (i = 100; i > 0; i--) Un-optimzed MIPS loop code: loop: L.D L.D MUL.D MUL.D MUL.D ADD.D S.D DADDUI BNEZ F4,1000 (R1) F6,2000 (R1) F8, F4,FO F10, F6, F4 F12, F10, F2 F14, F12, F8 F14,3000 (R1) R1,R1,#-8 R1, loop You are to assume the following: .FO has been initialized with the value of a, and F2 has been initialized with the value of b. .The x, y and z arrays begin at locations 1000, 2000 and 3000, respectively. RI has been initialized as the offset to the last elements of the x, y and z arrays. Write the software pipeline code for the main loop. For this part, you are to ignore the initialization of other register values. If possible, select appropriate instructions from 4 iterations of the loop a. Write the loop initialization code. You are still to assume that FO, F2, and Rl have been initialized as described above prior to the code that you are to write. Your code is to set up conditions such that the software pipeline code could be correctly executed. b.Explanation / Answer
01
#include<stdio.h>
02
int main() {
03
char prnt = '*';
04
int i, j, k, s, nos = 4;
05
for (i = 1; i <= 5; i++) {
06
for (s = nos; s >= 1; s--) {
07
printf(" ");
08
}
09
for (j = 1; j <= i; j++) {
10
printf("%2c", prnt);
11
}
12
for (k = 1; k <= (i - 1); k++) {
13
if (i == 1) { continue;
14
}
15
printf("%2c", prnt);
16
}
17
printf(" "); nos--;
18
}
19
nos = 1;
20
for (i = 4; i >= 1; i--) {
21
for (s = nos; s >= 1; s--) {
22
printf(" ");
23
}
24
for (j = 1; j <= i; j++) {
25
printf("%2c", prnt);
26
}
27
for (k = 1; k <= (i - 1); k++) {
28
printf("%2c", prnt);
29
}
30
nos++;
31
printf(" ");
32
}
33
nos = 3;
34
for (i = 2; i <= 5; i++) {
35
if ((i % 2) != 0) {
36
for (s = nos; s >= 1; s--) {
37
printf(" ");
38
}
39
for (j = 1; j <= i; j++) {
40
printf("%2c", prnt);
41
}
42
}
43
if ((i % 2) != 0) {
44
printf(" ");
45
nos--;
46
}
47
}
48
return 0;
49 }
01
#include<stdio.h>
02
int main() {
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.