0
votes

Provide the type and assembly language for the following binary value:

0000 00 10 000 1 0001 0100 0 000 00 10 0000two (8 points)

R-type instruction

Binary Value 000000 10000 10001 01000 00000 100000

Assembly Code   Op = 0 (Add)    Rs = 16 ($s0)   
Rt = 17 ($s1)   Rd = 8($t0) Shamt = 0   Funct =  (add)

Add $t0, $s0, $s1

This is what I have gotten, but I’m unsure if it is correct. I’m unsure on how to convert binary code into instructions of r-type.

1
Is this homework, because you do not mention what architecture you are usingSimson
This is a hw problem, using MIPS languageJessica Garnica

1 Answers

1
votes

Your understunding looks correct

To analyze the binary instruction take a look at it as you were the CPU trying to execute it.

First have a look at the instruction set https://en.wikipedia.org/wiki/MIPS_architecture#Instruction_formats

The first 6 bits are always the OPcode. Opcode 0 encodes an R-type instruction, so fields funct and shamt must also be evaluated. In this case the opcode=000000 and the values of funct=100000 and shamt=00000.

On for instance this https://opencores.org/projects/plasma/opcodes list such combination can be identified as the ADD-instruction on the top row.

You have correctly identified the registers

rs=10000 16
rt=10001 17
rd=01000 8

So putting it all together

// R8=R16+R17

ADD R8,R16,R17

because of register names conventions this is also known as

ADD $t0,$s0,$s1