Teaching guide for the module

Logic gates and combinational circuits: Teacher's Guide

Teaching guide for the Logic Gates simulator: explain in class Boolean algebra, the AND/OR/NOT/NAND/NOR/XOR/XNOR logic gates with interactive truth tables, combinational circuits (Half Adder, Full Adder, magnitude comparator) and the physical implementation with transistors (the Behind the Gate feature). Designed for digital electronics teachers.

Module: Logic Gates · Two tabs: Single Gate · Combinational · Behind the Gate feature


Physical phenomenon

Digital electronics works with two logic states only, conventionally indicated as 0 (low level, typically 0 V) and 1 (high level, typically 5 V or 3.3 V). Every operation of a computer: addition, comparison, decisions, memory, reduces to combinations of elementary operations on these two states, encoded by Boolean algebra.

Logic gates are the basic building blocks. Each implements an elementary Boolean function:

  • NOT: inverts the input. .
  • AND: true only if all inputs are true. .
  • OR: true if at least one is true. .
  • NAND / NOR: negations of AND and OR. NAND (and NOR) are functionally complete: any logic function can be built from NANDs alone.
  • XOR: true if the inputs are different. .
  • XNOR: true if the inputs are equal (negation of XOR).

Combining gates produces combinational circuits that perform complex functions. The classic ones, present in the module, are:

  • Half Adder: sums two bits, returns sum (XOR) and carry (AND).
  • Full Adder: sums three bits (two data + carry-in), returns sum and carry-out. Chaining full adders builds an -bit adder.
  • Magnitude comparator: compares two binary numbers and returns , , .

Every logic gate is internally built from transistors (BJT or MOSFET): the Behind the Gate feature shows the actual transistor circuit beneath the abstract IEC symbol.


Key concepts

  • Boolean algebra: the mathematical formalism governing all digital electronics.
  • Truth table: the "ID card" of a gate or combinational circuit: lists all possible input combinations and the corresponding output.
  • IEC vs ANSI symbols: two graphic standards for representing gates. The module uses IEC (rectangles with the function symbol), the one found on European datasheets.
  • NAND/NOR universality: the industry could produce only this gate and build every digital circuit.
  • Combinational vs sequential: a combinational circuit depends only on present inputs; a sequential one has memory. This module covers combinational only.
  • Physical implementation with transistors: beneath the abstraction lies real electronics. The Behind the Gate feature is the bridge between symbolic logic and analogue electronics.

How to use it in the classroom

Opening: Single Gate tab, start with NOT. Select the NOT gate. Click its single input: the output toggles. Have students state the rule before showing the truth table on the side. Move on to AND and OR: one input at a time, build the truth table on the board and then compare it to the simulator's.

Development: universal gates. Move to NAND. Show that it is "AND with negated output". Press Behind the Gate: the IEC symbol fades and the actual NPN transistor circuit that implements it appears. Wires colour in real time as inputs vary: where there is "1" the wire glows. This is the most pedagogically rich moment, it links logic level to electronic level.

Deeper exploration: gates derived from primitives. Press Behind the Gate on AND: shows it is built as "NAND followed by NOT". Same for OR (NOR + NOT) and XNOR (XOR + NOT). On XOR the decomposition is even more instructive: 4 NANDs combined. Have students verbalise that with NAND alone you can build anything, fundamental theoretical concept of digital electronics.

Closing: Combinational tab. Build the truth table of the Half Adder by toggling all four possible inputs (A, B = 00, 01, 10, 11): show that the sum is and the carry . Move to the Full Adder and show the case . Conclude with the Comparator, highlighting that it is the basis of the >, <, == operators in any programming language.


Real-world examples

  • CPU of every computer. Billions of transistors organised into logic gates execute every program instruction. The ALU's adder is a chain of full adders.
  • Industrial control systems (PLCs). Combinational logic implemented in ladder language or function blocks, AND, OR, NOT gates with switches and sensors as inputs, actuators as outputs.
  • Address decoders. In a memory, an AND/OR network selects the correct cell from the address bits: every RAM access goes through combinational circuits.
  • Multiplexers and demultiplexers. Select one data line out of many. Found everywhere in digital buses, telecommunications, digital audio.
  • Keyboard encoders. When a key is pressed, a combinational network converts the physical press into a binary code sent to the microcontroller.
  • Security systems. Alarms triggered only when a precise combination of sensors is active (AND gate with many conditions).

Classroom discussion questions

  1. A 2-input NAND gate: how many cases does the truth table have? How many give output 1?
  2. Why is the NAND gate called "universal"? Try to build a NOT using only one NAND.
  3. A Half Adder sums two bits. What does the Full Adder do in addition, and why does it need the "carry-in"?
  4. Opening Behind the Gate on a NOT, behind the IEC symbol you see a transistor in "common emitter" configuration. What role does the transistor play that a mechanical switch could not play in a modern computer?
  5. A comparator compares two 4-bit binary numbers. How many input lines does it have, and how many output lines?

Related modules

  • Ohm's Law & Power Management: the Behind the Gate feature shows the transistors that physically implement the gates: the bias resistors visible in the schematic obey Ohm's Law and size their operation.

Ready to try it in your classroom?

Open the simulator →

No download. Works in the browser.