rroblem 6 (a2 points. Suggested time: 20 mins) Consider the following assembly c
ID: 3709813 • Letter: R
Question
rroblem 6 (a2 points. Suggested time: 20 mins) Consider the following assembly code (CLi is a label. I-17 are just notations we add so that w can easily refer to an instruction; they are not part of the program) li: mosq So, %rax L1 12: 13: 14: 15: 16: 17: movq %rdi, %rdx andq $1, %rds addq %rdx, %rax shrq $1, %rdi jne .Li ret Assume that %rdi is loaded with oxoF before the program starts. Part a (3 points): What is the value of %rax after the code returns? Part b (3 points): In a single-cycle, sequential microarchitecture, how many cycles does this program take to finish? Part c (9 points): There are 4 pairs of read-after-write data dependencies. One of them is cli, 142 because 11 writes to %rax and 14 reads from %rax. What are the other three pairs? write the answers in the form of . (3 points) Pair i (3 points): Pair 2 (3 points): Pair 3 | 417,147 |Explanation / Answer
Answer is as follows:
Pipeline diagram for given scenario is as follows:
We will generate the Pipeline for one iteration where we assume that first prediction is as taken.
So the Pipeline Diagram is as follows :
So from above 5 stage pipeline diagram table we get there are 9 clock cycles needed to execute the list of instruction according to given scenario for one iteration.
Where
IF = Instruction Fetch
ID = Instruction Decode
EX = Execute Instruction
MEM = Memory ReadWrite
WB = Register Write
if there is any query please ask in comments..
Cycles-> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 movq $0,%rax IF ID EX MEM WB movq %rdi,%rdx IF ID EX MEM WB andq $1,%rdx IF ID EX MEM WB add1 %rdx,%rax IF ID EX MEM WB shrq $1,%rdi IF ID EX MEM WB jne L1 IF ID EX ret IF ID EXRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.