0% found this document useful (0 votes)
30 views

Logicgates

Logic gates are the basic building blocks of computers that take binary inputs (0 or 1) and output either 1 or 0 depending on the gate's function. The main logic gates are NOT, AND, OR, and XOR. NOT inverts its input, AND outputs 1 only if both inputs are 1, OR outputs 1 if either input is 1, and XOR outputs 1 only if exactly one input is 1. Logic gates can be combined in circuits by connecting the output of one gate to the input of another.

Uploaded by

jade precious
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Logicgates

Logic gates are the basic building blocks of computers that take binary inputs (0 or 1) and output either 1 or 0 depending on the gate's function. The main logic gates are NOT, AND, OR, and XOR. NOT inverts its input, AND outputs 1 only if both inputs are 1, OR outputs 1 if either input is 1, and XOR outputs 1 only if exactly one input is 1. Logic gates can be combined in circuits by connecting the output of one gate to the input of another.

Uploaded by

jade precious
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

L o gic G a te s

What are logic ga te s ?


• In the binary lesson, we discussed the switches inside a
computer
• Logic gates are the switches that turn O N or O F F
depending on what the user is doing!
• They are the building blocks for how computers
work.
What are logic ga te s ?
• Logic gates turn O N when a
certain condition is true, and
O F F when the condition is false
– They c h ec k whether or not the
information they g e t follows a
certain rule
• They either spit out the answer
true (ON) or false ( OFF)
• Rem em b er:
– Tr u e = O N = 1
– Fal se = O F F = 0
Let’s do an example!
• Let’s say a certain logic
gate needs to determine if
5
two numbers are equal ON Logic
(they are

• The rule would b e “is


equal)
Gate
5
equal”
• If the two input numbers
are equal, it will g o into its
O N position, indicating true 5
OFF Logic
• If they are not equal, it will (they are Gate
g o into its O F F position,
not equal) 6
indicating false
Let’s do an example!
• But we learned before that
computers only think of things 1
in terms of O N and O F F, which (ON)
to them is 1 and 0 1 Logic
• S o a computer wouldn’t take
(ON) Gate 1
(ON)
an input of 5 or 6 – all of the
information need to be 0s and
1s
• Reminder: Input refers to the 1
information you give the logic (ON)

gate , and output refers to what 0 Logic


it spits out! (OFF) Gate 0
(OFF)
• Let’s try this example again,
keeping this rule in mind!
Types of Lo g ic G a t e s !
• M a jo r logic ga tes : N O T, A N D ,
O R , and X O R
• There are also other ones,
s uch as N A N D , N O R , and
X N O R that we’re not g o ing to
cover.
• This is called Boolean logic
• In a circuit schematic e a c h
logic ga te is represented by a
different picture, like th e
ones shown below.
NOT
• N O T is the most simple logic g a te .
• All it does is take in a n input that is either O N or O F F and
spits out the opposite.
• S o for a 1 it will give a 0, and for a 0 it will give a 1.
• Another n a m e for a N O T ga te is inverter, bec a us e it inverts
(makes opposite) the input
AND
• Unlike N O T, A N D needs two inputs
• It only turns on when both inputs are O N
• If only one input is on, it spits out O F F
• If both inputs are off, it spits out O F F
A N D Truth Table
• A convenient way to visualize the outputs for the logic ga te s
is through a truth table
• The truth table depicts the ga te ’s response to e a c h possible
set of inputs
Input 1
0 1
0 0 0
Input 2
1 0 1

Output
OR
• O R also needs two inputs
• O R needs one input to be O N for it to spit out O N
• It is also O N when both inputs are O N
• It is O F F when both inputs are O F F
O R Truth Table
Input 1
0 1
0 0 1
Input 2
1 1 1

Output
XOR
• X O R is the short way to say “Exclusive O R ”
• Like O R , X O R also only need s one input to be O N for it to
spit out O N
• But unlike O R , when both inputs are O N , X O R spits
out O F F
• It is also O F F when both inputs are O F F
X O R Truth Table
Input 1
0 1
0 0 1
Input 2
1 1 0

Output
S t a c k i n g Lo g ic G a t e s !
• An output of one logic gate c an be an input to
another logic gate.
• This creates trees of gates that depend on ea c h
other.
Let’s D o an E xa m p l e !

1 1
0
Example 2!

1
AND
1 0
0
Example 3!
1
AND 1
1

1 1 0

0
Log ic gates actually look like weird
b u g s in real life!

H owever, the diagrams we use are


easier to understand

You might also like