IB COMPUTER SCIENCE | A1.2.5 Construct Logic Diagrams

Lesson objective

Construct labelled logic diagrams from Boolean expressions and requirements, connect gates correctly, and verify their behaviour using truth tables.

Learn

A1.2.5 | CONSTRUCT LOGIC DIAGRAMS

01 | TURN A RULE INTO A CIRCUIT

A room lamp should turn on when the room is dark or a person requests it manually. However, a disable switch must prevent the lamp coming on. How could you show that rule using logic gates?

A logic diagram represents a Boolean function using gate symbols and connecting signal lines. Each gate applies its own rule. The connections show how results move between gates to produce the final output.

You have already used expressions and truth tables. A diagram gives a third view of the same behaviour: an expression describes the operations, a diagram shows their connections, and a truth table checks every input combination.

This lesson builds diagrams from simple expressions first, then combines gates into larger circuits. We use one-input NOT and two-input versions of the other gates.

02 | DEFINE THE SIGNALS BEFORE DRAWING

Use A = “room is dark”, B = “manual request” and C = “lamp disabled”. Define output X = “lamp on command”. For each signal, 1 means the statement is true and 0 means it is false.

The requirement becomes X = (A OR B) AND (NOT C). The bracketed OR provides the request. NOT C is true when the lamp is not disabled. The final AND allows a request through only when the disable condition is false.

Do not label C as “enabled” and still invert it. That would change the rule. Write the definitions beside your drawing so another person can interpret the diagram without guessing.

SignalMeaning of 1Meaning of 0
ARoom is darkRoom is not dark
BManual request activeNo manual request
CLamp disabledLamp not disabled
XLamp on commandLamp off command

03 | RECOGNISE INPUTS, OUTPUTS AND GATE SYMBOLS

Signals in our diagrams enter from the left and outputs leave on the right. A line carries one logical value at a time; it does not represent a number that must be added to the other lines.

A D-shaped body represents AND. OR has a curved input side. XOR adds another curved line before the OR shape. NOT is a triangle with a small output circle. The small circle is an inversion bubble, meaning the result is complemented.

NAND, NOR and XNOR add an output bubble to AND, OR and XOR respectively. The bubble changes the Boolean function, so it must be clear. Other symbol conventions exist; this lesson consistently uses these distinctive shapes.

ABANDX = A AND B
A single gate is already a complete logic diagram when its inputs and output are labelled.

04 | START WITH THE OUTERMOST OPERATION

For a longer expression, ask: which operation produces the final output? In X = (A OR B) AND (NOT C), the final operation is AND. Draw that gate near the right and label its output X.

Its two inputs are not directly A and B. They are the results of the two grouped expressions. Call them P = A OR B and Q = NOT C. Connect P and Q to the final AND.

Then build the smaller expressions to the left. This approach works backwards from the output while the finished signals flow forwards from inputs to output. It prevents you drawing gates in the order that their names happen to appear on the page.

Sub-expressionGate neededOutput label
A OR BOR with inputs A and BP
NOT CNOT with input CQ
P AND QAND with inputs P and QX

05 | BUILD AND CONNECT THE THREE GATES

Draw OR on the upper left and connect A and B to its inputs. Its output is P. Draw NOT below it and connect C to its single input. Its output is Q.

Draw the final AND to the right. Connect the OR output P to one AND input and NOT output Q to the other. Label the final output X. There are three independent inputs and three gates. P and Q are internal signals, not additional independent inputs.

ABCORPNOTQANDX
P = A OR B; Q = NOT C; X = P AND Q. Follow each wire into the next gate.

The wire from P bends down to the upper input of AND. The wire from Q bends up to its lower input. The two routes are separate; they must not be joined together. Draw with space around labels so a reader can follow each connection.

06 | REVEAL THE CONSTRUCTION ONE STAGE AT A TIME

Start with the three input lines, then add the gates in stages. At each stage, say what the new output means before revealing the next connection.

ABCORPNOTQANDX

07 | CHECK A DIAGRAM BY TRACING ITS SIGNALS

Construction is not finished until you check the connections. Use A = 0, B = 1 and C = 0. OR produces P = 1; NOT produces Q = 1; AND produces X = 1. This matches a manual request while the lamp is not disabled.

Now change C to 1. Q becomes 0 and the final AND must output 0. If your diagram still turns the lamp on, inspect the NOT gate or the final connection.

