-2

If the set of MIPS instructions were changed to accommodate 128 records and 4 times more instructions type-I, which would be the largest hexadecimal immediate value that could be supported, keeping the 32-bit instructions?

1
  • 1
    What are records? Do you perhaps mean registers?
    – Erik Eidt
    Oct 29, 2016 at 17:02

1 Answer 1

1

Assuming you mean registers not records:

Most of what you're asking about is a matter of encodings which are done with bits.

4x more means 2 more bits are needed, because log2(4) = 2, or in other words, 4 = 22.

The current Type-I instructions:

I instructions are converted into machine code words in the following format:

opcode  rs         rt   IMM
6 bits  5 bits  5 bits  16 bits

The current register fields are 5 bits which can accommodate designation of 25 = 32 different registers. To take that to 128 registers, you'd need log2(128) = 7 (also that 27 = 128) bits, meaning 2 more bits than now.

So in total:

4x more opcodes:   2 more bits are needed.
4x more registers: 2 more bits are needed per register field for a total of 4 more bits

That all adds up to 6 more bits required, which would leave 10 bits left for the immediate field instead of the current 16.

10 bits can be used to represent an unsigned range from 0 to 210-1 or from 0 to 1023. Or 10 bits can be used to represent a signed range from -29 to +29-1, or -512 to 511. There are other encodings possible (one's complement, or, say ranging, from 1 to 1024), but there are only 210 = 1024 possible values that can be differentiated in 10 bits.


1
  • Thank you, I'm still new to all of "this" and sometimes questions like these can feel overwhelming. Oct 29, 2016 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.