You are on page 1of 9

LOGIC GATES

Why data is represented in binary form


A computer is basically a collection of transistors and circuits. These components have two states:
on - a current is flowing through the component
off - a current is not flowing through the component
These two states can easily be represented by using binary:
1 = on (TRUE)
0 = off (FALSE)
State
State refers to the output of a circuit. If a circuit has one input and one output, and the input and output each have two states -
on and off - this gives two combinations of state:
input off, output off
input on, output on
More complex circuits have many inputs, and the output state depends on the various combinations of the inputs and the logic
gates they pass into.
Logic Gates
In its most basic form, a computer is a collection of powered and unpowered circuits and transistors.
A logic gate is a series of transistors connected together to give one or more outputs, each output being based on the input or
combination of inputs supplied to it. There are three types of gate to consider:
• AND gate
• OR gate
• NOT gate
Each type of gate can be represented either as a diagram, in algebraic form, or as a truth table.
Truth tables are used to trace the output from a logic gate or logic circuit.

A B C Boolean algebra
Boolean algebra is a notation used to represent logic. For example
(Q=output ) (A and B =inputs)
Q = A AND B(AND)
Q = A OR B(OR)
Q = NOT A(NOT)
This notation can also be represented using symbols:
Q = A /\ B, or as A.B(AND)
Q = A \/ B, or as A+B(OR)
Truth Table Q = ¬ A(NOT)
AND gates
An AND gate, also called a conjunction, uses two inputs to generate one output.
>>The output is 1 (TRUE) only if both of the inputs are 1 (TRUE).
AND gates are represented diagrammatically as:

Two separate AND gates representing a TRUE and a FALSE output


>>A represents the first input. B represents the second input. Q represents the output. A truth table shows, for each
combination of inputs, what the output will be.
An AND gate is represented in a truth table as seen below.
(multiply the input to give output)
A B Q
This AND gate is represented in Boolean algebra as one of:
0 0 0
Q=(A AND B)
0 1 0
1 0 0 Q=(A /\ B)
1 1 1 Q=(A.B)
OR gates
An OR gate, also called a disjunction, uses two inputs to generate one output. The output is 1 (TRUE) only if either or
both of the inputs are 1 (TRUE).

OR gates are represented diagrammatically as

Two separate OR gates representing TRUE outputs


A represents the first input. B represents the second input. Q represents the output.

A truth table shows, for each combination of inputs, what the output will be. An OR gate is represented in a truth
table as seen below.
A B C This OR gate is represented in Boolean algebra as
0 0 0 one of:
0 1 1 C=(A OR B)
1 0 1 C=(A \/ B)
1 1 1 C=(A+B)
NOT gates
A NOT gate, also called the negation, uses one input to generate one output. A NOT gate inverts the input - the output is 1
(TRUE) if the input is 0 (FALSE), and the output is 0 (FALSE) if the input is 1 (TRUE).
NOT gates are represented diagrammatically as

Two separate NOT gates representing a TRUE and a FALSE output


A truth table shows, for each combination of inputs, what the output will be.
A NOT gate is represented in a truth table as seen below.

A Q
This NOT gate is represented in Boolean algebra as one of:

•NOT A
1 0
•¬ A

0 1 •~A

•Ā
Excercise
Logic Circuit
• Logic gates can be combined to form more complex inputs and outputs. These combinations are known as logic circuits.
AND, OR and NOT gates can be used in any combination to generate the desired output.
Combining two AND gates

A B C D=(A AND B) Q=(D AND C)

0 0 1 0 0
1 0 0 0 0
0 1 1 0 0
• Here, the output Q is 1 (TRUE) only if inputs C and D are 1 0 0 0 0 0
(TRUE).
1 1 0 1 0
• D is only 1 (TRUE) if inputs A and B are 1 (TRUE).
1 0 1 0 0
In Boolean algebra, this circuit is represented as one of: 1 1 1 1 1
Q = (A AND B) AND C
Q = (A/\B) /\ C
Q = (A.B).C
AND and NOT Gate
In this example, we could connect a NOT gate to the output of an AND gate.
The output for this can be worked out in stages. It is useful to think about the output of each gate in turn and we can
even add this to our truth table. Here,C is the output from the first part of the logic diagram and B is the final
output.

A B C= (A AND B) B=( NOT C )


1 1 1 0
0 1 0 1
1 0 0 1
0 0 0 1

Another way of describing this system is:


B = NOT (A AND B)

You might also like