Computer Architecture: Problem Set 1

Attempt by: Thursday, September 20, before class
Submit by: Tuesday, September 25, at start of class


  1. PH p. 148, exercises 2.2-2.4.

  2. Write equivalent (MIPS-style) assembly language instructions for the following C program fragments. (In each case, assume the variables are associated with registers starting with $s0 and any temporaries necessary should be stored starting in $t0.)
    1.   a = d - (b + c);
        e = f + (a - g);
      
    2.   a = d[6] + c; 
      
    3.   d[2] = e - f;
      
    4.   x[i+1] = x[i];
      

  3. Translate the following assembly instructions into machine code showing both the decimal representaton and the binary representation. (Follow the example in PH, Section 2.4.)
      sub $s0, $t5, $t3
    
      lw  $s2, 12($t6)
    

  4. Translate the following machine instructions into MIPS assembly instructions.
    00000001000010010101000000100000
    
    10101110111011100000000001001000
    

  5. PH cd-section "For More Practice", exercise 2.7.