How code is organized can affect performance in a pipelined processor. Let us assume a pipelined...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
How code is organized can affect performance in a pipelined processor. Let us assume a pipelined version of the processor developed in the project, similar to what we discussed in class on Feb 14th. Consider the processor to have 5 stages in its pipeline, as follows: 1. Read an instruction, and advance the program counter by 4. Read values from registers, and do the ALU computation 2. 3. Determine if the CPU should go to an instruction that is not the next instruction in memory. If so, cancel the next two instructions and set PC to the proper new location. 4. Write a value to a register, if appropriate. Set the flags register, if appropriate. 5. Write a value to memory, if appropriate. In this case, we'll assume data dependencies are dealt with by delays (a.k.a. stalling), and in the case of the above, when a register is written in one instruction, that same register can not be read until after the writing is complete (i.e. it will have to stall until after the register has been written). There are two code examples on the right. For these, answer the following questions: a. How many clock cycles does it take to run code sample A? b. How many clock cycles does it take to run code sample B? c. Which one runs faster, and why? Code Sample A mov r11, #0 mov r10 , #5 loop: add r13, r10, r10 add r12, r12, r13 sub r10, r10, #1 cmp r10 , #0 bne loop Code Sample B mov r10, #5 mov r11, #0 loop: add r13, r10, r10 sub r10, r10, #1 add r12, r12, r13 cmp r10, #0 bne loop Acti Go to How code is organized can affect performance in a pipelined processor. Let us assume a pipelined version of the processor developed in the project, similar to what we discussed in class on Feb 14th. Consider the processor to have 5 stages in its pipeline, as follows: 1. Read an instruction, and advance the program counter by 4. Read values from registers, and do the ALU computation 2. 3. Determine if the CPU should go to an instruction that is not the next instruction in memory. If so, cancel the next two instructions and set PC to the proper new location. 4. Write a value to a register, if appropriate. Set the flags register, if appropriate. 5. Write a value to memory, if appropriate. In this case, we'll assume data dependencies are dealt with by delays (a.k.a. stalling), and in the case of the above, when a register is written in one instruction, that same register can not be read until after the writing is complete (i.e. it will have to stall until after the register has been written). There are two code examples on the right. For these, answer the following questions: a. How many clock cycles does it take to run code sample A? b. How many clock cycles does it take to run code sample B? c. Which one runs faster, and why? Code Sample A mov r11, #0 mov r10 , #5 loop: add r13, r10, r10 add r12, r12, r13 sub r10, r10, #1 cmp r10 , #0 bne loop Code Sample B mov r10, #5 mov r11, #0 loop: add r13, r10, r10 sub r10, r10, #1 add r12, r12, r13 cmp r10, #0 bne loop Acti Go to
Expert Answer:
Answer rating: 100% (QA)
a For Code Sample A it takes 7 clock cycles to run the entire loop Explanation 1 mov r11 0 1 clock c... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these operating system questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Consider the following the flat database table: FName LName Address California Florida New Jersey California Mark Maria John Mark John Smith Cruise Hareson Smith Hareson Course code TM366 TM366 TM112...
-
What are the five main characteristics of useful financial goals?
-
A temperature of about 0.01 K can be achieved by magnetic cooling. In this process a strong magnetic field is imposed on a paramagnetic salt, maintained at 1 K by transfer of energy to liquid helium...
-
A study was conducted to investigate the relationship between severe headaches and being left- or right-handed. (Incidentally, Lisa Kudrow, who played Phoebe Buffay on the hit sitcom "Friends," is an...
-
Berg Company adopted a share-option plan on November 30, 2009, that provided that 70,000 shares of $5 par value ordinary shares be designated as available for the granting of options to officers of...
-
An investment portfolio began at $1,000,000, but has a current value of $782,655.71 with a standard deviation of 5 and a risk free ratio of 3.13%. 1. Calculate the Sharpe and Information Ratios and...
-
Donna Shader, manager of the Winter Park Hotel, is considering how to restructure the front desk to reach an optimum level of staff efficiency and guest service. At present, the hotel has five clerks...
-
Topic: challenges in logistic in recent years 1. How did the logistic firms in Berlin in food retail chain, manage the recent challenges of inflation and pandemic. Objective: My objective is to...
-
The African cicada is the worlds loudest insect, producing a sound intensity level of 107 dB at a distance of 0.50 m. What is the intensity of its sound (in W/m 2 ) as heard by someone standing 3.0 m...
-
Two loudspeakers, 1.0 m apart, emit sound waves with the same frequency along the positive x-axis. Victor, standing on the axis to the right of the speakers, hears no sound. As the frequency is...
-
Bats sense objects in the dark by echolocation, in which they emit very short pulses of sound and then listen for their echoes off the objects. A bat is flying directly toward a wall 50 m away when...
-
Suppose that in 2023, Global launched an aggressive marketing campaign that boosted sales by 15%. However, their operating margin fell from 5.57% to 4. 50%. Suppose that they had no other income,...
-
Google is obsessed with data. Did you know that Google tested out new shades of blue for advertisement links? They experimented using real clicks by users, and Google learned that the purple-blue...
-
In recent decades, the percentage of Americans who always wear their seatbelt has been on the rise. The following table contains data between the years 1992 and 2011 (n, number of years after 1992)...
-
What are the six activities involved in the physical supply/distribution system?
-
In the introduction, we mentioned that, while we often treat public and private goods as distinct concepts, many goods actually lie in between the extremes because of crowding. A: We can think of the...
-
In the absence of recurring fixed costs (such as those in exercise 12.4), the U-shaped cost curves we will often graph in upcoming chapters presume some particular features of the underlying...
-
Business Application: Hiring an Assistant: Suppose you are a busy CEOwith lots of consumption but relatively little leisure. I, on the other hand, have only a part-time job and therefore lots of...
-
Comment on this statement: Dynamic modeling is about interaction.
-
Explain how objects interact by exchanging messages.
-
Describe the relationship between dynamic modeling, behavioral modeling, and structural modeling.
Study smarter with the SolutionInn App