Sun, 30 October 2016, 21:00

A student writes:

> Dr.  Patt
> In the lab 4 Descriptor,  under the heading Things to Consider,  point 1
> it's mentioned that the User Stack should start at address xFDFF i.e. The
> initial user stack pointer values hold be xFE00.  Now we can store the
> whole 16 bit value in a single go so shouldn't it be initialized with value
> of xFE00 so that we save it and decrement it by 2 each time.

I do not understand what you are asking me.  It seems like you are correctly
repeating what is in the lab description:

"The user stack should start at address xFDFF (i.e. the initial user
stack pointer value should be xFE00) and the supervisor stack should
start at address x2FFF (i.e. the initial supervisor stack pointer
value should be x3000)."

I thought this was clear, but to be sure everyone is on board: the stack begins
at xFDFF which means if the stack is empty SP = xFE00.  If a word is pushed
onto an empty stack, the 16 bits will be stored in xFDFE and xFDFF, and SP
will contain xFDFE.

> Another doubt is regarding the PSR, what are the other bits of PSR signify
> and where are they used.

I thought this was spelled out in Appendix A?  Not all bits of PSR are
specified.  PSR[15] is the privilege bit, PSR[10:8] define the priority of
the process, and PSR[2:0] contain the condition codes.

> And my last question is when we encounter a interrupt we save the PSR and
> PC-2 value in stack and then load PC with base register of interrupt added
> with I TV shifted by 1 bit. It means that the base register values should
> be hard coded in the micro architecture for each kind of interrupt.
> <<name withheld to protect the student who needs to read the lab descriptor>>

No, this is not correct.  Have you read what is written in the lab
description and in Appendix A?  Was it not clear?  (Incidentally, I assume
you meant "INTV" and not "I TV.")

We load PC with the starting address of the service routine.  The starting
address is contained in an interrupt vector table that contains the starting
addresses for all interrupt service routines.  The table starts at x0200, so
the memory location containing the starting address for a particular interrupt
service routine is obtained by left shifting INTV one bit and adding that to
the base address of the table (x0200).  Do you understand why?

So, no, the starting addresses are not hard wired into the microarchitecture.
They are written into the interrupt vector table by the O/S.

Hope all this helps.  Please read the documentation carefully.  Good luck
with lab 4 and the rest of the course.

Yale Patt