Вы находитесь на странице: 1из 9

In this lecture:

Lecture 3: Basic Logic Gates


• What are the basic logic gates?
& Boolean Expressions
• What is Boolean algebra?
Dr Pete Sedcole • Boolean variables and expressions
Department of E&E Engineering
• Boolean algebra as a way to write down logic
Imperial College London
http://cas.ee.ic.ac.uk/~nps/ • Boolean Operators
• Truth tables
(Floyd 3.1 – 3.6, 4.1)
• Relationships between logic gates & Boolean
(Tocci 3.1 – 3.9)
expressions

E1.2 Digital Electronics 1 3.1 23 October 2008 E1.2 Digital Electronics 1 3.2 23 October 2008

Boolean Algebra Boolean Variables


• Digital electronics manipulate binary
information • A Boolean Variable takes the value of either 0 or 1
• Designing digital electronics is much • In digital electronics:
easier if we can describe their behaviour Boolean 0 and 1 correspond to binary 0 and 1
mathematically
George Boole • In logic, 0 and 1 are sometimes called FALSE and TRUE
– We can write it down
• We use symbols to represent Boolean variables
– The mathematics of logic invented by English
mathematician George Boole is perfect for this – e.g.: A, B, C, X, Y, Z
• Nodes in a circuit are represented by Boolean Variables – typically a single upper-case letter
• Boolean Algebra allows us to specify relationships • There are three basic logic operations:
between Boolean variables – and so can be used to – AND, OR, NOT
design digital circuits
E1.2 Digital Electronics 1 3.3 23 October 2008 E1.2 Digital Electronics 1 3.4 23 October 2008
Boolean Algebra to Describe Logic • What are the Boolean variables?
Three input variables H, R, F and one output S
• Example application: Home Heating System
• H represents the On/Off switch for whole system
• Specification: H = 0 means the system is off, H = 1 the system is on
– set the required temperature using a thermostat
– turn on heating if temperature lower than required • R → room thermostat
– turn off heating if temperature higher than required R = 1 when temperature is lower than required
– turn on heating if heating pipes are in danger of freezing • F → frost sensor
• Implementation: F = 1 when the external temperature is near or below
– use a manual switch to turn on heating system freezing
– use a room thermostat to detect room temperature • S → On/Off switch on the boiler
– use an outdoor frost sensor to warn of freezing S = 1 when heat should be generated by the boiler
– use a digital electronic circuit to turn heating on and off
‘intelligently’
E1.2 Digital Electronics 1 3.5 23 October 2008 E1.2 Digital Electronics 1 3.6 23 October 2008

• S should be 1 when: (H=1 and R=1) or (F=1 and R=1) Boolean Operators
• In Boolean Algebra:
∧ is used for ‘AND’
∨ is used for ‘OR’ • The operator symbols ∧, ∨, ¬ are not available on
¬ is used for ‘NOT’ standard keyboards
• To make things easier to type, in digital electronics we
S = (H ∧ R) ∨ (F ∧ R) use:
Operator Meaning
• If we could build an electronic circuit that implemented A+B A OR B
this Boolean expression we could sell it as a simple A•B A AND B
heating system controller A NOT A

E1.2 Digital Electronics 1 3.7 23 October 2008 E1.2 Digital Electronics 1 3.8 23 October 2008
Boolean Operators Basic Boolean Operators & Logic Gates
• Like ordinary algebra, Boolean algebra allows for
operations on its variables
• NOT operator produces the complement (or inverse) of a • Inverter
variable • AND gate
– e.g.: NOT K, which is written K • OR gate
– if K represents a key on a computer keyboard, and • NAND gate
K = 1 means the key is pressed,
• NOR gate
then K = 0 means the key is not pressed
• If we look at the complement of K, we can still tell the • Exclusive-OR gate
state of the key, but it will have the opposite sense: • Exclusive-NOR gate
K = 1 means the key is not pressed
K = 0 means the key is pressed
E1.2 Digital Electronics 1 3.9 23 October 2008 E1.2 Digital Electronics 1 3.10 23 October 2008

The OR operation and gate


Truth Tables
• Shows the value of the circuit output for all input values
Boolean expression
Truth table
0 = LOW
1 = HIGH

Truth table
Schematic & Boolean
symbol expression

Timing diagram

The output of the gate is HIGH


when ANY of the inputs are HIGH
Timing Diagram

E1.2 Digital Electronics 1 3.11 23 October 2008 E1.2 Digital Electronics 1 3.12 23 October 2008
4-input OR gate Summary of OR operation

• Output value will be


1 whenever any input is 1
0 otherwise
• An OR gate is a logic circuit that performs an OR
operation on the circuit’s inputs
• The Boolean expression x = A + B is read as
“x equals A OR B”

E1.2 Digital Electronics 1 3.13 23 October 2008 E1.2 Digital Electronics 1 3.14 23 October 2008

Example of an OR gate in an alarm system Example 2

