# Need help converting machine code

I would appreciate some help with this question.

The 32 bit numbers below represent a MIPS instruction. identify the different fields and state which instruction it is. give the assembler source code that can be converted into this instruction.

001000|10001|10010|0000000000001111

I separated the bits and I know the first 6 bits are the opcode and given the opcode it means Addi. The last 16 bits are the immediate value which I have converted to 15. I do need help with the registers and converting the binary into the register number. I have looked everywhere and can not find an explanation. Any help would be appreciated. i know the structure takes this format:

You've basically got the answer already: the s register is number 0b10001 = 17, the t register is number 0b10010 = 18.
The instruction is not quite the way you've said it: standard MIPS has the registers in the opposite order, so it's opcode rs rt immediate. The opcode is 0b001000 = 8 = ADDI; rs is 0b10001 = 17 = $s1; rt is 0b10010 = 18 = $s2; the immediate value is 0b0000000000001111 = 15.
(The prefix 0b indicates that the following number is in binary.)
• Thank you. i haven't been able to find an information on it. would i need to write $t17? – jessie Aug 31 '18 at 20:24 • @jessie For the registers? For e.g. register 17 you can either use $17 or $s1 (its symbolic name). – Draconis Aug 31 '18 at 20:30 • is there an efficient way to convert say r17 to its symbolic name$s1? – jessie Aug 31 '18 at 20:32