Assignment 7, due Oct 17

Solutions

Part of the homework for CS:2630, Fall 2019
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper in discussion section on Thursday. Some parts of assignments may be submitted on-line and completed in discussion section. Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: Consider this set of boolean logic equations describing a digital system with 2 inputs a and b, and one output, e.

    c = ab
    d = a + b
    e = c + d

    a) Draw a circuit diagram for this circuit. Grading will account for neatness, so consider drawing it on scratch paper first and then redrawing it once you figure out how to make it nice looking. (0.5 points)

    schematic notation for the solution built from and, or and not

    b) Draw a truth table for it, showing the inputs a and b, the intermediate values c and d and the final value e. Again, neatness counts. (0.5 point)

    inputintermediatefinal
      a    b     c    d     e  
    00 01 1
    01 00 0
    10 00 0
    11 10 1

    c) This system of equations computes a logical function closely related to one of the functions discussed in the first half of Chapter 8 of the notes. What function and what is the relationship? (0.5 point)

    The inverse of exclusive-or.

  2. Background: The Hawk subtract instruction is done using an adder with a carry in of 1 and with the subtrahend inverted. So SUB R3,R4,R5 actually computes R3 = R4 + ~R5 + 1.

    A question: What does the carry out of the adder tell you? That is, when computing a – b, does a carry out imply some relationship (greater, less, equal) between the two numbers? What about the lack of a carry out? (0.5 point)

    Carry out means ab or that there is no borrow from more significant digits.

    Note: This is why the Hawk BGEU and BLTU instructions are equivalent to BCS and BCR.

  3. A small problem: Look at the Hawk shift instructions, and figure out where a shifter or shifters should be placed relative to the ALU. Note that the left-shift function and right-shift function may be in different places relative to the ALU. The easiest way to present a solution is as a diagram showing two inputs (the two operands), one output, with the ALU and shifter or shifters shown as labeled boxes in between. (1 point)

    schematic notation for the solution Note: It doesn't matter what input to the ALU is shifted, just that one input is. What matters is that left shift goes on the input to the ALU and right shift on the output.