Computer ScienceExam code: 0984

Logic Gates and Circuits

Boolean Logic

The opposite direction is also examined: you are given a Boolean expression and have to draw the circuit.

Method. (1) Read the expression inside out: innermost brackets first, then NOT, then AND, then OR. (2) Use one gate per operator. (3) Wire each gate's inputs to the correct preceding signal (a labelled input variable, or the output of an earlier gate). (4) Make sure NOT gates appear before the negated value enters its next gate. (5) Label the last gate's output Q (or whatever name the question uses).

Common exam question

Drawing a logic circuit from an expression

Question: Draw a logic circuit for a given logic expression without simplifying it, using no gate with more than two inputs (4–5 marks).

Asked in 4 of the 17 papers, always followed by a truth table for the same expression. Each correct gate wired to the correct inputs earns one mark, so the marks match the number of operators (four in three papers, five in the other). Check that your circuit has one gate per operator, each drawn as its own standard symbol: NAND, NOR and XOR are single gates.

In all four papers one input appears twice in the expression but is printed once on the left: branch its line to both gates. A NOT before a single letter goes on that input; a NOT before a bracket goes on the output of that bracket's gate. One paper wrote it as conditions (A = 1 for A, C = NOT 1 for NOT C): translate each before you draw.

Worked example

Turning an expression into a four-gate circuit

Draw a logic circuit for X = (A NOR B) OR (NOT C AND B). Each gate may have at most two inputs, and the expression must not be simplified.

Solution:

  • Count the operators: NOR, NOT, AND and OR, so the circuit needs four gates.
  • Gate 1: a NOR gate with inputs A and B.
  • Gate 2: a NOT gate on input C. The NOT stands in front of the single letter C, so it inverts C alone.
  • Gate 3: an AND gate fed by Gate 2 and by B. B is printed only once on the left, so branch its line to reach both Gate 1 and Gate 3.
  • Gate 4: an OR gate fed by Gates 1 and 3, whose output is X.
  • The finished circuit has four gates (NOR, NOT, AND, OR), with B branching to Gates 1 and 3 and Gate 4's output labelled X
The finished circuit: inputs A and B feed a NOR gate; input C feeds a NOT gate; B also branches at a junction dot to an AND gate whose other input is the NOT gate's output; the NOR gate and the AND gate feed an OR gate whose output is labelled X.

Quick check

3 short questions on this note. See what has stuck, and where to look if something hasn't.

About 1 minute

Build on this topic