1

I have a question, which is kind of confusing

Write the MIPS instruction whose machine language encoding is:
0000 0011 0001 1001 0100 0000 0010 1010
Your answer must use register names (like $t0) not numbers; and must specify
any immediate as a signed integer in decimal.

The answer, in the back has something to do with slt. Can someone explain, WHAT exactly the question is asking, and what the answer is?

thanks

starblue
  • 55,348
  • 14
  • 97
  • 151
smooth_smoothie
  • 1,319
  • 10
  • 27
  • 40

2 Answers2

3

When programming, nowadays you typically write in a high-level language such as C or Java, your compiler breaks it down into assembly language (MIPS, x86, etc.) and then assembles it into machine language (binary) which your processor can natively interpret.

This is one instruction that a MIPS processor would be able to interpret and execute. The question is asking you to translate this back into MIPS assembly language. You should definitely have a MIPS instruction reference to assist you with this. Here's a good one if you don't have one:

http://www.d.umn.edu/~gshute/spimsal/talref.html#rtype

(Hint: The instruction we're looking at now is an R-Type instruction, meaning it is an instruction that operates directly on registers, without using immediate values.)

If you look at the top table, it breaks down a MIPS R-type instruction. The first 6 bits are the opcode. You'll notice the first 6 bits of your instruction are 0, that's because all R-type instructions have 000000 for the opcode, and the processor knows what instruction it's dealing with by using the FUNCT field, which is how we know "slt" is the instruction we're looking at (see reference).

All you really need now is to know which register names map to which register numbers (ie.register 8 might be $t0). Here's a reference for that:

http://logos.cs.uic.edu/366/notes/mips%20quick%20tutorial.htm
zpr
  • 2,886
  • 1
  • 18
  • 21
3

Assembly instructions have a representation for the machine as bits, that's the one you are given.

They also have a textual representation to make it easier for humans to read and write them, that's the one you are asked.

You need to understand how to extract the parts of the textual representation from the binary one. With slt you are on the right track, it remains to find the registers or constants used in the instruction. You ought to have some MIPS instruction reference that specifies what the bit pattern of this instruction means.

starblue
  • 55,348
  • 14
  • 97
  • 151