CSE 378 - Spring 1998

Machine Organization and Assembly Language Programming

Problem Set #2

Due Wednesday, April 15, 1998

 

  1. Problem 3.2.  (? pts)
  2. Show the minimal sequence of instructions for this C statement:

    x[8] = x[4] - y;

    Assume that y's value is in register $t0 and the array x contains 32-bit ints and has a base address of 0x44567818.

    (4 pts)

  3. Problem 3.6. (5 pts)
  4. 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
    lw $t2, big($t3) $t2 = Memory[$t3 + 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

     

  5. Problem 3.9.  (5 pts)
  6. Problem 3.23. (4 pts)
  7. Problem 4.21. (2 pts)
  8. Problem 4.22. (3 pts)
  9. Problem 4.41. (2 pts)