CSE 378 - Spring 1999
Machine Organization and Assembly Language Programming
Problem Set #2
Due Monday, April 12, 1999
Total Points: 50
-
By the end of the second week, read Chapter 3, Sections 3.1 through 3.6
and 3.8, and Appendix A, Sections A1 through A4, A6, and A9. Also
look through Appendix A, Section A10. Although you will not be required
to know every instruction, it will help you to become familiar with them.
-
Do the following problems, and hand in the answers by the start of class
on Monday, April 12.
(Note that the answers to many of these programs can be verified
or even determined by using Spim.)
-
Problem 3.2. (4 pts)
-
Problem 3.5. (3 pts)
-
Problem 3.6. (5 pts)
-
As discussed on p. 157 and summarized in Fig 3.37, pseudoinstructions are
not part of the MIPS instruction set, but often are used in assembly language
programs. For each pseudoinstruction in the table, produce a minimal
sequence of actual MIPS instructions to accomplish the same thing.
You may need to use $at for some sequences. In the following table,
big
refers to a specific number that requires 32 bits to represent, and small
to a number that requires only 16 bits. (13 pts)
Pseudoinstruction |
What it does |
move $t5, $t1 |
$t5 = $t1 |
clear $t2 |
$t2 = 0 |
li $t5, small |
$t5 = small |
li $t5, big |
$t5 = big |
addi $t1, $t2, big |
$t1 = $t2 + big |
beq $t3, small, L |
if ($t3 = small) goto L |
bne $t3, big, L |
if ($t3 != big) goto L |
-
Problem 3.9. (5 pts)
-
Problem 3.25. (10 pts)
-
Problem 4.20. (4 pts)
-
Problem 4.22. (3 pts)
-
Problem 4.40. (3 pts)