Review D: Components of digital circuits
printable versionD1: [1] [2] [3] [4] [5] [6] // D2: [1] [2] [3] [4] [5] // D3: [1] [2] [3] [4] [5] [6] [7] // D4: [1] [2] [3] [4] [5]
Problem D1.1
Draw two truth tables illustrating the outputs of a halfadder, one table for the sum output and the other for the carry output.


Problem D1.2
Fill in the truth table at right for the following circuit. Ignore rows not included in the table.
a b c x y 0 1 1 1 0 1 1 1 0 1 1 1
a  b  c  x  y 
0  1  1  1  0 
1  0  1  1  1 
1  1  0  1  1 
1  1  1  0  0 
Problem D1.3
In terms of the meanings of inputs and outputs, what distinguishes a half adder from a full adder?
A half adder has two inputs and outputs the sum of these two bits, while a full adder has three inputs and outputs the sum of these three bits.
Problem D1.4
Using only halfadders, diagram how you could construct a full adder. Be sure to label your inputs x, y, and z and the outputs carry and sum. Also, please label the outputs carry and sum for each halfadder.
Problem D1.5
Using only half adders and full adders, diagram a circuit that takes six inputs representing two 3bit unsigned binary numbers a_{2}a_{1}a_{0} and b_{2}b_{1}b_{0}, and which produces an output of a 4bit result s_{3}s_{2}s_{1}s_{0} representing the sum of the two numbers. Label your input and output wires.
Problem D1.6
Using only fourbit adders, construct an eightbit adder. Each fourbit adder has two fourbit inputs and one fivebit output. Your eightbit adder should have two eightbit inputs and a one eightbit output (don't worry about the ninth output bit).
The design of this circuit is similar in structure to the design of a full adder using half adders.
Problem D2.1
Suppose we have a 4to1 multiplexer whose inputs are d_{00}, d_{01}, d_{10}, d_{11}, s_{0}, and s_{1}. What is the output in each of the following cases?
d_{00}  d_{01}  d_{10}  d_{11}  s_{0}  s_{1}  out 
0  0  0  0  1  0  
0  0  0  1  1  1  
0  0  1  0  0  0  
0  1  0  1  1  0  
0  1  1  1  1  1  
1  1  0  1  0  1  
1  1  1  0  1  1 
d_{00}  d_{01}  d_{10}  d_{11}  s_{0}  s_{1}  out 
0  0  0  0  1  0  0 
0  0  0  1  1  1  1 
0  0  1  0  0  0  0 
0  1  0  1  1  0  0 
0  1  1  1  1  1  1 
1  1  0  1  0  1  1 
1  1  1  0  1  1  0 
Problem D2.2
Describe the inputs and outputs of a 1to4 demultiplexer, and how they relate.
A 1to4 demultiplexer has three inputs, including a data input and two select inputs representing the two bits of a number s. It has four outputs, number 00_{(2)} through 11_{(2)}. The demultiplexer routes its data input to the output whose number is s; the other outputs' values will be 0.
Problem D2.3
For the following circuit using two 2to1 multiplexers, complete the corresponding truth table.
x  y  out 
0  0  0 
0  1  0 
1  0  1 
1  1  1 
Problem D2.4
Using only 2to1 multiplexers, build a 4to1 multiplexer. You should label your circuit's inputs d_{00}, d_{01}, d_{10}, d_{11}, s_{0}, and s_{1}, and you should label the circuit's output out.
Problem D2.5
Draw a circuit taking two 2bit inputs a and b (whose individual bits are a_{1}a_{0} and b_{1}b_{0}) as well as a 1bit input op. The output of the circuit should be a 3bit number that is a + a if op is 0 and a + b if op is 1.
Feel free to use components we saw in class, such as adders, multiplexers, demultiplexers, and flipflops.
Problem D3.1
Some circuits are combinational, while others are sequential. What distinguishes these two types of circuits?
In a combinational circuit, the output can be determined entirely by the current combination of inputs. In a sequential circuit, the output may also depend on the sequence of previous inputs.
Problem D3.2
Draw an SR latch using NOR gates. Label the S and R inputs and the Q output so that R, when 1, resets the latch value to 0, and S, when 1, sets the latch value to 1.
Problem D3.3
Describe the distinction between the behavior of an edgetriggered component (as with a D flipflop) and a leveltriggered component (as with a D latch).
In an edgetriggered device, the value changes only at that instant that the clock input becomes 1. In a leveltriggered device, however, the memory value continues adopting any values given as long as its set input is 1. (For example, in a D flipflop, if the D input changes while clock remains 1, the remembered value doesn't change. In a latch, however, the D input changing while set is 1 results in a change to the remembered value.)
Problem D3.4
Explain how the below implementation of a D flipflop creates an edgetriggered circuit out of two leveltriggered D latches.
As long as ck is 0, the second latch's set input is 0, so its value and its output remains unchanged. For the first latch, though, the set input is 1, and so the first latch's value continuously updates to the value of D. When ck changes to 1, the first latch's set input changes to 0, so the latch's value freezes at the value of D at the time that ck changed to 1. Meanwhile, when ck becomes 1, the second latch's set input changes to 1, and so it begins setting the latch's value to its data input — which is the value of D at the time that ck became 1 as stored in the first latch.
Problem D3.5
Recall that a D flipflop as studied in class takes two inputs, D and ck, and it has an output named Q. Suppose all inputs and the output are currently 0, and the inputs change as described below. When does Q change within the event sequence, and to what value?
1.  D changes to 1. 
2.  ck changes to 1. 
3.  D changes to 0. 
4.  ck changes to 0. 
5.  ck changes to 1. 
6.  D changes to 1. 
At step 2, the D flipflop's value changes to 1. At step 5, it changes to 0.
Problem D3.6
The below circuit includes two D flipflops. Recall that a D flipflop's stored state remains unchanged as long as set = 0. At the instant that set switches to 1, its stored bit switches to value, and it retains this value until set changes to 1 again.
Say a user enters the sequence of inputs given in the table at right, one after the other. Label what the output of the circuit will settle into after each of the user's inputs.
a b c o 1 1 1 ? 0 1 1 ? 0 0 1 ? 0 0 0 ? 0 1 0 ? 0 0 0 ? 1 0 0 ?
a  b  c  o 
1  1  1  1 
0  1  1  1 
0  0  1  1 
0  0  0  1 
0  1  0  0 
0  0  0  0 
1  0  0  1 
Problem D3.7
Suppose the upper D flipflop in the below circuit were holding 1 and the lower D flipflop held 0, while the x input were 0. Then somebody toggles the x input five times (to 1, then 0, then 1, then 0, then 1). Complete the table to show how the output values would change.
x a b 0 1 0 1 0 1 0 1
x  a  b 
0  1  0 
1  0  0 
0  0  0 
1  0  1 
0  0  1 
1  1  0 
Problem D4.1
We studied the below circuit implementing a counter for a turnstile. How would this circuit behave if we were to use D latches (leveltriggered) in place of the D flipflops (edgetriggered)?
For the duration that somebody is in the beam (in is 1), the latches will update their data inputs. The new values will feed into the adder, which will feed back into data inputs, for updating the latches again, and again, and again. The consequence is that the counter counts as quickly as it can as long as somebody is in the beam; once the person exits the beam, the resulting value has gone up by far more than 1, increasing by an unpredictable amount.
(Actually, since the different adder outputs have different depths, and since there will inevitably be variations in how fast the transistors update anyway, the behavior is even more erratic than simply counting very quickly: Some latches will update more frequently than other latches.)
Problem D4.2
Using a 2to1 multiplexer and a D flipflop, build a circuit that has one output and three inputs T, X, and ck. The circuit's output should stay at the same value regardless of the inputs, until the instant when ck changes from 0 to 1. At that time, if T is 1, the circuit's output should toggle to its opposite value; and if T is 0, the output should change to the value of X at that instant.
Note: Do not use logic gates. Recall that a D flipflop has outputs Q and Q.
Problem D4.3
Using two D flipflops and simple logic gates (AND/OR/NOT), build a circuit whose output is 1 on every fourth clock cycle. That is, when the output is 1, the output should flip to 0 for the next three times the clock goes from 0 to 1, then flip to 1 for the fourth time, then repeating the cycle.
Problem D4.4
Using just AND, OR, and NOT gates in addition to two D flipflops, build a singleinput circuit whose twobit output changes as follows each time its single input rises from 0 to 1: When the output is 01_{(2)}, it changes to 10_{(2)}; when the output is 10_{(2)}, it changes to 11_{(2)}; and when the output is 11_{(2)}, it changes to 01_{(2)}. (This might be useful for controlling a traffic light.)
Problem D4.5
Suppose I have eight flipflops numbered 0 through 7 and I have a 3bit memory address indicating which flipflop's bit I wish to retrieve. What component would be useful for retrieving the bit from the appropriate flipflop?
We would want an 8:1 multiplexer, where each flipflop's output is wired into one of the multiplexer's indexed inputs, and the address bits are connected to the multiplexer's select inputs.