digital circuits - staff.city.ac.uk
TRANSCRIPT
11. Digital Electronics 1
DIGITAL CIRCUITS
• In analogue circuits, signals are represented by levels
of voltage, current or charge which vary continuously
with time
• In digital circuits signals are not measured on a
continuous scale, but are classified as HIGH or LOW
levels to represent only two possible binary values 0
and 1
• Digital circuits are cheap to make, and complex
systems can be made to operate accurately with low
power consumption
• Logic 0 is represented by 0V or low voltage level
• Logic 1 is represented by a higher voltage level
• Most common devices based on TTL standard
• TTL Transistor-Transistor Logic – logic 0
represented by voltage levels 0v to 0,8V (LOW), logic 1
by between 2V and 5V (HIGH)
• So exact values not required for switching between
levels
• Voltages outside ranges are not HIGH or LOW
• Two logic level system leads to the use of binary numbering system
11. Digital Electronics 2
BINARY NUMBERS
• For computers, binary numbers are suitable because:
• They are simple to work with (very fast),
• Use if just two values of voltage, magnetism, or other
signal allows for easy hardware design.
• Most modern computers operate using binary logic
• With only two levels, we can represent exactly two
values
• Values used by convention are 1 and 0
• These two numbers correspond to the only two digits
used in the binary number system
• Computers operate on the principles of the binary
number system
• Binary numbers and arithmetic let you represent any
amount you want using just two digits: 0 and 1
11. Digital Electronics 3
BINARY NUMBERS
REPRESENTATION
• Each digit 1 in a binary number represents a power of
two, in which the power of the digit is the position of the
digit from the right minus 1 – it is a weighted value
• Each 0 represents a zero
• The weighted values for each position is determined as
follows:
01004
00113
00102
00011
BinaryDecimal
1248163264128
2021222324252627
11. Digital Electronics 4
CONVERTING FROM BINARY TO
DECIMAL
• Quite easy and straightforward to convert from a binary
number to a decimal number
• Multiply each digit by its weighted position, then add
each of the weighted values together
• 11001010 represents:
• (1×27)+(1×26)+(0×25)+(0×24)+(1×23)+(0×22)+(1×21)+(0×
20) = 202
• 10011001 = ?
• 11111111 = ?
• 10110110 = ?
11. Digital Electronics 5
CONVERTING FROM DECIMAL TO
BINARY
• Divide the decimal number by 2
• If remainder is 0, write down a 0
• If remainder is 1, write down a 1
• Process is continued by dividing quotient by 2 until the
quotient is zero
• Each remainder representing the binary equivalent is
written from right to left
• Example Convert the decimal number 100 into binary
100100113/2
1100100101/2
00100036/2
01000612/2
10011225/2
0002550/2
0050100/2
Binary
Number
RemainderQuotientDivision
11. Digital Electronics 6
BINARY ADDITION
• Adding two binary numbers together is like adding
decimals, except 1 + 1 = 10 (in binary!), so you have to
carry the 1 to the next column
• 0001 + 0100 = 0101
• 0001 + 0001 = 0010 (1+1 is 10 – carry 1 to next
column)
• 0011 + 0011 = 0110 (1+1 is 10, carry, then 1+1+1 =
11, so carry again)
• 0011 + 0101 = 1000 (carry in every column here)
11. Digital Electronics 7
BINARY NUMBER FORMATS
• Binary numbers are written as a sequence of bits
(binary digits)
• The bigger the number, the more bits needed to
represent it
• The smallest unit of data on a binary computer is a
single bit. Represents true or false (1 or 0)
• A nibble is a collection of 4 bits, and are numbered
from bit 0 (b0) up to three (b3), such that: b3 b2 b1 b0
• The byte is the most important data structure used in
computers
• A byte consists of 8 bits, numbered from bit zero (b0)
up to seven (b7): b7 b6 b5 b4 b3 b2 b1 b0
• b0 is the least significant bit or LSB
• b7 is the most significant bit or MSB
• Byte has 256 different states (28), and represents
decimal values from 0 to 255
• A word is 16 bits: b15 b14 b13 b12 b11 b10 b9 b8 b7
b6 b5 b4 b3 b2 b1 b0
• A word contains 2 bytes: b0 to b7 is the low order byte,
b8 to b15 forms high order bye
• With 16 bits, a word can have 216 = 65,536 values
• 1 kilobyte (1Kb) = 1024 bytes = 210
• 1 megabyte (1Mb) = 1048576 bytes = 220
• A 40 gigabyte (40Gb) hard disk can hold about 40
billion characters
11. Digital Electronics 8
BASIC LOGICAL FUNCTIONS AND
GATES
• There are three fundamental logical operations when
dealing with logical (digital) circuits
• AND, OR and NOT – each has own symbol and clearly
defined behaviour
• The term gate is used to describe the members of a set
of basic electronic components which, when combined
with each other, are able to perform complex logical
and arithmetical operations
• Boolean algebra is the mathematics associated with
binary numbers and logical operations
• Gates are the physical realisation of the simple Boolean
expressions
• A detailed understanding of the electronics within logic
gates is beyond the scope of this course
• Note that logic gates can be designed with a few
electronic components
• There are 5 types of fundamental gates used
• OR, AND, NOT, NAND, NOR, and XOR gates are used
extensively in digital electronics circuits
11. Digital Electronics 9
THE NOT GATE
• Also known as an inverter – always has one input and
one output
• Whatever logical state is applied to the input, the
opposite state will appear at the output
• If the warning light is red = you cannot enter
• If the warning light does not show red = you can enter
• Boolean expression: B = A’ = /A
• A truth table is a table that shows the value of the
output for all possible combinations of outputs
• A NOT gate has only 1 input, so there are 21 = 2 inputs
combinations
• Inputs are in the form of voltages
(1=HIGH=TRUE=+5V) and (0=LOW=FALSE=0V)
• Truth Table for NOT gate:
01
10
B (NOT A, A’)A
11. Digital Electronics 10
THE AND GATE
• AND gate produces a logic 1 output whenever both (or
all) its inputs are also at logic 1 (HIGH, TRUE)
• Verbally: If the switch is ON AND the power lead is
plugged in, the lamp lights up. Both cases have to be
true for the lamp to light up.
• Boolean expression: Z = X.Y
• AND gate can have any number of inputs, but for
practical uses, it is common to use two
• For n inputs, there are a possible 2n combinations, so 2
inputs has 4 combinations, 3 has 8 etc.
• Truth table for a 2-input AND gate:
111
001
010
000
Z = X.YYX
11. Digital Electronics 11
THE OR GATE
• OR gate produces logic 1 (HIGH, TRUE) output
whenever one or more of its inputs are at logic 1 (TRUE
states)
• Verbally: If there is enough light OR the light is on, I can
see
• OR function designated with plus (+) sign
• Boolean expression: Z = X+Y
• OR function and gate can have any number of inputs,
but we will limit our study to two inputs
• Truth table for OR gate:
111
101
110
000
Z = X+YYX
11. Digital Electronics 12
THE NAND GATE
• NAND gate consists of an AND function followed by a
NOT function
• It is an exact inversion of AND function
• Both inputs must have a logic 1 signals applied to them
in order for the output to be a logic 0
• With either (or all) input(s) at logic 0, the output will be a
logic 1
• Boolean expression: Z = (X.Y)’
• Truth Table for NAND gate:
011
101
110
100
Z = (X.Y)’YX
11. Digital Electronics 13
THE NOR GATE
• An OR gate allows the output to be TRUE (logic 1) if
any one or more of its inputs are true
• The NOR gate inverts this and forces the output to logic
1 when any input is HIGH (TRUE, logic 1)
• The output is 1 only when both inputs are 0
• Boolean expression: Z = (X+Y)’
• Truth table for NOR gate:
011
001
010
100
Z = (X+Y)’YX
11. Digital Electronics 14
THE XOR GATE
• The XOR or Exclusive OR function is a variation of the
OR function
• Verbally: If either X or Y are logic 1, but not both, then Z
is a logic 1
• The XOR gate produces a logic 1 output if its two inputs
are different
• If the inputs are the same, the output is a logic 0
• Boolean expression: Z = X ⊕ Y
• Truth table for XOR gate:
011
101
110
000
Z = X ⊕⊕⊕⊕ YYX
11. Digital Electronics 15
GATES AND INTEGRATED
CIRCUITS
• With the exception
of the NOT gate,
all other gates can
have any number
of inputs
• For practical,
commercial
reasons, gates are
manufactured with
2, 3 or 4 inputs
• A standard
Integrated Circuit
(IC) package
contains 14 or 16
pins
• A 14 pin package
can contain four 2-
input gates, three
3-input gates or
two 4-input gates,
and still have
room for two pins
for power supply
connections
11. Digital Electronics 16
BOOLEAN ALGEBRA
• Logic gates described previously can be used in
various combinations to perform tasks of any level of
complexity
• A primary requirement with digital circuits is to find
ways to make them as simple as possible
• This requires that complex logical expressions need to
be reduced to simpler expressions, yet still produce the
same results
• Simpler expression can then be implemented using a
simpler circuit – which saves on power consumption,
space, and cost
• One tool to reduce logical expressions is the
mathematics of logical expressions, introduced by
George Boole in 1854 – Boolean Algebra
• Rules of Boolean Algebra are simple and straight
forward, and can be applied to any logical expression
• Resulting reduced expression can then be readily
tested with a truth table for validation
11. Digital Electronics 17
RULES OF BOOLEAN ALGEBRA
• AND operations (.)
0.0 = 0 A.0 = 0
1.0 = 0 A.1 = A
0.1 = 0 A.A = A
1.1 = 1 A.A’ = 0
• OR operations (+)
0+0 = 0 A+0 = A
1+0 = 1 A+1 = 1
0+1 = 1 A+A = A
1+1 = 1 A+A’ = 1
• NOT operations (‘)
0’ = 1 A’’ = A
1’ = 0
• Associative Law
(A.B).C = A.(B.C) = A.B.C
(A+B)+C = A+(B+C) = A+B+C
• Distributive Law
A.(B+C) = (A.B) + (A.C)
A+(B.C) = (A+B).(A+C)
• Commutative Law
A.B = B.A
A+B = B+A
• Precedence
AB = A.B
A.B+C = (A.B) + C
A+B.C = A + (B.C)
• DeMorgan’s Theorem
NAND:
(A.B)’ = A’ + B’
NOR:
(A+B)’ = A’.B’
11. Digital Electronics 18
TRUTH TABLES
• Truth table shows relationship between inputs and
outputs of a logic circuit
• Each possible combination of input conditions is
considered
• A complete list of all the possible combinations of the
inputs with their corresponding output is summarised in
the truth table
• For the lamp to be
on (1), A must be on
(1) and either B or C
LAMP = (A.C)+(A.B)+(A.B.C)
• Example: Construct a truth table for a logic circuit that
will produce a logic 1 output when two or more of its
three inputs are at logic 1. Hence derive the circuit’s
Boolean equation.
A
B
C
1111
1011
1101
0001
0110
0010
0100
0000
LAMPCBA
11. Digital Electronics 19
READING AND CONSTRUCTION OF
LOGIC GATES
• A Boolean function is an expression formed with binary
variables made up of 0’s and 1’s
• It may be represented as an algebraic expression or in
a truth table
• Operators used: AND, OR, NOT, NAND, NOR, XOR
• For n inputs, there are 2n possible combinations
• Consider the following logic function, with two inputs
(hence 22=4 possible input combinations)
• Q = (A’.B)+(A.B’)
• Construct the corresponding truth table
• The required circuit is shown below
11. Digital Electronics 20
UNIVERSAL GATES
• Combinational logic circuits are more frequently
constructed with a NAND or NOR gates
• NAND and NOR gates are more common from a
hardware point of view
• They are readily available in IC form
• The NAND gate is said to be the universal gate
because any digital system can be implemented with it
• A.B = ((A.B)’)’ – AND gate using NAND gates alone
• A+B = (A’.B’)’ – OR gate using NAND gates alone
• Corresponding logic circuits:
A
B
(A.B)
’AB
A
B
A’
B’
(A’B’)’ = A+B
11. Digital Electronics 21
BOOLEAN SIMPLIFICATION
• Complex digital circuits that implement a Boolean
function is directly related to the complexity of the
algebraic expression from which the function is derived
• It is thus useful t simplify Boolean expressions, which
can be done in two ways
• Algebraically, or by using Karnaugh maps
• Example Using algebraic simplification, simplify the
following:
• Q = (A.B.C)+A.(B’+C’)
• Q = A(B.C+B’+C’)
• Q = A(B.C+(B.C)’)
• Q = A(1) = A
• Example Simplify Q = A’.C.D+A’.B.D+A.C.D+A.B.D
• Q = A’.D(C+B)+A.D(C+D)
• Q = D(C+B)(A’+A)
• Q = D(C+B)(1) = D(C+B)
11. Digital Electronics 22
LOGIC DIAGRAM
• Logic diagram of Q = A’.C.D+A’.B.D+A.C.D+A.B.D and
its simplified version Q = D(C+B)
A
Q
D C B
11. Digital Electronics 23
KARNAUGH MAPS
• Karnaugh Maps (K-map) provides a simple procedure
for minimising Boolean functions
• It is a diagram made of squares
• Each square represents one miniterm of the expression
• By recognising various patterns, a simplified algebraic
expression can be derived for the same function
• The construction of the K-map is such that it consists of
2n where n is the number of variables in the logic
expression
• 0’s and 1’s marked in each square designate the
possible values of the input variables
• Example Q = A.B and Q = A+B can be put into a K-
map as shown:
B
A 0
0
1
1
0 0
0 1
B
A 0
0
1
1
0 1
1 1
Q = A.B Q = A+B
11. Digital Electronics 24
KARNAUGH MAP EXAMPLES
• Q = A’BC + BCD’
• Expression has 4 variables, thus K-map will have 24 =
16 squares (as there are 16 possible input
combinations)
• Although there are 4 1’s in the map, denoting the
expression: A’B