Lab 4 Pre-Work
Lab 4 is the combinational-logic lab, and almost all of its work happens before the session. The preparation sheet asks for three circuit schematics; the session itself is spent peer-checking them, getting them signed off by a tutor, and building the third one. Pairs with 2026-08-06-combinational-logic and combinational-logic-blocks.
The device pinout information is on Blackboard (learning resources → lab resources → digital logic) and in device-pinouts. The drawing rules every one of the three schematics is marked against are in circuit-schematics.
Warm-up: three recall questions from Lecture 4
Three multiple-choice questions on combinational logic. They are worth doing before you look at the circuits, because all three are about reading a block symbol correctly, which is exactly what Circuit 3 needs.
What does this symbol represent?
A trapezoid with the short edge on the left carrying three inputs \(A\), \(B\), \(C\) and the long edge on the right carrying eight outputs \(D_0 \ldots D_7\).
Answer: a 3:8 decoder. The flare direction is the whole tell — see csse2010-diagram-notation: a multiplexer’s wide edge is on the left (many data inputs funnelling to one output, selects entering the bottom), a decoder’s wide edge is on the right (\(n\) inputs fanning out to \(2^n\) outputs).
The distractors are worth naming:
- 3:8 multiplexer / 8:3 multiplexer — a multiplexer has exactly one output whatever its size, so eight output stubs rule it out immediately.
- 3:8 de-multiplexer — the near-miss. A demultiplexer routes a separate data input to one of \(2^n\) outputs under \(n\) selects; this symbol has only the three address lines and no data input, and no select stubs on the bottom edge.
- 8:3 encoder — that would be eight in, three out; this is the other way round.
See combinational-logic-blocks for what each block actually does.
Which diagram implements \(Z = \overline{S}\cdot X + S\cdot Y\)?
Five 2-to-1 multiplexers, differing only in what is wired to the 0 and 1 data inputs.
Figure 1: The five candidate multiplexers, lettered A to E. The data input labelled 0 is the one selected when S = 0, so the expression S-bar.X + S.Y is read straight off: X on input 0, Y on input 1, and nothing complemented. Option A is the only one that matches; every other option either swaps X and Y or complements a data input that the expression does not complement.
Answer: A. The mux’s data input labels are the value of the select that picks them, so \(\overline{S}X + SY\) means “X on 0, Y on 1”. No complement appears in the expression, so any option with a bar on a data input is out (B, C, E), and D has \(X\) and \(Y\) the wrong way round.
What should be connected to \(A, B, C, D\) so that \(X = \overline{S_1 \oplus S_0}\)?
A 4-to-1 multiplexer with data inputs \(A, B, C, D\) on 0–3, selects \(S_1 S_0\), output \(X\).
Figure 2: The 4-to-1 multiplexer with the answer written onto its data inputs in red, and the table that produces it. Using a mux as a function generator is mechanical: the select pair addresses each data input by its binary index, so tabulate the function against every select combination and the output column is literally the list of constants to tie the data inputs to. Here the function is the complement of XOR, so the constants are 1, 0, 0, 1. The 0/1 written at the end of a data input is the course’s logic-diagram notation for tying that input to logic low or logic high (device-pinouts); on a real schematic they become the ground and Vcc symbols.
Answer: (d) \(A=1\), \(B=0\), \(C=0\), \(D=1\) — the XNOR column. This is the technique of using a mux to implement a logic function; see combinational-logic-blocks.
Circuit 1 — a 2-to-1 multiplexer from 2-input NAND gates only
Draw a circuit schematic diagram for a 2-to-1 multiplexer that uses only 2-input NAND gates. The data inputs should be connected to push buttons. The select input should be connected to a switch. The output should be connected to an LED.
Hint: do the truth table (or a function table) for a 2-to-1 multiplexer, obtain the logic expression, then draw a logic circuit and convert it to the NAND equivalent circuit by replacing each gate with its NAND version. If you use Logisim, do not use the MUX module.
1. Function table
| \(S_0\) | \(D_0\) | \(D_1\) | \(F\) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
2. Sum of products and simplification
Deriving the unsimplified sum of products from the true outputs in the table:
- \(S_0 = 0\), \(D_0 = 1\), \(D_1 = 0 \rightarrow \bar{S_0} \cdot D_0 \cdot \bar{D_1}\)
- \(S_0 = 0\), \(D_0 = 1\), \(D_1 = 1 \rightarrow \bar{S_0} \cdot D_0 \cdot D_1\)
- \(S_0 = 1\), \(D_0 = 0\), \(D_1 = 1 \rightarrow S_0 \cdot \bar{D_0} \cdot D_1\)
- \(S_0 = 1\), \(D_0 = 1\), \(D_1 = 1 \rightarrow S_0 \cdot D_0 \cdot D_1\)
Using Boolean algebra, we can simplify this expression:
\[ \begin{aligned} F &= \bar{S_0} D_0 \bar{D_1} + \bar{S_0} D_0 D_1 + S_0 \bar{D_0} D_1 + S_0 D_0 D_1 \\ &= \bar{S_0} D_0 (\bar{D_1} + D_1) + S_0 D_1 (\bar{D_0} + D_0) \\ &= \bar{S_0} D_0 (1) + S_0 D_1 (1) \\ &= \bar{S_0} D_0 + S_0 D_1 \end{aligned} \]
3. NAND equivalent conversion
To implement this circuit using only 2-input NAND gates, convert the simplified AND-OR expression into a NAND-NAND expression by applying double negation and De Morgan’s laws:
\[ \begin{aligned} F &= \overline{\overline{\bar{S_0} D_0 + S_0 D_1}} \\ &= \overline{(\overline{\bar{S_0} D_0}) \cdot (\overline{S_0 D_1})} \end{aligned} \]
4. Circuit schematic
Exactly four 2-input NAND gates are needed, so the whole circuit fits on one 74HCT00. Using circuit-schematics labelling conventions they become U1:A–U1:D:
- One NAND acting as an inverter for \(S_0\) (both inputs tied to \(S_0\)) to make \(\bar{S_0}\).
- One NAND computing \(\overline{\bar{S_0} D_0}\).
- One NAND computing \(\overline{S_0 D_1}\).
- One final NAND combining the outputs of 2 and 3.
Figure 3: Circuit 1 as a schematic. The one thing to look at is U1:A: its two inputs are tied together by the wire carrying the junction dot, which is what turns a NAND into an inverter and is the move that keeps the whole design inside one package. Note also that S0 fans out twice - to U1:A and to U1:C - so the switch wire carries a second dot. The four gates use the 74HCT00’s pin sets 1,2 to 3; 4,5 to 6; 9,10 to 8; 12,13 to 11, and one power block covers the single chip type. The task only says switch, push buttons and LED, so the pin assignments for the switch, the two buttons and the LED are chosen from the IO board list in device-pinouts.
Circuit 2 — a 2-to-4 decoder
Draw a circuit schematic diagram for a 2-to-4 decoder, using whichever logic gates you prefer (from those available in the CSSE2010/CSSE7201 lab). The two inputs should be connected to switches. The outputs should be connected to LEDs.
The truth table (inputs \(A_1\), \(A_0\); outputs \(X_0 \ldots X_3\)):
| A1 | A0 | X0 | X1 | X2 | X3 | |
|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 0 | |
| 0 | 1 | 0 | 1 | 0 | 0 | |
| 1 | 0 | 0 | 0 | 1 | 0 | |
| 1 | 1 | 0 | 0 | 0 | 1 |
1. Boolean expressions
Since \(A_1, A_0\) can only take four combinations, each output’s truth-table row is already a single minterm — no Boolean simplification is needed, just one 2-input AND term per output:
- \(X_0 = \bar{A_1} \cdot \bar{A_0}\)
- \(X_1 = \bar{A_1} \cdot A_0\)
- \(X_2 = A_1 \cdot \bar{A_0}\)
- \(X_3 = A_1 \cdot A_0\)
2. Circuit schematic
Because every term is exactly two literals, this is the only one of the three circuits that needs no gate-building tricks at all: a 74HCT04 to make the two complements once each, and a 74HCT08 for the four products.
Figure 4: Circuit 2 as a schematic. Four vertical rails carry A1, A0 and their complements past all four AND gates, and each gate taps the one pair of rails that spells its minterm - the same rail idiom as the 3-to-8 decoder. Only the dots are connections: every other place a tap crosses a rail it is two wires passing. Exactly one AND gate can be high at a time, which is the decoder’s defining property and the thing to check when testing. The 74HCT04’s second half runs backwards (pin 9 in, pin 8 out), but this circuit only needs the first two inverters, so it is not exercised here.
Circuit 3 — a 4-bit two’s complement adder/subtractor
Using a 74HCT04, 74HCT157 and a 74HCT283, draw a circuit schematic diagram for a circuit which can act as a 4-bit two’s complement adder or subtractor. The output (4 bits from the 74HCT283, shown on LEDs) will have the value \(A+B\) or \(A-B\), where \(A\) and \(B\) are the 4-bit inputs taken from switches.
A push button input (\(M\), mode) determines whether the circuit adds or subtracts — if the value is 0, addition is performed; if the value is 1, subtraction is performed by calculating \(A+(-B)\).
The circuit is similar to the adder-subtractor in Lecture 4, except that the selection of the \(B\) input bits as \(B\) or \(\overline{B}\) is to be performed using multiplexers instead of XOR gates. (The 74HCT157 is a quad 2-to-1 multiplexer with a shared select input.) The carry output should be shown on an LED also.
The multiplexer IC in the kit, and its active-low ENABLE
Pin 15 of the 74HCT157 is its active-low ENABLE input. Two questions about it:
- What does active low mean? The pin performs its function when it is driven low, not high. That is why the device sheet writes the name overlined, \(\overline{\text{ENABLE}}\), and draws a bubble on that pin in the schematic symbol — the bubble is the notation for “inverted here” (see logic-gates).
- What should be connected to pin 15 for the IC to work? Logic 0 — tie it to GND. Left floating it is undriven and can read as either level at random, so the multiplexer intermittently stops passing its inputs through. This is the same failure mode the flip-flop lab returns to; see week3-lab-logisim-and-flip-flops.
Design reasoning
In two’s complement, \(-B = \bar{B} + 1\), so subtraction can be built from the same adder used for addition: \(A - B = A + \bar{B} + 1\). This means mode input \(M\) needs to do two things at once:
- Select whether the adder’s \(B\) input is \(B\) (add) or \(\bar{B}\) (subtract) — done with the 74HCT157.
- Inject the “\(+1\)” that turns one’s complement into two’s complement — done by wiring \(M\) straight into the adder’s carry-in, since \(C_0 = 0\) for addition (no extra bit needed) and \(C_0 = 1\) for subtraction (adds the required 1).
So \(M\) is wired to both the 74HCT157’s select line and the 74HCT283’s \(C_0\) pin — no separate control logic at all. That single fan-out is the whole idea of the circuit; everything else is bit-plumbing. Compare the XOR version of the same trick in combinational-logic-blocks — the multiplexer is doing exactly the job the controlled inverter did there, and the mode line still doubles as the carry-in either way.
Note also what the 74HCT157 being a quad mux with a shared select buys you: one chip conditions all four bits of \(B\) together, which is what you want, because a per-bit select would let the operand be half-complemented.
Select polarity. Wiring \(M\) straight to
SEL(rather than through an inverter) assumesSELlow selects the A channel andSELhigh selects B. That is the 74HCT157’s actual behaviour, but it comes from the part’s datasheet — the Device Pinouts and Symbols sheet (device-pinouts) names both channels and the select line without saying which level picks which. So put the raw \(B\) switches on theAinputs and the inverted ones onB, and check the polarity on the bench before you trust it: if the modes come out swapped, that one assumption is why.
Figure 5: Circuit 3 as a schematic. Follow the mode line M along the bottom: it forks once, at the junction dot, into the 74HCT157’s SEL (pin 1) and the 74HCT283’s carry-in C0 (pin 7) - one push button doing both halves of A + not(B) + 1. Channel A of the multiplexer takes the raw B switches and channel B takes them inverted by the 74HCT04, so SEL = 0 passes B and SEL = 1 passes B-bar. ENABLE (pin 15) is tied to ground because it is active low. The power block is split in two because the 74HCT04 is a 14-pin part while the 157 and the 283 are 16-pin. The task only names the three chips and the input and output devices, so the pin assignments for the switches, button and LEDs are chosen from the IO board list in device-pinouts.
The wiring, chip by chip
U1(74HCT04, hex inverter) — generates \(\bar{B_0}\)–\(\bar{B_3}\) for the multiplexer’s B channel:U1:A(1→2): \(B_0\) → \(\bar{B_0}\)U1:B(3→4): \(B_1\) → \(\bar{B_1}\)U1:C(5→6): \(B_2\) → \(\bar{B_2}\)U1:D(9→8): \(B_3\) → \(\bar{B_3}\) — note the direction reversal in the second half of the package
U2(74HCT157, quad 2-to-1 MUX) — selects \(B_i\) (channel A, \(M=0\)) or \(\bar{B_i}\) (channel B, \(M=1\)) per bit.SEL(pin 1) \(= M\);ENABLE(pin 15) tied to GND:A0–A3= pins 2, 5, 11, 14 = the \(B\) switchesB0–B3= pins 3, 6, 10, 13 =U1’s inverted outputsY0–Y3= pins 4, 7, 9, 12 → the adder’s B inputs
U3(74HCT283, 4-bit adder):A0–A3(pins 5, 3, 14, 12) = the \(A\) switches (unchanged by mode)B0–B3(pins 6, 2, 15, 11) =U2’sY0–Y3C0(pin 7, carry-in) = \(M\) (the same signal asU2’sSEL)S0–S3(pins 4, 1, 13, 10) → LEDsC4(pin 9, carry-out) → LED
Power supply connections are shown once per chip type, and this circuit has two different pin pairs: the 74HCT04 is a 14-pin package (Vcc 14, GND 7), while the 74HCT157 and 74HCT283 are 16-pin (Vcc 16, GND 8). Do not group all three together.
In the session
The session is spent working on the three schematics above:
- Complete the preparation tasks, and make sure the three schematics are correctly drawn, not just roughly right.
- Exchange your solutions with others at your table for peer evaluation.
- Get a tutor to verify your schematic diagrams.
- Construct the Circuit 3 (adder/subtractor) circuit on the breadboard and verify the functionality. Logisim simulation is allowed as well.
Construction advice
- Keep circuits neat — use the shortest wires you can.
- Turn the power off before you change the circuit.
- Debugging: use the logic probe (the
PRpin on the IO board — pin 16, see io-board), and be systematic: check power and ground connections first, then start at the inputs and work towards the outputs.
For each circuit
- Make sure you have a correct schematic before you build.
- Decide your test procedure — what truth table are you expecting?
- Build or simulate.
- Test systematically.
Don’t expect things to always work in the first instance. If things don’t work, troubleshoot systematically. Troubleshooting is also a part of your learning. A neatly drawn circuit schematic will always help when troubleshooting.
Stages of completion for the build: logic diagram only / schematic only / simulation only / attempted construction with incorrect output / fully working circuit with functionality verified.
Next
Lab 5 is the Logisim and flip-flops session, and the one where kits are loaned out — see week3-lab-logisim-and-flip-flops.