Coen 1

Fall 2000

 

 

 

Homework 2 DUE: Wednesday, September 27

1. Give the decimal, octal, and hexadecimal equivalents of the following binary numbers:

a. 11011001012
b. 1002
c. 11111112

2. Give the binary equivalents of the following decimal numbers:

a. 25510
b. 16310
c. 122010

3. Calculate the results of the following additions:

a. 111111111112 + 12
b. 101110011012 + 11000100102
c. 13758 + 514228
d. 82FA16 + 912116

4. Calculate the results of the following subtractions:

a. 110010010112 - 110001112
b. 10000000002 - 12

5. Fill out a truth table for the following logic function:

(A and (B or C)) nand D

 

The last two problems will give you a little more practice creating logic circuits from truth tables, but first we should review the process of getting a sum-of-products expression and turning that into a 2-level logic circuit.

Computer Logic Design

Consider the example we discussed in class, of designing a circuit to add together two one-bit binary numbers. Once we have such a circuit, we could link a number of them together to add binary numbers (for example, 32 adder circuits for a 32-bit integer). We can try to specify what the outcome should be using a truth table. There are two possible inputs (say, A and B) and a first attempt at a truth table is shown below:

A

B

A+B

0

0

0

0

1

1

1

0

1

1

1

10

This has a problem in the last row, where the result is larger than can be expressed as a one-bit binary number. Adding 1+1, of course, actually produces a 0 in the column we're adding, and generates a carry out to the next column to the left. That means our truth table needs to have two outputs, A+B and the carry out. Also, since it's possible that the column to the right of the one we're adding could have generated a carry out, our truth table needs to have another input representing that possibility. So we end up with an eight row table with three input values and two output values.

A

B

Cin

A+B

Cout

0

0

0

0

0

0

0

1

1

0

0

1

0

1

0

0

1

1

0

1

1

0

0

1

0

1

0

1

0

1

1

1

0

0

1

1

1

1

1

1

So how can we convert this truth table into a circuit that adds two digits together? There's a simple, mechanistic process for doing so that creates a two-level sum-of-products circuit. For each row where a particular output is 1, we want to and together a combination of all the inputs. If an input value in that row is a 1, we take just the input. If an input value for that row is 0, we first negate (or complement) the input before anding, by using the not operator.

Consider the A+B output column and the first row with a 1 for that output in the table (marked in italics). Since inputs A and B are both 0 we first negate them and then and all three together to get

(not A) and (not B) and Cin

We can write this in a shorthand notation, using ' to represent a negated input, as

A'B'Cin

This logical expression represents one of the products in the sum-of-products representation. We do the same for each of the four rows with a one for the A+B output. Finally, we or together all the and terms. If we use a + symbol to represent the or operation, the full logical expression for the sum digit of our adder is

A'B'Cin + A'BCin' + AB'Cin' + ABCin

Once we have the logical expressions, we can implement them as a two-level circuit with the first level all and gates (combinations of transistors that implement the and logic function) and the second level a single or gate. Each and gate has as many inputs as the truth table, and the or gate has as many inputs as there are and gates. The circuit for the sum digit is shown below (A and B are the input digits being added, C is Carry in).

The sum-of-products representation is guaranteed to produce a correct logic circuit that is equivalent to any truth table.

Additional Problems

  1. Write the sum-of-products expression for the Cout column of the truth table above.
  2. Draw the circuit equivalent to your answer for problem 1.