Sat, 5 Oct 2013, 01:26



My students,

I started responding just to the student who asked this question since
it is more a digression than critical information.  About halfway through
my answer, I decided that some of you might be interested in this also,
so I am responding to the class.  Feel free to delete it without reading,
or put it off for after the semester if you wish.

Meanwhile, hello from Istanbul.  It was a very long trip.  I hope to enjoy
some of it later today, once I get past all this email  :-)

A student writes:


 
> Prof Patt,
> 
> What's the purpose of designing the machine to increment the PC in the
> middle of the instruction during FETCH rather than at the end of the
> instruction? One would think this would avoid having to use the incremented
> PC to do calculations on where branches go etc.?
> 
> I am sure there is some method to the madness, so I thought I would ask.
> 
> << name withheld to protect the student responsible for more email to you>>


I was not around the first time it happened, so the convention was 
established well before me.  Not all computers increment PC in the
first cycle, only about 98% of them.  I do remember a machine back 
in the 1980s that incremented PC at the end, but that is the only
one I ever saw that did that.  By the way, it is not in the "middle,"
as you say, but rather in the first cycle of processing.

It always seemed to make sense to me.  At the point (very first cycle),
where you are using the PC to get the instruction, you increment PC
so that you can forget about it.  If the instruction is not a control
instruction, PC will be correct when you start the next instruction.

But it is a design issue, and there are usually many "correct" ways to solve
every design issue, depending on the taste and objectives of the designer.
Design is in some sense like art.  Is there one good painting?  ...or one
good piece of music?  

Most of us feel incrementing PC in the first cycle is the right way to go.  
That, of course, is not meant to stop you years from now when you design 
your own computer to do so at the end.  Since it is part of the 
microarchitecture and has no effect on the software when you do it (i.e.,
the software can operate correctly either way), it is totally up to you.

Good luck on the midterm.

Yale Patt