Computer Science 14 - Lab 2

The Lab Project

This lab project is to build an incrementer/decrementer circuit. This circuit has a two-bit input A = A1, A0, which represents an integer using two's complement notation, and also a Function selector F. When F=0, the circuit adds 1 to A. When F=1, the circuit subtracts 1 from A.

The circuit needs four output bits S = S1, S0, and E. The S bits represent either one more or one less than A (as determined by F), except when it is not possible to represent the correct number in two bits; in that case, the S1 and S0 bits can be anything you like. The E bit is an ``error detector.'' It is 0 when S is correct 1 when S is incorrect. (There is also a carry-out line that you don't have to think about.)


Before the lab:

In the Lab

Questions

Your answers to these questions are due in class on Friday.

  1. Suppose you wanted to build an 8-bit wide incrementer/decrementer circuit. Could you use the circuit you designed for this lab to make a bit-sliced design? If so, draw a diagram showing how you would hook up 4 copies of your 2-bit circuit to make an 8-bit circuit. If not, explain why not and describe a bit-sliced circuit that would work. Draw the truth table for one slice of the circuit, and show how individual components would be connected together.

  2. Suppose you have an 8-bit word size. Write the binary representations of the following base-ten numbers.

  3. What are the largest and smallest numbers you can represent in 6-bit two's complement notation?

  4. Convert the following binary representations into base-ten numbers.

  5. Convert the decimal numbers 165 and -165 to binary numbers in 8-bit two's complement notation.

  6. What is 0000 1100 plus 1111 0011? These are two's complement numbers. Write your answer both in two's complement and in base-ten.

  7. Suppose you have two two-bit numbers A = A1,A0 and B = B1, B0. Write the truth table for a ``less than'' function that takes the 4 input values, and is set to 1 whenever A is strictly smaller than B, when they are interpreted as unsigned integers. Then write the truth table for the ``less than'' function that takes the same 4 input values, but interprets them as two's complement numbers.