Be sure you have read all assigned sections of Chapter 2 and Appendix A.
Do the following problems. You may write out your answers by hand or using a word processor or other program, but please submit hard copy, either in class or in my mailbox in the department office.
Table for procedure A:
Text Segment | Address | Instruction | |
0 | lui $at, 0 | ||
4 | ori $a0, $at, 0 | ||
... | ... | ||
0x84 | jr $ra | ||
... | ... | ||
Data Segment | Address | Label | |
0 | (X) | ||
... | ... | ||
Relocation Info | Address | Instruction Type | Dependency |
0 | lui | X | |
4 | ori | X | |
Symbol | Address | Symbol | |
... | X |
Table for procedure B:
Text Segment | Address | Instruction | |
0 | sw $a0, 0($gp) | ||
4 | jmp 0 | ||
... | ... | ||
0x180 | jal 0 | ||
... | ... | ||
Data Segment | Address | Label | |
0 | (Y) | ||
... | ... | ||
Relocation Info | Address | Instruction Type | Dependency |
0 | sw | Y | |
4 | jmp | FOO | |
0x180 | jal | A | |
Symbol | Address | Symbol | |
... | Y | ||
0x180 | FOO | ||
... | A |
Do the following programming problems. You will end up with at least one code file per problem. Submit your program source (and any other needed files) by sending mail to bmassing@cs.trinity.edu, with each file as an attachment. Please use a subject line that mentions the course number and the assignment (e.g., ``csci 2321 homework 2''). You can develop your programs on any system that provides the needed functionality, but I will test them using the SPIM simulator on one of the department's Linux machines, so you should probably make sure they work in that environment before turning them in.
Correction:
Printing the ending value of a is not useful since it
doesn't change, and making up interesting data for D
is also not useful since the program only writes values to it.
I will give full credit, however, for a correct solution to
the problem as stated.
More useful would be to print all of D after the program
computes two loops -- i.e., have the program do the equivalent
of the C code
for (k=0; k<(4*b); k++) printf("%d\n", D[k]);You can get up to 2.5 extra-credit points for having your program print D rather than a.