Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Is the PC (program counter) unsigned? 2. When branching, is the \'label\' par

ID: 3536899 • Letter: 1

Question

1. Is the PC (program counter) unsigned?


2. When branching, is the 'label' part of the instruction added to the PC or is the 'label' the location the PC jumps to irrespective of the current PC?


Example #1:

0001000 10000 10001 1111111111111100 is equivalent to beq $s0, $s1, -4 correct?

If that is correct, I am assuming you need to add -4 to the current PC because as question #1 implies, I am thinking the PC is unsigned.


Example #2:

If the current PC = 10110000 01010101 11111111 00001100 and the jump instruction '000010 11101010100000000011111111' is executed, is the 26 bit target location where the PC will jump to? If so, that means the current PC value is superfluous correct? What would the new PC location be?


Explanation / Answer

1) pc is unsigned


2) Label is added to PC.

However before adding, two 0 bits are appended to the end of the label value (this is so because jumps can only be made to word,ie word sized..consisting of 2^2 or 4 bytes )


Example1:

while writing the values we usually take the two added zeroes into account. In this case it is correct. -4 is added to the PC.


Example 2

The pc is updated as soon as jmp is executed, so that the next instruction is loaded which is the next value of pc.

In this case ,the new PC value is got by changing the last 28bits of PC to the given value,(the 26 bit value given with Label with 2 appended 0 at the end) The first 4 bits of PC remain the same.

Thus new PC value is: 1011 11101010100000000011111111 00

( this is so because jmp can only be made inside one memory block, not farther )