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

  Peer-to-peer networking

Explain the term peer-to-peer networking? Describe why is bit torrent regarded to be a more efficient protocol? In the bit torrent context, explain how seeders and the leechers work.

  Tradeoff between breath first search, depth-fisrt-search

tradeoff between Breath First search, Depth-Fisrt-Search.Directed Acyclic Graphs(DAGs), Topological sorting and Dijkstra.

  Problems on relation and functional dependencies

Problems on  relation and functional dependencies

  Scripts_new directory and dir.txt file

Write down the following folder structure on C: drive of your computer: Scripts_New, Networking, User.

  Explain why is a well-thought-out cabling infrastructure

why is a well-thought-out cabling infrastructure design so important in meeting the network performance expectations of

  Give a description of a potential multimedia presentation

Write down a short description of a potential multimedia presentation that could be implemented across the WWW for a particular subject of interest to you. The choice is yours and it can be from anywhere in the world.

  Discuss the requirements for resource management

Discuss the requirements for remote administration, resource management, SLA management and billing management of your chosen provider.

  Questionassume you were recently hired for a new position

questionassume you were recently hired for a new position as computer forensics specialist at a medium-sized

  Prove inversion are removed

Suppose we exchange elements a[i] and a[i+k] which were out of order.  Prove at least 1 and at most 2k-1 inversion are removed.

  Companies like redhat novell with its suse distribution and

companies such as redhat novell with its suse distribution and others offer linux operating system software for sale.

  Explain how can information be an asset in a company

how can information be an asset in a company? discuss three different examples of information that should be protected

  What is bobs private key

What is Bob's private key?

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