Write the equivalent mips assembly code for the c-code

Assignment Help Computer Engineering
Reference no: EM131404390

Computer Organisation Coursework Assignment

Coursework Aim - This exercise will allow you to writing programs in the language of the computer and understand how pipelining improves efficiency by executing multiple instructions simultaneously. 

Module learning outcomes assessed in this piece of coursework - This assessment is designed to assess your ability in the following module learning outcomes:

  • Describe and differentiate between the essential features and operations of modern computer architectures

Coursework brief - The assignment consists of two problems that you need to solve during the module workshops. Both have equal weights. (The problems are given at the end of this Assessment Form). You should submit an individual written report that provides the answers and a related discussion for each problem.

Assessment Problems -

Problem 1 - The C-code shown below will loop through an array of marks (integer values between 0 and 100) and calculate a histogram of these marks.

int A, B, C, D, F;                 // declare grade counters

inti;                                                        // declare loop counter

int N;                                                     // Number of scores to analyse

A=0; B=0; C=0; D=0; F=0;               // initialize grade counters

// Read in test scores into gradesarray?

                                // N will be equal to the number of grades

                                // assume N = 50

for (i=0; i<N; i++) {

             if(scores[i] >= 90)

                                A = A + 1;

             else if(scores[i] >= 80)

                                B = B + 1;             

             else if(scores[i] >= 70)

                                C = C + 1;

             else if(scores[i] >= 60)

                                D = D + 1;

             else

                                F = F + 1;

}

Q1. Write the equivalent MIPS assembly code for the C-code shown above.

You should assume the following:

- The number of scores, N, to be analysed is 50.

- The address of the first element in the marks array is contained in $s0.

Additionally, to make it easier for you to keep track of register assignments, you may use register names that have the same name as the variable names used in the code above.  For example, to initialize the register that holds the A counter, you might write:

add        $A, $0, $0

If you do choose to use actual MIPS register names, you should write your code out as follows i.e. with appropriate comments:

add        $t0, $0, $0            # $t0 maps to variable A; we need to initialize it to 0

Problem 2 - This problem consists of two questions Q1 and Q2 which consider the basic MIPS 5-stage pipeline (F, D, EX, M, WB).  You should assume that there is full forwarding.

Q1. Show how the instructions below proceed through the pipeline and indicate if any stall cycles are needed. You should assume the beq instruction is taken. Use the following chart.

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

lw $1, 0($2)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

add $2, $2, $2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sub $2, $2, $1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

beq, $2, $2, X

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

lw $1, 4($2)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X:  add $2, $2, $1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Q2. Assume the following sequence of instructions is executed in a traditional 5-stage pipeline. Does the lw / add instruction combination represent a data hazard?  If so, why?  If not, why not?

lw           $5, 4($6)

sub         $6, $5, $10

add        $7, $6, $5

Reference no: EM131404390

Questions Cloud

What assumptions necessary in order to solve problem : If the sample size had been 8 patients instead of 50, what further assumption(s) would have been necessary in order to solve this problem?
Probability that office will receive at least 160 fax : For an office in which 10 workers are employed, and considering these persons as a simple random sample of all U.S. office workers, what is the probability that the office will receive at least 160 fax messages next Wednesday?
What if the part were to be made by investment casting : If you were to incorporate lettering or numbers on a sand-cast part, would you make them protrude from the surface or recess them into the surface? W hat if the part were to be made by investment casting? Explain.
Probability that average waiting time was at least 4 minutes : For a simple random sample of 36 recent customers, invoke the central limit theorem and determine the probability that their average waiting time was at least 4.0 minutes.
Write the equivalent mips assembly code for the c-code : CI5220 Computer Organisation Coursework Assignment. Write the equivalent MIPS assembly code for the C-code shown above. You should assume the following: The number of scores, N, to be analysed is 50. The address of the first element in the marks arra..
Probability that sample mean will be at least 10200 pounds : For a simple random sample of n = 4 welds, what is the probability that the sample mean will be at least 10,200 pounds per square inch? Less than 9900 pounds per square inch?
What about special pricing for some markets or customers : What about special pricing for some markets or customers? Show effect on revenues and profitability based on stated assumptions. Potential advantages and disadvantages, both financial and non-financial.
Find probability that truckload of drills will be rejected : Unknown to the purchasing manager, the drills on the truck require an average of 295 watts, with a standard deviation of 12 watts. Stating any additional assumptions you are using, find the probability that the truckload of drills will be rejected..
Evaluate the information in logical manner : A good practice would be to use each competency as a self-check to confirm you have incorporated all of them in your work.Organize document or presentation in a manner that promotes understanding and meets the requirements of the assignment.Evaluate ..

Reviews

len1404390

2/23/2017 2:31:49 AM

Working code that produces the expected results. Well documented. Uses the write syntax of the assembly language based on the lecture notes. MIPS instruction if possible correctly used. Uses the correct way of accessing memory locations. Correct answer showing the required stalling / no stalling with justification. Correct answer showing the required stalling / no stalling with justification.

len1404390

2/23/2017 2:31:37 AM

This exercise will allow you to writing programs in the language of the computer and understand how pipelining improves efficiency by executing multiple instructions simultaneously. The assignment consists of two problems that you need to solve during the module workshops. Both have equal weights. (The problems are given at the end of this Assessment Form). You should submit an individual written report that provides the answers and a related discussion for each problem. The assessment grade boundaries for both problems are shown overleaf.

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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