Question

The field is used by arithmetic and conditional branch instructions.

First question is:

What would be the range of values which can be stored in an immediate arithmetic instruction and conditional branch?

Second is:

if a MIPS processor has 64 registers, how would you change the immediate instruction format to reference these registers? How would I draw and label the format?

Was it helpful?

Solution

Part 1:

As illustrated by this diagram:

MIPS instruction formats

The I-Type instruction has 16 bits reserved for the immediate field. This of course means that the immediate field can take on 216 possible values. If we consider that the immediate field can be positive or negative (1 bit is used for the sign) we can see that the max would be 215 - 1 and the min would be −(215 - 1).

andi, ori, and xori zero-extend the immediate (0 to 216 - 1), while all other MIPS I-type instructions sign-extend the immediate/offset.


Part 2:

Again, looking at the diagram above we can see that the rs and rt registers are specified with 5 bits. This is because there are 32 registers in the mips instruction set — i.e. 25. If there were instead 64 registers, both the rs and rt fields would need to be 6 bits long, thus leaving only 14 bits for the immediate field.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top