CS计算机代考程序代写 Quiz12

Quiz12
Due No due date Points 10
Questions 4 Available until Mar 24 at 4:20pm Time Limit 60 Minutes
Instructions
You can take this quiz only once.
Once you start the quiz, you will need to complete it.
This quiz was locked Mar 24 at 4:20pm.
Attempt History
Attempt Time Score
LATEST Attempt 1 9 minutes 10 out of 10
Score for this quiz: 10 out of 10 Submitted Mar 24 at 4:03pm This attempt took 9 minutes.
Question 1
0 / 2 pts
Consider executing the following code on the pipelined datapath that we discussed in class.
During the 6th cycle, which register(s) are being read (using the register file) using the following set of instruction? (Note: can be more than 1 register)

add $t2, $t3, $t1 sub $t4, $t3, $t5 add $t5, $t3, $t7 add $t7, $t6, $t1 add $t8, $t2, $t6
sub $t7, $t3, $t1
$t1 $t2 $t3 $t4 $t5 $t6
$t8
orrect Answer
orrect Answer
ou Answered
$t7
Y

During the 6th cycle, the instruction ¡°add $t8, $t2, $t6¡± is reading from register(s).
Question 2
0 / 2 pts
Consider executing the following code on the pipelined datapath that we discussed in class.
During the 6th cycle, which register(s) are being written (using the register file)?
add $t2, $t3, $t1 sub $t4, $t3, $t5 add $t5, $t3, $t7 add $t7, $t6, $t1 add $t8, $t2, $t6
sub $t7, $t3, $t1
$t1 $t2 $t3

orrect Answer
$t4 $t5 $t6
$t8 $t9
ou Answered
$t7
During the 6th cycle, the instruction ¡°sub $t4, $t3, $t5¡± is writing to a register
Question 3
Not yet graded / 4 pts
Consider executing the following code on the pipelined datapath that we discussed in class.
add $t2, $t3, $t1 sub $t4, $t3, $t5 add $t5, $t3, $t7 add $t7, $t6, $t1 add $t8, $t2, $t6
sub $t7, $t3, $t1
Y

Explain what the forwarding unit is doing during the 6th cycle of execution. [explanation], Which registers are being compared? List all pairs of registers that are compared during the 6th cycle for the forwarding unit.
(First, you need to determine which instruction’s values are in the EX/MEM, which instruction’s values are in the MEM/WB register, and which instruction’s values are read from the ID/EX register during the 6th cycle. Then check the conditions for forwarding.)
Your Answer:
There are several dependencies in this code fragment: i) Generates value in $t2 used in 2,7
ii) Generates value in $t4 used in 2
iii) Generates value in $t5 used in 4
iv) Generates value in $t7 used in 5
v) Generates value in $t8used in 6,7
vi) Generates value in $t7has no dependency vii) Generates value in $t7 has no dependencies
1 2 3 4 5 6 7 8 9 10 11 add $t2, $t3, $t1 |IF|ID|EX|MEM|WB|
sub $t4, $t3, $t5 |IF|ID|EX|MEM|WB| add $t5, $t3, $t7 |IF|ID|EX|MEM|WB| add $t7, $t6, $t1 |IF|ID|EX|MEM|WB|
lw $t5, 12($t9) |IF|ID|EX|MEM|WB|

add $t8, $t2, $t6 |IF|ID|EX|MEM|WB|
sub $t7, $t3, $t1, $t5 |IF|ID|EX|MEM|WB|
ID/EX pipeline register contains information from the instruction ¡°add $t7, $t6, $t1¡±
EX/MEM pipeline register contains information from the instruction ¡°add $t5, $t3, $t7¡±
MEM/WB pipeline register contains information from the instruction ¡°sub $t4, $t3, $t5¡±
Since the forwarding unit checks the following 4 conditions to compare registers:
EX/MEM.RegisterRd = ID/EX.RegisterRs EX/MEM.RegisterRd = ID/EX.RegisterRt MEM/WB.RegisterRd = ID/EX.RegisterRs MEM/WB.RegisterRd = ID/EX.RegisterRt
It will be comparing: t5 and t6
t5 and t1
t4 and t6
t4 and t1
It also checks is t5 and t4 will be written. (EX/MEM. RegWrite=1 and MEM/WB. RegWrite=1)

Question 4
Not yet graded / 2 pts
Consider executing the following code on the pipelined datapath that we discussed in class.
add $t2, $t3, $t1 sub $t4, $t3, $t5 add $t5, $t3, $t7 add $t7, $t6, $t1 add $t8, $t2, $t6
sub $t7, $t3, $t1
Explain what the hazard detection unit is doing during the 6th cycle of execution. Which registers are being compared? List all pairs of registers that are compared during the 6th cycle for the hazard detection unit. (You need to determine which instruction’s values are in the IF/ID and which instruction’s values are in the ID/EX register during the 6th cycle. Then check the conditions for the hazard detection.)
List all pairs of registers that are compared:
Your Answer:

There are several dependencies in this code fragment: i) Generates value in $t2 used in 2,7
ii) Generates value in $t4 used in 2
iii) Generates value in $t5 used in 4
iv) Generates value in $t7 used in 5
v) Generates value in $t8used in 6,7
vi) Generates value in $t7has no dependency vii) Generates value in $t7 has no dependencies
1 2 3 4 5 6 7 8 9 10 11 add $t2, $t3, $t1 |IF|ID|EX|MEM|WB|
sub $t4, $t3, $t5 |IF|ID|EX|MEM|WB| add $t5, $t3, $t7 |IF|ID|EX|MEM|WB| add $t7, $t6, $t1 |IF|ID|EX|MEM|WB|
lw $t5, 12($t9) |IF|ID|EX|MEM|WB|
add $t8, $t2, $t6 |IF|ID|EX|MEM|WB|
sub $t7, $t3, $t1, $t5 |IF|ID|EX|MEM|WB|

Quiz Score: 10 out of 10
During the 6th cycle,
ID/EX pipeline register contains information from the instruction ¡°add $t7, $t6, $t1¡±
IF/ID pipeline register contains information from the instruction ¡°add $t8, $t2, $t6¡±
The hazard detection unit (for a possible stall) will check if:
if (ID/EX.MemRead=1 and ((ID/EX.RegisterRt=IF/ID.RegisterRs) or (ID/Ex.RegisterRt=IF/ID.RegisterRt)))
Thus it will compare registers: t1 and t2
t1 and t6
Also checks if the instruction ¡°add $t7, $t6, $t1¡± reads from data memory (in this case, it does not, thus there will be no stall.)

This quiz score has been manually adjusted by +10.0 points.