One successful example does not prove the diagram works for every input. A complete three-input truth table tests all eight combinations. The activity below displays intermediate outputs as well as the final result.

Complete check of the lamp diagram; the current input row is highlighted
ABCPQX

08 | WHERE NOT GOES CHANGES THE MEANING

X = NOT (A OR B) means calculate OR first and invert its output. Draw OR, then NOT. A single NOR gate gives the same Boolean function.

By contrast, Y = (NOT A) OR B inverts only A before the OR. That requires a NOT on A’s route, not on the final output. These expressions are not interchangeable.

With A = 0 and B = 1, NOT (A OR B) gives 0, but (NOT A) OR B gives 1. This counterexample is enough to show the circuits differ.

ABORNOTX
The NOT is after OR, so it inverts the whole OR result.
ABNOT (A OR B)(NOT A) OR B
0011
0101
1000
1101

09 | BRANCHING A SIGNAL IS NOT COMBINING OUTPUTS

Sometimes the same input is needed in more than one part of a circuit. For X = (A AND B) OR (A AND C), A must reach both AND gates. A signal can branch so that the same value is supplied to several inputs. This is often called fan-out.

Mark an intended junction clearly with a filled dot. In this lesson, two crossing lines without a dot are not connected. Avoid unnecessary crossings, and use the convention required by your course or diagram tool consistently.

A branch copies access to one signal; it is not a gate and does not calculate AND or OR. Do not join the outputs of separate gates to pretend you have combined their values. Use an appropriate gate to perform that operation.

AA to first gateA to second gate
Both branches carry the same logical value. They are not two independent inputs.

In a real circuit, electrical loading limits how many inputs an output can drive. Here we are constructing the logical model rather than choosing physical components.

10 | READ A DIAGRAM BACK INTO AN EXPRESSION

To check your own drawing, reverse the process. Start at the left, label each gate output with its expression and substitute those expressions into later gates.

For our lamp, the upper gate gives P = A OR B. The lower gate gives Q = NOT C. The last gate gives X = P AND Q. Substitution gives X = (A OR B) AND (NOT C), exactly the intended rule.

If your drawing reads back as X = A OR (B AND NOT C), you have changed the grouping. In that circuit, A = 1 makes X = 1 even if C = 1. The final OR allows A to bypass the disable condition.

Reading back is useful because a drawing can look tidy yet still connect the wrong signals. Check the structure, then use a full truth table to check the behaviour.

11 | CHOOSE THE GATES AND TEST YOUR DESIGN

The layout below has fixed connections: A and B enter gate P, C passes through the lower route Q, then P and Q enter the final gate. Choose each function to implement X = (A OR B) AND (NOT C).

The lower “wire” option passes C through unchanged; it is included to help you see the effect of omitting NOT. The checker compares your design with the required output for every input combination. If it fails, it gives one counterexample.

12 | CONSTRUCT FROM A REAL REQUIREMENT

An equipment locker should release if a valid card is present or a staff override is active, but only while the safety lock is inactive. Define V = valid card, S = staff override, L = safety lock active and R = release.

Translate the request as V OR S, the permission as NOT L, and combine them with AND: R = (V OR S) AND (NOT L). The diagram has the same structure as the lamp example, with different signal labels.

A common error is R = V OR (S AND NOT L). That allows a valid card to bypass the safety lock. The required phrase “but only while…” applies to the whole release request, so the final gate must enforce the permission on both possible requests.

Construct the correct diagram in your book and check V = 1, S = 0, L = 1. The correct output is 0. Then construct its complete truth table. This is a simplified Boolean requirement, not a complete physical safety or security design.

13 | WORKING FROM A TRUTH TABLE

If you are given a truth table rather than an expression, one constructive method is to identify every row where the output is 1. Make an AND term that recognises each such row, then OR those terms together. This gives a working diagram, though not necessarily the simplest one.

For two inputs, suppose X = 1 for 01 and 10 only. The 01 row is recognised by (NOT A) AND B. The 10 row is recognised by A AND (NOT B). OR the two results: X = ((NOT A) AND B) OR (A AND (NOT B)).

Draw two NOT gates to supply the complemented inputs, two AND gates to detect the rows, and one OR gate for the final output. You may branch A and B where they are needed on more than one route.

