Translation of this into a generic assembly language

Assignment Help Computer Engineering
Reference no: EM1329079

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: EM1329079

Questions Cloud

Explain how does e-business affect a company''s strategy : Explain How does e-business affect a company's strategy and what must a company do to transform its strategy when it decides to transform into an e-Business
Explain the action of the function : Describer the action of the function. What is the function in the library that performs a similar calculation.
Psychodynamic approaches leadership theory : In what ways could it be said that with psychodynamic approaches leadership theory has come full circle to trait, skill, and style theory?
Question about strategic supply chain management : Question about Strategic Supply Chain Management - Show the competing and conflicting objectives of these parties.
Translation of this into a generic assembly language : A compiler for a RISC machine would introduce delay slots into this code so that the processor can employ the delayed branch mechanism.
Describe the change : Identify a company that has recently undergone a significant organizational change. Describe the change.
Explain privacy and security and international issues : Explain Privacy and Security and International Issues on the AT and T
Use of information technology : Use of information technology - Describe how the use of information technology can make things worse if it is applied to a poorly thought out process.
Information regarding constitutional interpretation : What differing approaches to constitutional interpretation do you find in the opinions of Justices Kennedy and Scalia in Roper v. Simmons (2005)?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Complete handover of change management

How much control will you expect the Project Manager to have over planned changes, in projects where work has been extensively outsourced to external contractors? Full or partial control, or a complete handover of change management responsibility ..

  Declare three variables as integer

Log in to the Linux system as a user, and then open a Terminal emulation window.

  Determining pearson correlation coefficient

Determining the Pearson correlation coefficient you need to write down the program computing Pearson correlation coefficient utilizing the parallel loop templates from the Intel Threading Building Blocks library (TBB).

  Utilization of cryptography

You have been hired to offer the advice regarding the utilization of the cryptography to developer of new two products within a company.

  Process used to detect and correct transmission errors

process used to detect and correct transmission errors.

  Wordpad application

Whenever you select the print from WordPad application. Which printer among the three starts to print? Why? Explain is it possible to state which printer to print from the WordPad or any other application? Explain why?

  Creating the c program

Write down a program which accepts a name for example, chocolate bluberries price per pound, and number of the pounds sold in average month .

  Discuss the layered stack approach

This is meant as a discussion topic, this is not an essay. Describe the OSI and TCP/IP reference models. express  the similarities and differences between them. consider how the layered stack approach assists in our understanding of these referenc..

  Creating a static method

Write down a static method, getBigWords, which takes a String parameter and returns an array whose elements are words in the parameter that consists of more than 5 letters.

  Program to compute the area and circumference of circle

Algorithm which will prompt for and receive the measurement of the diameter of a circle and compute and show the area and circumference of the circle.

  Testing program using numbers of command line arguments

Test your program thoroughly utilizing different numbers of command line arguments.

  Determining the missing side of triangle

Write down a program which will figure out the missing side of the right triangle utilizing the Pythagorean Theorem. Suppose that the user entries will make a triangle.

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