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:
- What four numbers can be represented with two-bit two's complement
notation? Write the base 10 equivalent for each bit pattern.
- Write out the complete truth table for this circuit. It should
have three inputs F, A1, and A0, and three outputs, S1, S0, and E.
- Use a Karnaugh map to simplify your circuit. Put X values in the
spots where you can choose the value: look for ways to choose
0 or 1 for the X values make the K-maps simple (big circles).
You should draw a separate K-map for each output.
- Draw the three circuits, one for each output.
- Your wiring will go faster if you write, on each gate in your circuit
diagram, the chip number that you will use for this gate.
Also write, next to each gate input/output, the pin numbers that you plan
to use. (Use the handout with the pin-out diagrams to do this.)
Bring your circuit diagrams with you to the lab.
In the Lab
- Wire up your incrementer/decrementer circuit and demonstrate that
it works.
- When you are finished, dissassemble your board and put things away.
Questions
Your answers to these questions are due in class on Friday.
- 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.
- Suppose you have an 8-bit word size. Write the binary representations
of the following base-ten numbers.
- 23 using unsigned integer notation
- -23, using signed magnitude
- 23 using two's complement notation
- -23 using two's complement
- What are the largest and smallest numbers you can represent in 6-bit
two's complement notation?
- Convert the following binary representations into base-ten numbers.
- 0000 0000 1001 1010 (interpreted in two's complement)
- 1111 1111 1111 0000 (interpreted in two's complement)
- 1000 0000 0000 1101 (interpreted in signed magnitude)
- Convert the decimal numbers
165 and -165 to binary numbers in 8-bit two's complement notation.
- 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.
- 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.