Question: Only the popq instruction uses both register file write ports simultaneously. For the instruction popq %rsp, the same address will be used for both the
Only the popq instruction uses both register file write ports simultaneously. For the instruction popq %rsp, the same address will be used for both the E and M write ports, but with different data. To handle this conflict, we must establish a priority among the two write ports so that when both attempt to write the same register on the same cycle, only the write from the higher-priority port takes place. Which of the two ports should be given priority in order to implement the desired behavior, as determined in Practice Problem 4.8?
Problem 4.8
The following assembly-code function lets us determine the behavior of the instruction popq %rsp for x86-64:

We find this function always returns 0xabcd. What does this imply about the behavior of popq %rsp? What other Y86-64 instruction would have the exact same behavior?
1 2 3 5 6 7 8 text .globl poptest poptest: movq pushq popa movq movg ret %rap, %rdi $0xabcd %rsp %rap. %rax %rdi. %rsp Save stack pointer Push test value Pop to stack pointer Set popped value as return value Restore stack pointer
Step by Step Solution
3.45 Rating (158 Votes )
There are 3 Steps involved in it
As we found in Practice Problem 416 we want the write via the M port to ta... View full answer
Get step-by-step solutions from verified subject matter experts
