EE380 Assignment 4 Solution

  1. Using only MIPS integer instructions, write a function that will make x = -y where x and y are floating-point numbers. Your function only needs to handle normal float values correctly, not NaN, etc.


  2. For this question, check all that apply. We discussed a variety of methods for performing binary addition (and we discussed use of a ROM for multiply, but it could also be used for add). Which of the following would naturally be implemented by a combinatorial circuit that uses three (N/2)-bit adders to add two N-bit numbers?
    Ripple Carry
    Carry Select
    Carry Lookahead
    Speculative Carry
    ROM Lookup Table
  3. You know that to multiply a binary integer by 16, all you have to do is shift the value over by 4 bit positions -- which in hardware can literally be done without a function unit simply by connecting bus wires such that bit k goes to position k+4 and positions 0-3 are connected to ground. Well, it's harder to multiply by 28. However, by using Booth's algorithm, a single 32-bit add/subtract ALU is sufficient to implement multiply of a 32-bit number by 60 as a fast combinatorial circuit. Explain how this would be done by giving a formula for X*60 as a C expression (for example, X*5 would be (X<<2)+X).
  4. For this question, check all that apply. In mathematics, both addition and multiplication are associative; for example, a*(b*c) gives the same value as (a*b)*c. Assuming no values go out of range, are addition and multiplication are associative for 2's complement binary integers and for IEEE-format floating-point values? Mark all the operations that are associative.
    32-bit integer addition
    32-bit (single) floating-point addition
    64-bit (double) floating-point addition
    32-bit (single) floating-point multiplication
    64-bit (double) floating-point multiplication


  5. For this question, check all that apply. In the single-cycle design shown in the above (rather large and very familiar) figure, which of the following signals are "don't cares" when executing a MIPS beq instruction?
    Branch
    RegDst
    don't care which register to write because beq doesn't write
    ALUSrc
    RegWrite
    must be 0
    MemWrite
    must be 0


  6. For this question, check all that apply. In the single-cycle design shown in the above (rather large and very familiar) figure, suppose that ALUSrc=1 and RegWrite=0. Which of the following MIPS instructions might be executing?
    sw $t0,4($t1)
    lw $t0,4($t1)
    RegWrite must be 1
    beq $t0,$t1,l
    ALUSrc must be 0
    andi $t0,$t1,2
    RegWrite must be 1
    add $t0,$t1,$t2
    ALUSrc must be 0, RegWrite must be 1
  7. What is the logic formula for Z?

  8. When determining the bit patterns to be used to represent instructions (or control signals in a circuit), one can use either horizontal or vertical encoding. Briefly describe one reason to prefer an encoding that is horizontal and one reason to prefer a vertical encoding.


EE380 Computer Organization and Design.