CMPS 2240 Computer Architecture I: Assembly Language

Semester Project discussion... 
The project was apparently difficult, or at least time consuming for casual
students. Some students tried hard, so I bumped the value of phases up by 10%.
This seemed fair and helped the class average rise to about 80% overall.


Final exam discussion... 

The exam is here

The most difficult questions were: 6, 8, 9, 10, 12, 14, 16, 20

Discussion...

1. This was not difficult. Some careless errors were made.

2. The right-most bit is shifted out of the register, and lost.
   The right-most bit is also referred to as the least significant bit.
   Several students made careless errors here.

3. Apply a two's compliment to the number. Now you know the value, but the
   value stored is the negative of that number. Less than half the class
   remembered this. Half credit for positive answer. Generous.

4. jmp is not a command. jr returns to an address not necessarily a label.
   jr can be used to jump long distances in program memory.

5. Simply requires a logical OR operation.

6. C. Nested memory allocation can be done. ???
   Nested memory allocation is not really a thing. Allocating memory to nested
   structures does not require a stack-frame. If you got the rest of the
   question correct, I did not deduct points.

   A stack frame does not speed up a program. If anything it runs a little
   slower because of it.

7. sw $t0, 8($sp)

   This is the only MIPS instruction that goes from left to right. It stores
   a word of memory into the right operand. $sp is being de-referenced to get
   an address, and the address is offset by 8 bytes. The value of $t0 is
   written there. Because $sp is being used, it is considered a memory
   location on the stack. $sp is the stack pointer.

8. The stack pointer is being de-referenced only and does not change.

9. Just before calling a function, a program should save important register
   values that the function might change during its processing.

10. The requirement here was to show that you understand sign extension. Sign
    extension means that all of the leading digits of a binary number indicate
    the sign of the number. Because the number is being stored in a 32-bit
    register, all the bits on the left must be set to indicate the sign.

11. Your answer will show that you understand hexadecimal numbers, and that
    you know what hexadecimal format is.

12. 256 is the quantity of numbers, not the range.

    After review, this question was not stated clearly enough. I will give all
    students credit. Those who got it correct most likely found the answer
    online. We did not discuss it much.

13. Two to the 15th power is correct, and one of the other answer was the
    number 32768 which is also correct. 2 answers.

14. Each byte of memory can be addressed.

15. Most students got this. I gave extra credit to several students who did
    2 pushes followed by 2 pops. This indicates knowledge of how a stack gives
    pushed items back in reverse order when popping.

16. You end up with a 1 followed by 8 zeros. There were some careless errors
    converting this binary number to decimal.

17. We did this in class together. ESI is being de-referenced, so it surely
    holds an address. ESI is a 32-bit register, and you can only use a 32-bit
    register to address memory in a 32-bit operating system.

18. $2 is the number 2. Moving left to right, the value is moved into the
    register shown.

19. The question is asking what is the largest number that can be stored using
    20 binary bits. Accepted answers were...
    1MB, one megabyte, 2^20 bytes, 1,048,576 bytes, etc.

20. You must show the bit pattern of all 32 bits.
    The sign bit
    The exponent
    The mantissa

    Your work should have shown some calculation of the fractional part of
    the binary value for 0.32.

    Also showing that you know the exponent is 5, then add it to the bias.

    Your answer should take this form...

    x xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx

    showing all 32 bits.