We need to implement seven functions, C0 through C6, with four inputs, A, B, C, D. To implement then on a P16H8 chip, do the following:
First off, find F' as follows:
F' = (A'BC+AD+AC)' de Morgan's = (A+B'+C')*(A'+D')*(A'+C') distributivity = (A+B'+C')*(A'+C'D') distributivity etc. = A'B'+A'C'+C'D'Build the truth table, correspondingly:
A B C D | F' ------------------- 0 0 0 0 | 1 0 0 0 1 | 1 0 0 1 0 | 1 0 0 1 1 | 1 | 0 1 0 0 | 1 0 1 0 1 | 1 0 1 1 0 | 0 0 1 1 1 | 0 | 1 0 0 0 | 1 1 0 0 1 | 0 1 0 1 0 | 0 1 0 1 1 | 0 | 1 1 0 0 | 1 1 1 0 1 | 0 1 1 1 0 | 0 1 1 1 1 | 0This function can be implemented as follows:
2a 2b
2d
To implement as ROM (2c), just store the values of F' from the truth table in the 16 ROM words.
We start with a 3-bit Gray code sequence like the one used in Assigment 3 (ignoring the 4th bit): 000, 001, 011, 010, 110, 111, 101, 100. We will call this sequence the original sequence. The 6 different sequences can be obtained by 6 different permutations of the bits of the original sequence. Naming the 3 bits X,Y,Z, the original Gray code sequence contains bits in order XYZ. The 5 other permutations are XZY, YXZ, YZX, ZXY, ZYX. The sequence corresponding to the permutation ZXY, for example, will be: 000, 100, 101, 001, 011, 111, 110, 010. It is easy to check that the six sequences are indeed different.
To implement the NextGrayCodeSequence function, we follow this approach and make the inputs D, E, F choose one of the above six permutations. We also engage a logic block, SimpleNextGrayCode, which computes the next element of the original sequence. This logic block is similar to the one built in Assignment 3.
Then we follow these steps:
NextGrayCodeSequence() can be implemented as follows:
4a.
[7*2 pts]
C0 = AD' + AB'C' + A'C + A'BD + BC + B'D'
C1 = A'B' + AC'D + A'CD + A'C'D' + B'D'
C2 = AB' + A'B + A'C' + A'D + C'D
C3 = AD' + BC'D + B'C + B'D' + CD'
C4 = AB + AC + B'D' + CD'
C5 = ACD + AB'D + A'BC' + BD' + C'D'
C6 = AB' + AD + A'BC' + B'C + CD'
4b.
[10 pts]
Implementation as PLA is straightforward. (We are not asked to
optimize for the smallest number of gates etc.) Notice that there are more
than 16 distinct products altogether in C0...C6. For this reason,
implementing this as ROM or with multiplexers may produce a smaller
(but not necessarily faster) circuit.
First, a comment on carry-in and carry-out. In this problem we implement a 1-bit slice of an ALU. This means that multiple such slices will then be put together to form a complete ALU. (For example, 16 slices for a 16-bit ALU.) Therefore, to implement the operation A-B (in 2s complement) and A+1, the carry-in of the very first slice will be connected to 1 for those two operations and to 0 for all the other operations. For all the other slices, the carry-in will come directly from the carry-out of the previous slice. (In other words, there is no need to manipulate the carry-in and carry-out - they are directly input and output of the ALU slice.) The situation is similar to that in Katz Figure 5.8 (Page 250).
The circuit implementation below takes as inputs A, B, Cin, S0, S1, S2, M, and returns as outputs Fi, Cout.
Imagine we built a (single) truth table with columns for R and S, and we are going to add to it another column for f. When choosing the value for f in a given row of the truth table, we only need to consult the values for R and S in that same row, regardless of values of their inputs. Therefore we have the following four cases to consider:
Here is an example, where the column for f shows the general form of a solution, and f1...f4 are the particular solutions. (This assumes that there are no lines with R=0 and S=1.)
A B C | R | S | f | f1 f2 f3 f4 ---------------------------------------------- 0 0 0 | 1 | 0 | 0 | 0 0 0 0 0 0 1 | 0 | 0 | 0 or 1 | 0 1 0 1 0 1 0 | 1 | 1 | 1 | 1 1 1 1 0 1 1 | 0 | 0 | 0 or 1 | 0 0 1 1 | | | | . . . . | . . | . . | . . . | . . . .
Here are the circuits:
Here are the timings:
Out1, Out2, and Out3 represent three different representations of the same function. Different components of the circuit are assigned different delays as given in the problem statement. This results in the difference in their waveforms even though they implement the same boolean function. We note that there are glitches when the signals a,b,c swap from 1,0,1 to 1,1,0. This is because of the inverters, which delay the signal change for a unit time, which results in a glitch in the signals. The waveforms are different from those on the notes, and this is because the gate delays assigned are different from those assumed in the notes.