Question

In: Computer Science

How does one find the binary and hex for MIPS instructions. Such as, sub $s1, $t7,...

How does one find the binary and hex for MIPS instructions. Such as, sub $s1, $t7, $t8 or lw $s1, 400($s5) ???

Solutions

Expert Solution

Greetings!!

Q1:sub $s1, $t7, $t8

Step 1: Identify the instruction format. Example:sub instruction is R-format.

Step 2: Get the instruction syntax Example: sub rd,rs,rt

Step 3: Get the instruction encoding format:

Opcode rs rt rd shamt func
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits

Step 4:Add the binaries of the respective opcode and register numbers into the encoding format

Opcode rs rt rd shamt func
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
000000 00111 01000 00001 00000 100010

Step 5: Arrange the bits in group of 4 and write the hex equivalent. 0000 0000 1110 1000 0000 1000 0010 0010

0x00E8082

Q2:lw $s1, 400($s5)

Step 1: Identify the instruction format. Example:sub instruction is I-format.

Step 2: Get the instruction syntax Example: lw rt,imm(rs)

Step 3: Get the instruction encoding format:

Opcode rs rt imm
6 bits 5 bits 5 bits 16 bits

Step 4:Add the binaries of the respective opcode and register numbers into the encoding format

Opcode rs rt imm
6 bits 5 bits 5 bits 16 bits
100011 00101 00001 000000110010000

Step 5: Arrange the bits in group of 4 and write the hex equivalent. 1000 1100 1010 0001 0000 0001 1001 0000

0x8CA10190

Hope this helps


Related Solutions

How to convert binary to hex?
How to convert binary to hex?
How does one find the earnings to subject tax?
How does one find the earnings to subject tax?
I have this MIPS code and I need to find: add f,g,h add f,f,i sub f,f,j...
I have this MIPS code and I need to find: add f,g,h add f,f,i sub f,f,j a. How many bits does it take to encode ? b. How many bits needed in register file to store the data?
What is the open point in a sub-network of distribution substations? How does it operate?
What is the open point in a sub-network of distribution substations? How does it operate? Please provide specific details.
sub: Cost Estimating Q1: how does these factors influence the estimated cost of a project: -...
sub: Cost Estimating Q1: how does these factors influence the estimated cost of a project: - Size of the project - year of construction - site location provide with examples
Somatosensation is more than one thing. How many sub-senses are there in the sense of touch...
Somatosensation is more than one thing. How many sub-senses are there in the sense of touch (not including temperature, kinesthesia and proprioception)? What are the receptors for each of these and what are the distinguishing characteristics of each receptor or channel?
How does indicator works and how does one select an indicator?
How does indicator works and how does one select an indicator?
I. Instructions: Read the following question and briefly answer the following: 1. Explain, How does teamwork...
I. Instructions: Read the following question and briefly answer the following: 1. Explain, How does teamwork benefit the leader's role?
In 200 words or more : How does one understand the valuation process? How is one...
In 200 words or more : How does one understand the valuation process? How is one able to do a valuation?
How does one get Alzheimers disease ?
How does one get Alzheimers disease ?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT