Question

"Encode the following instruction to binary: SUB X2, X7, 0x804" I believe this follows R type...

"Encode the following instruction to binary:

SUB X2, X7, 0x804"

I believe this follows R type instruction format, however, the 0x804 exceeds the bits provided in the "Rm" field.

Please provide solution and explain if possible.

Homework Answers

Answer #1

Solution:

Giving you a solution for above instruction as

Format:
SUB rd, rs, rt [R-type]

Instruction:

SUB X2, X7, 0x804

Answer:   180400E2 //SUB X2, X7, 0X804 hexadecimal value,now convert it into binary follows,

(180400E2)16 = (00011000000001000000000011100010)2

so,

Your binary code for above instruction is:::--- 00011000000001000000000011100010

Purpose:
To subtract 32-bit integers. If overflow occurs, then trap.

Description:
rd <- rs - rt
The 32-bit word value in GPR rt is subtracted from the 32-bit value in GPR rs to produce a 32-bit result. If the subtraction results in 32-bit 2's complement arithmetic overflow then the destination register is not modified and an Integer Overflow exception occurs. If it does not overflow, the 32-bit result is placed into GPR rd.

Restrictions:
On 64-bit processors, if either GPR rt or GPR rs do not contain sign-extended 32-bit values (bits 63..31 equal), then the result of the operation is undefined.

Operation:
if (NotWordValue(GPR[rs]) or NotWordValue(GPR[rt])) then UndefinedResult() endif
temp <- GPR[rs] - GPR[rt]
if (32_bit_arithmetic_overflow) then
 SignalException(IntegerOverflow)
else
 GPR[rd] <- temp
endif


SUBU performs the same arithmetic operation but, does not trap on overflow.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
You have two puzzles with parameters as follows: Puzzle A: One sub-puzzles. k = 7. Puzzle...
You have two puzzles with parameters as follows: Puzzle A: One sub-puzzles. k = 7. Puzzle B: Four sub-puzzles. k = 5. You should provide, for both cases other than part (b), the following: (a) The distribution of the number of cases that require each number of hashes. (b) Explain the method you used to obtain your distributions. Don’t go into too many details or show working, it’s more \I wrote a C++ program to ... and then using ......
I have the following problem. Of the problem, I think about (a) as follows, but I...
I have the following problem. Of the problem, I think about (a) as follows, but I cannot understand (b). Please tell me the solution to the problem of (b) . the problem: Suppose you are in charge of setting the price for commercial advertisements shown during Enemies, a top network television show. There is a 60-minute slot for the show. However, the running time for the show itself is only 30 minutes. The rest of the time can be sold...
Following is the whole proposal and for that I need a logical design (ERD), Q. Map...
Following is the whole proposal and for that I need a logical design (ERD), Q. Map all different types of entities and relationships, provide definitions of entities and relationships. Zameen.com is Pakistan's first and biggest property portal and is amongst the world's top five property portals. It was founded in 2006 and has since revolutionized Pakistan's real estate industry by linking online buyers and sellers in a very convenient way, making it a worldwide household name among Pakistanis. This is...
Analysis: This section should include the issue register as a bare minimum, but may include also...
Analysis: This section should include the issue register as a bare minimum, but may include also why-why diagrams, a Pareto chart, a waste table and/or value-added analysis table. Flow analysis or simulation of this case study might be possible but might require making a lot of assumptions given the provided data. The first part of the project: Introduction    Walmart has continued to retain the top position on the Fortune 500 list for a consecutive fifth year. The brand has...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant agency which integrates the supply chain for companies B. A 2 PL or a 3PL, but not a 4PL C. A company supplying transportation and warehousing services D. A logistics service company specialized in suppling VAS (value added services) 2. What characterizes a 4 PL? (1 point) A. They are non-asset based and provides integrated services primarily supplied by asset based providers, for example...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
In February 2012, the Pepsi Next product was launched into the US market. This case study...
In February 2012, the Pepsi Next product was launched into the US market. This case study provides students with an interesting insight into PepsiCo’s new product process and some of the challenging decisions that they faced along the way. Pepsi Next Case Study Introduction Pepsi Next was launched by PepsiCo into the US market in February 2012, and has since been rolled out to various international markets (for instance, it was launched in Australia in September 2012). The new product...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT