Final Exam Solutions

A in mips assembly code show an example of a waw

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: mediately access array[i+1], array[i+2], and array[i+3]. for (int i=0; i<N; i+=4) { a[i] = b[i] + c[i]; a[i+1] = b[i+1] + c[i+1]; a[i+2] = b[i+2] + c[i+2]; a[i+3] = b[i+3] + c[i+3]; d[i] = e[i] + f[i]; d[i+1] = e[i+1] + f[i+1]; d[i+2] = e[i+2] + f[i+2]; d[i+3] = e[i+3] + f[i+3]; } 4 Question 3: Exploiting ILP [25 points]. (a) In MIPS assembly code, show an example of…. …a WAW dependency: ADD $t0, $t1, $t2 ADD $t0, $t3, $t4 (on $t0) …a WAR dependency: ADD $t0, $t1, $t2 ADD $t1, $t3, $t4 (on $t1) …a RAW dependency: ADD $t0, $t1, $t2 ADD $t3, $t0, $t4 (on $t0) (b) Which of the above are true dependencies? Why? RAW – in a RAW dependency, the first instruction produces a value that is consumed by the dependent instruction. The other “dependencies” are artifacts of multiple distinct values using the same register name. They could be avoided by using a different register mapping. 5 (c) For the following MIPS code: 1) LW $t2, 0($t3) 2) ADD $t2, $t0, $t2 3) SUB $t8, $t2, $t0 4) LW $t4, 0($t5) 5) ADD $t4, $t0, $t4 Rename these instructions to physical registers $p0 through $p63. 1) LW $p2, 0($p3) 2) ADD $p12, $p0, $p2 We rename $p12 because it is a new v...
View Full Document

This note was uploaded on 02/08/2014 for the course CS 351 taught by Professor Dr.suzannerivoire during the Fall '13 term at Sonoma.

Ask a homework question - tutors are online