12/10/04
A student writes:
Hi,
Hi.
On problem 5 of exam 2, wouldn't the PC increment from x3001 to x3002 during the fetch phase of the instruction cycle (when processing the BRz instruction)?
Certainly.
Thank you, << name withheld to protect one who did not read the question >>
You were asked to trace the program. And just to be
sure that we weren't sneaking in a new word on you (since perhaps you have
been disinclined to be in our company each time we used the word "trace"),
we added the following sentence in the statement of the problem:
So, yes, just before BRz is executed, PC is x3001. So we record x3001. And
DURING the execution of BRz, in fact during the fetch phase as he points out,
PC is incremented to x3002. But before BRz completes execution, PC is changed
again, this time to x3003. At the beginning of the next instruction, PC is
x3003. So, we record x3003. At the beginning of NO instruction is PC = x3002,
so we don't record it. OK?
Just to be sure everyone gets it: To trace a program is to record the
execution of each instruction in the program in the order that each
instruction gets executed. If an instruction is executed twice, it
gets recorded twice. If an instruction does not get executed (like the
instruction at x3002 in the problem), then we do not record it at all.
Yale Patt By trace we mean record the value of the PC at the beginning of
each instruction in the order that they are executed.