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

  Explain basic tools used by project manager

Explain the basic tools used by a project manager. Relate these tools to applications like Excel, MS project, and other packages which are used to automate project management processes.

  Sketch flowchart to represent logic of program

Sketch a flowchart to represent the logic of a program that allows the user to enter five values. The program prints the largest and the smallest number from the five values provided.

  Draw entity-relationship diagram students playing games

Draw an entity-relationship diagram for the following situation: Many students play many different sports. One person, called the head coach, assumes the role of coaching all these sports.

  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.

  Element of object oriented systems

Several people view the four foundational factors of object-orientation as abstraction, encapsulation, inheritance, and polymorphism. There is a certain purity in being minimal.

  Sketch er diagram to keep track of employees and projects

Sketch ER diagram for the following situation and write any assumptions you think you have to make to develop a complete diagram. Company requires the operational database to keep track of all employees, departments, and projects.

  Defining competitive advantage of a business

Discuss the key concepts related to defining competitive advantage of a business? Choose one and describe how you would use information systems to aid in obtaining competitive advantage with your selected key idea.

  Construct a data dictionary and draw a hierarchy chart

Construct a data dictionary, and draw a hierarchy chart and flowchart or pseudocode for a program to produce a report for the principal of a school.Output.

  Create a table with a primary key to identify business

Construct a table that will store data about each student that took a course and what grade they received. The data should include the semester of completion.

  Improving job performance

Learning is characterized as any relatively permanent change in behavior that happens as a result of experience. Also means that it also happens outside of schools, at workplaces.

  How could core erp components aid improve business operation

How could core ERP components aid improve business operations at college? How could extended ERP components aid improve business operations at the college.

  Calculation of the hypotenuse

Construct a C# console application that calculate the hypotenuse of a right triangle. The calculation of the hypotenuse of a right triangle is based on the Pythagorean Theorem:

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