You are on page 1of 13

Computer Logic and Gates

 Data Representation in Computer

 Logic Gates
DATA REPRESENTATION IN COMPUTER
• Computer system operates on millions of electronic • American Standard Code for Information
switches. Interchange (ASCII) is commonly used
• These switches operate on 2 states, either ON/OFF. alphanumeric code.
• These two states are referred as 1 or 0 as ON/OFF. • ASCII is a 7 bit alpha numeric code for information
• These 1 and 0 are known as binary digits. interchange.
• When current flows through a circuit, it shows ON • Total number of characters ASCII represents is 128.
state or binary 1. • Digital Logic Circuits:
• When current stops flowing through a circuit, it • Circuits that operate on only two state of signals
shows OFF state or binary 0. (1 and 0) are called digital logic circuits.
• Computer uses alphanumeric codes to recognize
codes that represent numbers, letters and special
characters.
• Alphanumeric codes consists of
• Upper and Lower case letters
• Numbers
• Special characters
LOGIC GATES
• Digital logic is the fundamental part for composition of electronic devices such as
calculators, computers, watches, etc.
• Logic gates are basic building blocks of digital circuits that perform a certain
logical function.
• We will study:
• Basic Logic Gates
• Truth Tables
• Further Logic Gates
BASIC LOGIC GATES
AND Gate OR Gate NOT Gate
• AND gate has 2 inputs. • OR gate has 2 inputs. • NOT gate has 1 input.
• AND gate gives one output. • OR gate gives one output. • NOT inverts the input and gives
• Input can be either ON(1) or • Input for OR Gate can either be the output.
OFF(0). ON(1) or OFF(0). • NOT is also known as ‘inverter’.
• Output formed by AND Gate is • Output formulated by OR gate is • Output of NOT can be ON(1) if
the logical multiplication of it’s the logical addition of the inputs. the input given to gate is
inputs. • OR output can be ON(1) when OFF(0).
• AND output can be ON(1) only there any one of the inputs is
if both inputs are ON(1). ON(1).
CIRCUIT DIAGRAMS OF LOGIC GATES
AND Gate OR Gate NOT Gate

• In 0, 0 Out 0 • In 0, 0 Out 0
• In 0, 1 Out 0 • In 0, 1 Out 1 • In 0, 0 Out 0
• In 1, 0 Out 0 • In 1, 0 Out 1 • In 1, 1 Out 1
• In 1, 1 Out 1 • In 1, 1 Out 1
TRUTH TABLES
• Truth table represents digital logical circuit in table form.
• Truth table has different columns for respective number of inputs and
outputs.
• Number of rows ‘n’ can be found by , where .
• Number of inputs may differ according to the logical gate, i.e., AND
and OR have 2 input columns and NOT has 1 input column.
• Truth tables have one output column that shows the relation between
different inputs of the logical gate.
• Truth tables can also be constructed according to a given function F.
EXAMPLE TRUTH TABLE FOR F
• Let a function
A B C F Hints:
0 0 0 1 1 1 0 • Calculate first using
0 0 1 1 1 0 1 binary multiplication.
• Then calculate using
0 1 0 1 0 1 0
binary multiplication.
0 1 1 1 0 0 0 • Add both the results
1 0 0 0 1 1 0 using binary addition to
get values of F.
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
TRUTH TABLE FOR AND, OR & NOT
AND (F = A * B) OR (F = A + B) NOT (F = )

A B F A B F
0 0 0 0 0 0 A F
0 1 0 0 1 1 0 1
1 0 0 1 0 1 1 0
1 1 1 1 1 1

• In 0, 0 Out 0 • In 0, 0 Out 0
• In 0, 1 Out 0 • In 0, 1 Out 1 • In 0, 0 Out 0
• In 1, 0 Out 0 • In 1, 0 Out 1 • In 1, 1 Out 1
• In 1, 1 Out 1 • In 1, 1 Out 1
NOR AND NAND GATES
NOR GATE NAND GATE
• NOR gate is formed by combination of logical • NAND gate is formed by combination of logical
NOT and logical OR. NOT and logical AND.
• NOR gate first calculates OR of the function inputs • NAND gate first calculates AND of the function
and then inverts the output of the result. inputs and then inverts the output of the result.
• NOR can be formed by joining OR circuit to NOT • NAND can be formed by joining AND circuit to
circuit. NOT circuit.
• Output for NOR will be ON(1) when both the • Output for NAND will be ON(1) whenever one of
inputs will be OFF(0). the inputs will be OFF(0).
TRUTH TABLE FOR NOR & NAND
NOR (F = NAND (F =

A B F A B F
0 0 1 0 0 1
0 1 0 0 1 1
1 0 0 1 0 1
1 1 0 1 1 0

• In 0, 0 Out 0 • In 0, 0 Out 0
• In 0, 1 Out 0 • In 0, 1 Out 1
• In 1, 0 Out 0 • In 1, 0 Out 1
• In 1, 1 Out 1 • In 1, 1 Out 1
BOOLEAN EXPRESSIONS AND FUNCTIONS

Boolean Expressions Boolean Functions


 Boolean expression is composed of a combination • Boolean function is formed up of binary variables,
of the Boolean constants, Boolean variables and logical operators, parenthesis, exponents and an
logical operators. equal to sign.
 Result of Boolean expression is always an ON (1) • Boolean functions are used to calculate values of
or OFF (0). unknowns or proving formulas.
 Each Boolean expression can be used to express a • A complete Boolean function can not be used as a
Boolean function. Boolean expression.
 Boolean expressions are like normal expressions • Boolean functions are like the common functions
where there is no equal to sign ‘=’ involved in the with an equal to sign ‘=‘ as a necessity.
expression. • Examples of Boolean functions are:
 Boolean expressions are of the form:
BOOLEAN FUNCTIONS TO LOGIC CIRCUITS
 Boolean functions can be changed to logical circuits by categorizing the function in to groups of
logical operations:
 Logical AND (*): Logical Multiplication
 Logical OR (+): Logical Addition
 Logical NOT (!): Logical Inversion
 Categorizing and drawing small circuits step-by-step can help us in developing and sketching the
whole Boolean logical circuit.
 For a Boolean function , logical circuit will be drawn as:
EXAMPLES
𝑭 = 𝒙 + 𝒚 𝒛 𝑭 =𝒙 𝒚 𝒛+𝒙 𝒚𝒛 +𝒙 𝒚

You might also like