CMPS-2240 Quiz-7 discussion ----------------- The average score on the quiz was 68.5% Four students scored 10 or higher. Two students skipped the quiz. To help with scores I gave some credit for just submitting a file and writing your name on it. Most students got these points, but not all. 16 of 31 students scored below the C level. You may try to improve your score by reading below and answering the questions you think you missed. If you do this, save answers in a file named: 2240/7/quiz7a.txt Due before class Monday. Careful... • Do not go on and on with TMI, too much information. Many times that shows me you don't actually know the answer. Simple answers are best. Use a few key words. • Choose only questions that you think you missed. Do not re-answer a question that you got right the first time. If you change to the wrong answer, you can lose points. Each question explained... 1. ------------------------------------------------------------------------- A specific example of running a MIPS program was given. The number of command-line arguments is stored in register $a0 at the start of the program. You were asked to give this value. What is the number. Not a description of a number, but a number. Like 1, 2, 3 etc. A number. What is it? 2. ------------------------------------------------------------------------- A value will also be stored in register $a1, but it could be different every time you run the program. Your answer can't be a specific number unless you wrote a MIPS program and displayed the value. No students did that, that I could tell. If you described the purpose of the $a1 register value correctly, you got points. 3 and 4. ------------------------------------------------------------------- These questions were not structured well, and so they were made into extra credit only. The answers could be different each time you run the program. Four students described the answer well with some other points given also. The questions should have been structured like this: 3. What value will be in $t1? lw $t0, ($a1) lb $t1, ($t0) 4. What value will be in $t2? lw $t0, 4($a1) lb $t2, ($t0) These questions now have specific answers. What are they? 5. ------------------------------------------------------------------------- Addresses aligned on a 4-byte boundary are values that are divisible by 4. With a hex number you just look at the right-most digit, convert it to binary and check if the 2 right-most bits are zeros. If a number is divisible by 4, then the number is some other number that has been multiplied by 4. A binary number is multiplied by 4 by shifting the bits two to the left. The two right-most bits will always be zero. Option E is a decimal number. 6. ------------------------------------------------------------------------- We talked in lecture about 2 advantages of data alignment. One related to saving of some space somewhere. Where? The other related to less CPU cycles needed when doing a specific calculation to find values that are stored in contiguous memory. Do you remember them now? Only 2 students got this correct, so the question was made extra credit. 7. ------------------------------------------------------------------------- C Structures are aligned on an 8-byte boundary on the Odin server. You observed this when we wrote the C program in class together. A struct that had 17-bytes of data was given a size of 24-bytes. 8. ------------------------------------------------------------------------- Your comments should have given a reader some clues about what was going on. Just explaining each command in detail is not very helpful. Bad example: li $v0, 14 # load an immediate value 14 into register $v0 move $a0, $s0 # copy a value from $s0 to $a0 Good example: li $v0, 14 # setup a syscall to read from the file move $a0, $s0 # set the file descriptor (saved in $s0) 9. ------------------------------------------------------------------------- The code reads a file and checks for an error condition. 10. ------------------------------------------------------------------------ This question asked you to identify one of the fundamental qualities of the MIPS ISA - instruction set architecture. We have discussed it several times in lecture. You must answer this question correctly to show that you are paying attention and understand MIPS. 1/3 of the class needs to try again.