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

  How to write code for selection sort, insertion sort

How to write code for selection sort, insertion sort. Using your performance of selection, bubble and insertion sort, add a counter in an appropriate place so as to measure the runtime of your code for example this capacity be a counter to track ..

  What is the significance of optimizing the design

What is the significance of optimizing the design

  Implementing the sql query

Employees relation describes pilots and other kinds of the employees as well; every pilot is certified for some aircraft, and only pilots are certified to fly. Write down each of following queries in SQL.

  Controlling congestion in error-free virtual circuit subnet.

Consider the following method for congestion control in the error-free virtual circuit subnet. A router may only transmit ACK for a received packet if it knows packet transmission along with the virtual circuit through subsequent routers is succes..

  What is bobs private key

What is Bob's private key?

  What restrictions must be imposed

Free Speech Online Some feel that there is too much objectionable material allowed on the Internet, whereas others argue that the Internet must be completely censored.what restrictions must be imposed.

  Create a security policy company explaining network security

Sunica Music and Movies is the local multimedia chain with four locations. Each store has been acting independently of one another and has difficulty coordinating customer sales from one store to another based on inventory.

  When does pipelining not offer any benefit

How does branch prediction, forwarding, and stalls help make a computer faster.

  What is standard purchasing system

SPS system would standardize purchasing practices for each Snad and Surf subsidiary and manage all purchasing information. System testing will be completed by end of the week. What kinds of documentation are required for this application?

  Program to display temperature in table

Write down a C program that accepts three numbers input by the user, and outputs a table of the temperatures in Celsius, Fahrenheit, and Kelvin.

  Cfl pumping lemma

Utilize the CFL pumping Lemma in order to show each of these languages not to be context-free.

  Define corrective, adaptive, perfective, and preventive

explain an example of each of the four types of maintenance: corrective, adaptive, perfective, and preventive. Discuss how the decision to proceed is reached in each case. Be specific.

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