The table is also the two-input XOR function, so one XOR gate is an equivalent implementation. A longer correct diagram can implement the same function as a shorter one. Follow any stated restrictions on the gate types you may use.

AB(NOT A) AND BA AND (NOT B)X
00000
01101
10011
11000

14 | A CONSTRUCTION CHECKLIST THAT EXPLAINS YOUR THINKING

Begin by defining the inputs and output. Translate the rule into an expression with clear grouping. Identify the final operation, draw its gate, then construct the sub-expressions that feed it. Label intermediate signals where that makes the connections easier to explain.

Use recognisable symbols, clear input and output labels, and a separate line to each intended gate input. Show junctions explicitly. Leave space around wires and bubbles, and avoid ambiguous crossings.

Finally, read your drawing back into an expression and check every input combination. A diagram is correct because its connections produce the required behaviour, not because it resembles a sample’s position or colour.

For a construct question, provide the actual completed diagram. Describing “use an OR and an AND” without showing their inputs and connections leaves the solution incomplete.

MATCH THE DIAGRAM TERM TO ITS MEANING

Terminology

Terminology

Logic diagram

Gate symbols connected to represent a Boolean function.

Gate symbol

A graphical representation of a logic operation.

Signal

A logical value carried along a connection.

Input

A supplied value entering a circuit or gate.

Output

A result produced by a circuit or gate.

Intermediate signal

A result inside a circuit used by another gate.

Boolean expression

A notation describing logical operations and their grouping.

NOT

A one-input gate that reverses its logical value.

AND

For two inputs, 1 only when both inputs are 1.

OR

For two inputs, 1 when at least one input is 1.

XOR

For two inputs, 1 when their values differ.

NAND

NOT of the complete AND result.

NOR

NOT of the complete OR result.

XNOR

For two inputs, 1 when their values are equal.

Inversion bubble

A small circle indicating a complemented signal.

Connection

A signal path between a source and a destination.

Junction

An intended connection between signal-line branches.

Branch

A split allowing the same signal to reach several inputs.

Fan-out

Supplying a signal to multiple destination inputs.

Independent input

A signal that can vary freely in the Boolean model.

Grouping

The organisation of operations shown by brackets or connections.

Final operation

The operation that directly produces the circuit output.

Truth table

Outputs listed for every possible input combination.

Logical equivalence

Identical output for every combination of shared inputs.

Counterexample

An input combination disproving a claimed behaviour.

Construct

Create the complete diagram with the required structure and connections.

Questions

Questions

CHECK YOUR UNDERSTANDING

Select all correct choices. Each exact set earns one point.

1. What must a complete logic diagram show?
2. What is the final gate for X = (A OR B) AND NOT C?
3. Which correctly describe the lamp circuit?
4. What does an output bubble indicate?
5. Which circuit implements NOT (A OR B)?
6. What is true about a branch from A?
7. How many independent inputs are in the lamp circuit with internal signals P and Q?
8. Which input exposes the error X = A OR (B AND NOT C) for the lamp requirement?
9. Which are good checks on a constructed diagram?
10. Which implements the two-input XOR table?

EXPLAIN AND COMPARE

Write your answers before revealing each sample.

1. Construct a logic diagram for X = A AND B.

2. Construct X = (A OR B) AND NOT C.

3. Describe how to identify the final gate in an expression.

4. Construct NOT (A OR B) in two equivalent ways.

5. Explain why NOT (A OR B) differs from (NOT A) OR B.

6. Construct X = (A AND B) OR (A AND C).

7. Explain why joining gate outputs is not a substitute for OR.

8. Construct the locker diagram for R = (V OR S) AND NOT L.

9. Construct a two-input XOR function using only NOT, AND and OR.

10. Explain how to verify a completed diagram.

CONSTRUCT IT | A GREENHOUSE FAN

A greenhouse fan should run when the temperature is high H and a door is closed D, or when a manual override M is active. Here the manual override bypasses the other two conditions. Define output F, write a grouped expression, and construct a labelled logic diagram. Then check all eight inputs. Compare this requirement with one where the door must be closed even during manual override.

Flashcards

Flashcards

Click to flip. Select the ideas you need to revisit.

0 cards selected for revision.

    Selections are kept while this page is open.

    Workbook

    Workbook

    COMING SOON

    The workbook for A1.2.5 Construct Logic Diagrams is coming soon. Complete the matching task and written questions in your exercise book.