Lecture 9: Encoders and Decoders Dr. Shama Noreen
Lecture 9: Encoders and Decoders Dr. Shama Noreen
§ Circuit behavior must be specified by a time sequence of inputs and internal states.
§ Repeating a sequence of value may result in entirely different output values.
§ Second step: obtain the output Boolean functions or the truth table
Step 2.3:
§ Obtain the output Boolean function in term of input variables.
§ By repeated substitution of previously defined functions.
§ Determine the function that the circuit implements from a logic diagram.
§ Circuit’s function can be determined by either Boolean function or truth table.
ANALYSIS
§ Formulation: Derivation of the truth table or the Boolean equations that define
the relationship between inputs and outputs
§ Optimization: Algebraic or K-map optimization of the truth table and draw the
corresponding logic diagram
§ Obtain and simplify the Boolean function (K-maps, algebraic manipulation, CAD tools, …).
Consider any design constraints (area, delay, power, available libraries, etc).
§ Draw the logic diagram.
§ Technology Mapping: Tranform the logic diagram to a new diagram using the
available implementation technology
§ Outputs:
§ Ex-3 (4 bits).
§ 4 outputs.
§ Symbols: w, x, y, z
BCD-TO-EXCESS-3 CODE CONVERTER - SPECİFİCAİTON
§ The excess-3 code for a decimal digit is the binary combination corresponding
to the decimal digit plus 3. For example, the excess-3 code for decimal digit 5
is the binary combination for 5 + 3 = 8, which is 1000.
§ Each BCD digit is four bits with the bits, from most significant to least
significant, labeled A, B, C, D. Each excess-3 digit is four bits, with the bits, from
most significant to least significant, labeled W, X,Y, Z.
A W
BCD B BCD-to X Excess-3
digit C Excess-3 Y digit
D Z
28
BCD-TO-EXCESS-3 CODE
CONVERTER - FORMULATİON
§ Excess-3 code is easily formed by adding a binary 3 to the binary or BCD for the
digit.
§ There are 16 possible inputs for both BCD and Excess-3.
§ It can be assumed that only valid BCD inputs will appear so the six combinations
not used can be treated as don’t cares.
BCD-TO-EXCESS-3 CODE CONVERTER - FORMULATİON
30
BCD-TO-EXCESS-3 CODE CONVERTER - OPTİMİZATİON
31
BCD-TO-EXCESS-3 CODE CONVERTER - OPTİMİZATİON
32
§ Have equations
§ W = A + BC + BD = A + B(C+D)
§ X = B’C + B’D + BC’D’ = B’(C+D) + BC’D’
§ Y = CD + C’D’
§ Z = D’
§ Factoring out (C+D) and call it T
§ Then T’ = (C+D)’ = C’D’
§ W = A + BT
§ X = B’T + BT’
§ Y = CD + T’
§ Z = D’
33
§ Implementing the second set of
equations where T=C+D results in a
lower gate count.
34
EXAMPLE 3: BCD-TO-SEVEN-SEGMENT DECODER -
SPECİFİCATİON
Digital readouts found in many consumer electronic products often use
Light Emitting Diodes (LEDs). Each digit of the readout is formed from
seven LED segments. Each segment can be illuminated by a digital
signal. A BCD-to-seven-segment decoder is a combinational circuit that
accepts a decimal digit in BCD and generates the appropriate outputs for
the segments of the displayfor the decimal digit. The seven outputs of the
decoder (a,b,c,d,e,f,g)select the corresponding segments in the display.
BCD-to-seven-segment decoder has four inputs, A, B, C, and D for the
BCD digit and seven outputs,a through g, for controlling the segments.
35
BCD-TO-SEVEN-SEGMENT DECODER - FORMULATİON
36
BCD-TO-SEVEN-SEGMENT DECODER - OPTİMİZATİON
37
BINARY ADDER-SUBTRACTOR
§ A combinational circuit that performs the addition of two bits is
called a half adder.
§ The truth table for the half adder is listed below:
S: Sum
C: Carry
S = x’y + xy’
C = xy
38
IMPLEMENTATION OF HALF-ADDER
39
FULL-ADDER
§ One that performs the addition of three bits(two significant bits and a previous
carry) is a full adder.
40
SIMPLIFIED EXPRESSIONS
42
ANOTHER IMPLEMENTATION
§ Full-adder can also implemented with two half adders and one OR
gate.
S = z ⊕ (x ⊕ y)
= z’(xy’ + x’y) + z(xy’ + x’y)’
= xy’z’ + x’yz’ + xyz + x’y’z
C = z(xy’ + x’y) + xy = xy’z + x’yz + xy
43
BINARY ADDER
§ This is also called Ripple
Carry Adder ,because of
the construction with full
adders are connected in
cascade.
44
CARRY PROPAGATION
§ Fig.4-9 causes a unstable factor on carry bit, and produces a
longest propagation delay.
45
CARRY PROPAGATION
§ Because the propagation delay will affect the output signals on
different time, so the signals are given enough time to get the
precise and stable outputs.
46
BOOLEAN FUNCTIONS
Pi = Ai ⊕ Bi
Gi = AiBi
Output sum and carry
Si = P i ⊕ C i
Ci+1 = Gi + PiCi
Gi : carry generate Pi : carry propagate
C0 = input carry
C1 = G0 + P0C0
C2 = G1 + P1C1 = G1 + P1G0 + P1P0C0
C3 = G2 + P2C2 = G2 + P2G1 + P2P1G0 + P2P1P0C0
48
4-BIT ADDER WITH CARRY LOOKAHEAD
Delay time of n-bit CLAA = XOR + (AND + OR) + XOR
49
BINARY SUBTRACTOR
M = 1àsubtractor ; M = 0àadder
50
§ Itis worth noting Fig.4-13 that binary numbers in the
signed-complement system are added and subtracted by
the same basic addition and subtraction rules as unsigned
numbers.
51
§ When two unsigned numbers are added, an overflow is
detected from the end carry out of the MSB position.
53
§ Fundamental circuits that are the base building blocks of most larger digital
circuits
§ They are reusable and are common to many systems.
§ Decoders
§ are used for selecting things like a bank of memory and then the address within the bank.
This is also the function needed to ‘decode’ the instruction to determine the operation to
perform.
§ Encoders
§ are used in various components such as keyboards
§ When the binary sum isgreater than 1001, we obtain a non-
valid BCD representation.
C = K + Z8Z4 + Z8Z2
56
§ A decimal parallel
adder that adds n
decimal digits needs
n BCD adder stages.
§ The outputcarry
from one stage must
If =1
be connected to the
input carry of the
0110
next higher-order
stage.
57
BINARY MULTIPLIER
§ Usually there are more bits in the partial products and it is necessary
to use full adders to produce the sum of the partial products.
And
58
§ For J multiplier bits
and K
multiplicand bits we need (J X K) AND
gates and (J − 1) K-bit adders to
produce a product of J+K bits.
59