Fall 2009
Revisions:
None yet.
Material covered:
Chapter 2.9: Bytes, Halfwords, ASCII, Unicode
Chapter 2.4: Signed and Unsigned Numbers
Chapter 2.5-2.10: Instruction Coding
Chapter 2.12: Linking and Loading
Chapter 2.14: Arrays versus Pointers and lui instruction
Appendix C.5: ALU Organization
Chapter 3.1-3.4: Overflow, Exceptions; Multiply and Divide
Chapter 3.5: Floating Point
Chapter 4.1-4.4: Datapath & Simple Implementation
Homework questions due: Monday, 16 November 2009 [15 pts]:
Homework is due at the start of class on the due date. Late homeworks will not be accepted. Homeworks must be type-written, and not hand-written. Keep a copy of your homework, and bring this with you the day of the quiz/exam review (i.e., the day the homework is due). This should help you in the review session.
Solve the following problems:
#1 [1 pt]
#3 [1 pt]
#5 [1 pt]
#6 [1 pt]
#8 [1 pt]
#9 [1 pt]
#12 [1 pt]
#13 [1 pt]
#15 [1 pt]
#20 [1 pt]
#21 [1 pt]
#26 [1 pt]
#33 [1 pt]
#34 [1 pt]
#36 [1 pt]
lb $s0, DataByte($zero) executes with the byte value 0x80 located at address DataByte in RAM. What is the $s0 register value after the instruction executes? sub $s0, $s0, $s1
andi $t0, $t1, 0x00ff0xac240204
0x14040002
#define NUM_COLS 10
/* A function to return an array element from a 2D array.
In C, the NUM_COLS (a constant) is necessary. In assembly language,
the array parameter would just be a pointer, and the numberColumns parameter
would contain the value NUM_COLS.
*/
int GetArrayElement(
int theArray[][NUM_COLS],
int numberColumns, int rowIndex, int columnIndex) {
return theArray[rowIndex][columnIndex];
}
A: .double 1.0:120What MAL instruction do you use to get the base address of A into register $t0? If the index of an entry in this array is in $t1, how do you compute the address of the entry?