E1.2 Digital Electronics 1 3.15 23 October 2008 E1.2 Digital Electronics 1 3.16 23 October 2008
Example 3 Review questions for OR gates
• What is the only set of input conditions that will produce
a LOW output for any OR gate?
All inputs LOW

• Write the Boolean expression for a six-input OR gate


X=A+B+C+D+E+F

• If, for the previous example, the input A is kept


permanently at 1, what will the output X be?
Also constant 1

E1.2 Digital Electronics 1 3.17 23 October 2008 E1.2 Digital Electronics 1 3.18 23 October 2008

The AND operation and gate


Summary of the AND operation
Boolean expression

Truth table
0 = LOW • Output value will be
1 = HIGH
1 whenever all inputs are 1
3-Input AND Gate 0 otherwise
• An AND gate is a logic circuit that performs an AND
operation on the circuit’s inputs
• The Boolean expression x = A • B is read as
Timing Diagram
“x equals A AND B”
The output of the gate is HIGH
when ALL of the inputs are HIGH
E1.2 Digital Electronics 1 3.19 23 October 2008 E1.2 Digital Electronics 1 3.20 23 October 2008
The NOT operation and inverter
Review questions for AND gates
• What is the only input combination that will produce a
HIGH at the output of a five-input AND gate?
All 5 inputs = 1

• True or false: an AND gate will always produce an output


value that differs from an OR gate for the same input
values.
False
Truth table Boolean expression
0 = LOW
Timing Diagram
1 = HIGH
• What logic level should be applied to one input of a two-
input AND gate to prevent the second input from making The output of the gate is the COMPLEMENT or
a difference to the output value? OPPOSITE of the input value
A logic LOW will keep the output LOW
E1.2 Digital Electronics 1 3.21 23 October 2008 E1.2 Digital Electronics 1 3.22 23 October 2008

The NAND gate


Other names for Boolean operators
• Since we use the symbols + and • for Boolean operators
OR and AND, they are often called SUM and PRODUCT
SUM (OR) PRODUCT (AND)
0+0=0 0•0=0
0+1=1 0•1=0
1+0=1 1•0=0
Boolean expression
1+1=1 1•1=1
Truth table
0 = LOW
1 = HIGH

Timing Diagram

• In Boolean algebra these are still Boolean operators, and The output of the gate is LOW
not the same as + and • in ordinary algebra! when ALL of the inputs are HIGH
E1.2 Digital Electronics 1 3.23 23 October 2008 E1.2 Digital Electronics 1 3.24 23 October 2008
The NOR gate
Describing logic circuits algebraically

• Any logic circuit, no matter how complex, can be


completely described using the three basic Boolean
operations: OR, AND, NOT
• An example: a logic circuit with its Boolean expression
Boolean expression

Truth table
0 = LOW
1 = HIGH
Timing Diagram

The output of the gate is LOW


when ANY of the inputs are HIGH
E1.2 Digital Electronics 1 3.25 23 October 2008 E1.2 Digital Electronics 1 3.26 23 October 2008

Precedence Circuits containing inverters


• There are two ways to interpret A • B + C:
– Is it (A AND B) then ORed with C? Or A ANDed with (B OR C)?
• Whenever an INVERTER is present in a logic circuit
• In Boolean algebra it is always AND before OR diagram, its output expression is simply equal to the
Unless we use parentheses (): input expression with a bar over it:

E1.2 Digital Electronics 1 3.27 23 October 2008 E1.2 Digital Electronics 1 3.28 23 October 2008
More examples
Precedence

1. First, perform all inversions of single terms


2. Perform all operations within parentheses
3. Do AND before OR (unless parentheses indicate
otherwise)
4. If an expression has a bar over it (inversion), calculate
the expression first, then invert the result

E1.2 Digital Electronics 1 3.29 23 October 2008 E1.2 Digital Electronics 1 3.30 23 October 2008

Example Determining the output level from a diagram


• What is the value of Z if:
Z = (A•B + C)D
A = 0, B = 1, C = 0, D = 1?

• Z = (0•1 + 0)1
= (1•1 + 0)1
= (1 + 0)1
= 1•1
= 0•1
=0
E1.2 Digital Electronics 1 3.31 23 October 2008 E1.2 Digital Electronics 1 3.32 23 October 2008
Implementing circuits from Boolean expressions
A further example • We can draw a logic circuit diagram directly from a
Boolean expression defining the function of the circuit.

E1.2 Digital Electronics 1 3.33 23 October 2008 E1.2 Digital Electronics 1 3.34 23 October 2008

Example Review question


• Draw the circuit diagram to implement the expression • Draw the diagram of a circuit that implements:
x = (A + B)(B + C) x = ABC(A+D)
using gates having no more than three inputs.

E1.2 Digital Electronics 1 3.35 23 October 2008 E1.2 Digital Electronics 1 3.36 23 October 2008

Вам также может понравиться