Homework 9

Distributed Wednesday, November 28, 2007
Due before 10:30, Wednesday, December 5, 2007, if you want to have your homework returned before the final.
Due before 10:30, Friday, December 7, 2007, without late penalty. Homework 9 will not be accepted after 10:30, Friday.

Please put your full name and lab section letter on your homework.

Always remember to staple your work, if it is multiple pieces of paper.

If you choose, indicate on the top of your assignment roughly how much time you spent on it. This information will have no impact on your grade; it will only be used by an inexperienced course staff to gauge the volume of work to assign.

  1. (30 points)
    10.13.
  2. (20 points)
    Write a program in the style of lecture 24 (this means you should assume the same datapath and set of instructions) that implements the following snippet of C/Java/C# code:
        x = 0;
        for (i = 100; i < 200; i++)
          x = x + Arr[i];
      
    Make sure that you state your initial assumptions about what values are in what registers.
  3. (20 points)
    Write a program in the style of lecture 24 that implements an absolute difference operation (|A-B|). Assume that the ALU has opcodes for add, subtract, and whatever comparisons you want (less than, equal, greater that or equal, ...), but not for absolute difference. Assume that the inputs are initially in registers 0 and 1, and the result should be placed in register 2, when the program is finished. Assume that overflow is not a concern.
  4. (15 points)
    The following circuit is an inverting tri-state buffer. Each of the transistors in the diagram is labeled with a name. Draw a table that has a row for each of the four input patterns of A and En. In each row, indicate which of the transistors acts like an open (disconnected) switch and which acts like a closed switch, given the input pattern for that row. Also in each row, indicate the value of the output. Use "z" (from Verilog) to represent "high impedance", if there is no connection from the output to either power or ground.

  5. (15 points)
    The following circuit is an "AND-OR-INVERT" gate implemented in a static CMOS style. The logical expression for it is ~(A + (B * C)). Draw a circuit diagram for an "OR-AND-INVERT", for which the logical expression is ~(A * (B + C)). The fewer transistors you can use, the better. (For the purpose of grading, logical correctness is far more important than number of transistors.)