BACK_TO_LEARN_LAB

What Is a Logic Gate? A/L ICT Guide with Truth Tables

Learn what a logic gate is, how AND, OR, NOT, NAND, NOR, XOR and XNOR gates work, and how to read their truth tables — with a free online simulator for Sri Lankan A/L ICT students.

තාර්කික ද්වාරයක් යනු කුමක්ද? සත්‍යතා වගු සහිත උසස් පෙළ ICT මඟපෙන්වීම

තාර්කික ද්වාර යනු මොනවාද, AND, OR, NOT, NAND, NOR, XOR, XNOR ද්වාර ක්‍රියාකරන ආකාරය සහ සත්‍යතා වගු කියවන අයුරු — ශ්‍රී ලාංකික උසස් පෙළ ICT සිසුන් සඳහා.

A logic gate is a basic building block of digital circuits. It takes one or more binary inputs (0 = false / off, 1 = true / on) and produces a single binary output based on a fixed Boolean rule. Every computer — from a calculator to a phone — is built from millions of these gates.

The seven basic logic gates

Gate Rule Output is 1 when…
AND A · B both inputs are 1
OR A + B at least one input is 1
NOT ¬A the input is 0 (it inverts)
NAND ¬(A · B) any input is 0 (NOT of AND)
NOR ¬(A + B) both inputs are 0 (NOT of OR)
XOR A ⊕ B inputs are different
XNOR A ⊙ B inputs are the same

How to read a truth table

A truth table lists every possible combination of inputs and the resulting output. For a 2-input gate there are 2² = 4 rows; for 3 inputs, 2³ = 8 rows.

Example — the AND gate:

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

Build it yourself

Open the Logic Gate Sandbox and drag an AND gate, two toggle switches and a bulb onto the canvas. Wire the switches into the gate’s inputs and the gate output into the bulb — then flip the switches and watch the live truth table update in real time.

Understanding gates is the foundation of Boolean algebra, combinational logic and the A/L ICT syllabus. Once you are comfortable, move on to Boolean algebra laws and building your own truth tables.

තාර්කික ද්වාරයක් (Logic Gate) යනු ඩිජිටල් පරිපථවල මූලික තැනුම් ඒකකයයි. එය ද්විමය ආදාන එකක් හෝ කිහිපයක් (0 = අසත්‍ය / Off, 1 = සත්‍ය / On) ලබාගෙන නිශ්චිත බූලීය නීතියකට අනුව එක් ද්විමය ප්‍රතිදානයක් (Output) ලබා දෙයි. සරල ගණක යන්ත්‍රයේ සිට සුපිරි පරිගණක දක්වා සෑම උපකරණයක්ම නිර්මාණය වී ඇත්තේ මෙවැනි ද්වාර මිලියන ගණනක එකතුවෙනි.

මූලික තාර්කික ද්වාර 7

ද්වාරයබූලීය නීතියප්‍රතිදානය 1 වන්නේ…
AND ද්වාරයQ = A · Bආදාන සියල්ලම 1 වූ විට පමණි
OR ද්වාරයQ = A + Bඅවම වශයෙන් එක් ආදානයක් හෝ 1 වූ විට
NOT ද්වාරය (Inverter)Q = A'ආදානය 0 වූ විට (ආදානය ප්‍රතිවිරුද්ධ කරයි)
NAND ද්වාරයQ = (A · B)'ඕනෑම ආදානයක් 0 වූ විට (AND හි ප්‍රතිවිරුද්ධය)
NOR ද්වාරයQ = (A + B)'ආදාන සියල්ලම 0 වූ විට (OR හි ප්‍රතිවිරුද්ධය)
XOR ද්වාරයQ = A ⊕ Bආදාන දෙක එකිනෙකට වෙනස් වූ විට
XNOR ද්වාරයQ = (A ⊕ B)'ආදාන දෙක එකම අගයක් ගත් විට

සත්‍යතා වගුවක් කියවන ආකාරය

සත්‍යතා වගුවක ආදානවල සියලුම සංයෝජනයන් සහ ලැබෙන ප්‍රතිදානයන් පෙන්නුම් කරයි. ආදාන 2ක් සහිත ද්වාරයකට පේළි 2² = 4ක් ද, ආදාන 3ක් සඳහා පේළි 2³ = 8ක් ද ඇත.

උදාහරණය — AND ද්වාරය:

ABQ (A AND B)
000
010
100
111

ඔබම නිර්මාණය කර අත්හදා බලන්න

Logic Gate Sandbox එක විවෘත කර AND ද්වාරයක්, Toggle ස්විච 2ක් සහ බල්බයක් Canvas එකට එක් කරන්න. ස්විච ක්‍රියාත්මක කරමින් ප්‍රතිදානය සජීවීව වෙනස් වන ආකාරය නිරීක්ෂණය කරන්න.