Look at the assembly instructions below. These instructions will be pipelined to
ID: 3817880 • Letter: L
Question
Look at the assembly instructions below. These instructions will be pipelined to speed up the code execution. Unfortunately the code cannot be pipelined as is due to data dependencies. Add 'NOP' instruction in the code below at the appropriate locations to ensure that pipelining can be accomplished. (blank means do not add a NOP", 1NOP means add one line of "NOP, 2NOP means add two lines of 'NOP, 3NOP means add three lines of NOP) mov $10, 9seax Choose add $2, %eax Choose mov $4, %ebx Choose mov $5, %ecx Choose add $1, %ebx Choose add $1, %ecx ChooseExplanation / Answer
//pipeline can be done with NOP
solution:
mov $10, %eax
3NOP
add $2, %eax
(blank/No NOP)
mov $4, %ebx
(blank/No NOP)
mov $5, %ecx
2NOP
add $1, %ebx
(blank/No NOP)
add $1, %ecx
3NOP
add %ecx, %eax
(blank/No NOP)
add %ebx, %eax $10, %eax
Explanation:
Instruction Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
mov $10, %eax F D E M W
NOP
NOP
NOP
add $2, %eax F D E M W
mov $4, %ebx F D E M W
mov $5, %ecx F D E M W
NOP
NOP
add $1, %ebx F D E M W
add $1, %ecx F D E M W
NOP
NOP
NOP
add %ecx, %eax F D E M W
add %ebx, %eax F D E M W
where f->fetch, D->decode, E->excute, M-> memory access, W-> write
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.