This assignment is due 10:00 AM on 9 November at the HW9 moodle page.
However, if you submit it before Tuesday, 5 November, 10:00 AM, I will give it a preliminary grading before Exam 2 on Wednesday.
The goal and the numbers
The goal of this assignment is to give you a chance to redo most of Homework 8. Getting this to work in Moodle’s grading system can a little challenging, so let’s say that your raw Homework 8 grade is rawHW8 and your raw Homework 9 grade is rawHW9. The values of rawHW8 will range from 0 to 40 and the values of rawHW8 will range from 0 to 10. Then your cooked (recorded in Moodle) Homeworks 8 and 9 will be calculated with the following Java statements.
cookedHW8 = Math.max(rawHW8, 3*rawHW9) ; cookedHW9 = Math.max(rawHW9, (rawHW8+2)/4) ;
The assignment
Fill in the blanks in the following form and submit it by moodle.
Fill in the blanks using your favorite text editor. The simpler the better. Problem HW9A -- Write the assembly code for the following C statements 1) x = 0 ; 2) i = 0 ; 3) ++i ; 4) j = V[i] ; 5) x = x + (j & 0x3) ; 6) j = j >> 2 ; Problem HW9B -- translate the following C code into C where the only C control structures that can be used are: goto LABEL ; if (VAR RELOP 0) goto LABEL ; LABEL can be any label in your code. VAR can be any variable in your code. RELOP can be any of the C equality or relational operators: == != < <= > >= This means no while, for, do, else, or unrestricted if. for (i=0; i<100; ++i) { // ... while (j != 0) { // ... } } Problem HW9C -- Put HW9A and HW9B together to solve the original Homework 8. That is, write PIC assembly for the following: x = 0 ; for (i=0; i<100; ++i) { j = V[i] ; while (j != 0) { x = x + (j & 0x3) ; j = j >> 2 ; } }