cs61c_su13_fin_review

To t4 7 7 7 7 7 add t0 s0 0 and t1 t0 s1 or

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: , 7 add $t0, $s0, $0 and $t1, $t0, $s1 or $t2, $t0, $s2 sub $t3, $t0, $s3 srl $t4, $t0, 2 Start numbering the cycles with 1 when the add instruction enters the IF stage. iii) For this part, assume that the datapath is broken and there is no forwarding / stalling. What are the values of $t0 to $t4 at the end of cycle 9? Pipelining and Hazards (4/5) Consider the 5-stage single-issue pipelined MIPS datapath consisting of Instruction Fetch (IF), Instruction Decode (ID), Execution (EX), Mem, and Write-Back (WB). You are given: # $s0 to $s3 = 56, 30, 30, 7 # $t0 to $t4 = 7, 7, 7, 7, 7 add $t0, $s0, $0 and $t1, $t0, $s1 or $t2, $t0, $s2 sub $t3, $t0, $s3 srl $t4, $t0, 2 Start numbering the cycles with 1 when the add instruction enters the IF stage. iv) What instruction (s) is/are computing the wrong result(s)? Pipelining and Hazards (5/5) Consider the 5-stage single-issue pipelined MIPS datapath consisting of Instruction Fetch (IF), Instruction Decode (ID), Execution (EX), Mem, and Write-Back (WB). You are given: # $s0 to $s3 = 56, 30, 30, 7 # $t0 to $t4 = 7, 7, 7, 7, 7 add $t0, $s0, $0 and $t1, $t0, $s1 or $t2, $t0, $s2 sub $t3, $t0, $s3 srl $t4, $t0, 2 Start numbering the cycles with 1 when the add instruction enters the IF stage. v) Suppose we want to fix the problem from part (iv) using forwarding. Which forwarding paths do we need to provide in order to execute the code correctly? MapReduce (1/2) The moving average (a type of low-pass filter) is an operation commonly used to smooth noisy data. Here we compute a centered moving average of width WIDTH on an array of data of size SIZE, where each element in our output array is the average of the current element, the previous (WIDTH-1)/2 elements, and the next (WIDTH-1)/2 elements. Assume that WIDTH is odd for simplicity and use zeroes where “required” elements do not exist. Example Input: float A = [ 7, 2, 3, 4, 8, 6 ] Output for WIDTH=3: float result = [3, 4, 3, 5, 6, 4.6666] MapReduce (2/2) Fit this problem to the MapReduce paradigm. You may assume that you have access to the global variables WIDTH and SIZE: // receives data one elem at a time. key is index i, val is A[i] map (int key, float value) { _______________________________________ { context.write(x, value); } } //outputs must be of the form: key is index i, val is moving avg. reduce (int key, float values) { float total = 0; // do not emit keys that do not exist in output array if ( (key >= 0) && (key < SIZE) ) { ________________________________________ ________________________________________ context.write ( ___________________, _________________); } That's it for this session! Good luck on your final! Acknowledgements 1. 2. 3. 4. 5. 6. VM and Cache - Fa06 Final SIMD and OpenMP - Fa12 Final FSMs, Boolean Logic, and Timing - Sp08 Final Datapath and Control - Sp07 Final Pipelining and Hazards - Fa12 Final MapReduce - Sp13 Final...
View Full Document

This note was uploaded on 09/20/2013 for the course CS 61A taught by Professor Harvey during the Fall '08 term at Berkeley.

Ask a homework question - tutors are online