Risc machine assembly

Assignment Help Software Engineering
Reference no: EM1378995

Consider the following loop:

S:= 0;
for K := 1 to 100 do
S : = S - K;

A straightforward translation of this into a generic assembly language would look something like this:

LD R1,0 ;KEEP VALUE OF S IN R1
LD R2,1 ;KEEP VALUE OF K IN R2
LP SUB R1,R1,R2 ;S := S - K
BEQ R2,100,EXIST ;DONE IF K = 100
ADD R2,R2,1 ;ELSE INCREMENT K
JMP LP ;BACK TO START OF LOOP

A compiler for a RISC machine will introduce delay slots into this code so that the processor can employ the delayed branch mechanism. The JMP instruction is easy to deal with, because this instruction is always followed by the SUB instruction; therefore we can simply place a copy of the SUB instruction in the delay slot after the JMP; The BEQ presents a difficulty. We can't leave the code as is, because the ADD instruction would then be executed one too many times. Therefore, a NOP instruction is needed. Show the resulting code.

 

Reference no: EM1378995

Questions Cloud

Determine the greatest magnitude negative number : Determine the greatest magnitude negative number one can represent in an 8-bit 2's complement code? Write your result in binary and decimal.
Linux commands : Project Linux commands. Please record all commands on a Microsoft Word Doc.
Approximate location of the laminar turbulent transition : Find the approximate location of the laminar turbulent transition - what is the net heat removed by the air around the rod?
Explain the action of the function : Explain the action of the function. Determine the function in the library that performs a similar calculation?
Risc machine assembly : A compiler for a RISC machine will introduce delay slots into this code so that processor can employ the delayed branch mechanism.
Key drawbacks of the numbered code : Think about the flashlight-messaging (ABC=123); Determine the key drawbacks of the Numbered Code?
Analysis of the real problems of an organisation : Prepare and hand in a project proposal including the nature of the project - The purpose of the Project is to apply the concepts and techniques of Lean Thinking to the analysis of the real problems of an organisation
Finding cause of the bug : The following LMC program is supposed to input two numbers, compare them, and output the higher of the two numbers.
Review of client business and perform audit risk analysis : Prepare a memo to the audit partner on the 'state of the company's industry' and associated risk factors -Understanding planning stage of the audit process-review of client business and perform audit risk analysis

Reviews

Write a Review

Software Engineering Questions & Answers

  Explanations on spreadsheet concepts

A workbook can contain more than one worksheet. Provide an example of a spreadsheet application where it would be necessary to have more than one worksheet, can you describe how that works?

  Question about newspaper popularity

Many people lament the fact that the printed newspaper's popularity is refusing so alarmingly that some of children of the new generations have never read a printed newspaper.

  Explain what aspects of project made it successful

What aspects of project made it "successful" in their definition? Would your organization explain this as successful? Explain why or why not?

  Development of a small software system

Analysis, design and development of a small software system.

  Use case diagram for personal trainer information system

Recognize possible use cases and actors, and create use case diagram for Personal Trainer information system. Select one of the use cases and create a class digram.

  Create storyboards interactivity diagram object dictionary

Create storyboards interactivity diagram object dictionary and any essential scripts for an interactive program for customers of sunflower floral designs.

  Explain clark-wilson model is implemented on computer system

Assume that the Clark-Wilson model is implemented on a computer system. Could a computer virus that scrambled constrained data items be introduced into the system?

  Finding output of the code sequence

Construct the pseudocode for a program that finds the sums of the numbers input that are greater than or equal to 10 and the numbers input that are less than ten.

  Pseudocode for a recursive function

Think about a language of words, where each word is a string of dots and dashes. The following grammar describes this language:

  Explain tool used to infer the conceptual model

Another tool used to infer the conceptual model are the end user's forms. The form below will help you identify the entities and relationships.

  Explain code review methodology-walkthrough

As the quality assurance manager, which code review methodology-walkthrough or inspection-would you recommend? Justify your answer.

  Draw context diagram level zero and level one

Draw Context diagram, level0 and level1 (if need) for the following: The user submit her/his name to the system, the system will tell the user if he is a boy or a girl or don't know by looking up his name in database of names saved in the system.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd