Professional Documents
Culture Documents
19CSE203
III Semester
B. Tech. CSE
Amrita School of Engineering, Chennai
Encoders
Encoders
w0
y0
2n n
inputs outputs
yn – 1
w2n – 1
Logical Expression-
y 1 = w2 + w 3
y 0 = w1 + w 3
Encoders
8-to-3 binary encoder (octal-to-binary)
A0 = D1 + D3 + D5 + D7
A1 = D2 + D3 + D6 + D7
A2 = D4 + D5 + D6 + D7
Encoders
8-to-3 binary encoder (octal-to-binary)
Encoders
Encoders
Priority Encoder
4-to-2 priority encoder
Priority Encoder
4-to-2 priority encoder
Priority Encoder
4-to-2 priority encoder
Design a 4-to-2 priority with w3,w2,w1 and w0 inputs where w3 is MSB
and w0 is LSB. The LSB input has highest priority.
Truth Table-
Priority Encoder
8-to-3 Priority Encoder
Decoder
• Decoder circuits are used to decode encoded information.
• A binary decoder is a logic circuit with n inputs and 2n outputs.
• Only one output is asserted at a time, and each output corresponds to one valuation
of the inputs.
• The decoder also has an enable input, En, that is used to disable the outputs;
➢ If En = 0, then none of the decoder outputs is asserted.
➢ If En = 1, the valuation of wn−1···w1w0 determines which of the outputs is asserted.
Decoder
• An n-bit binary code in which exactly one of the bits is set to 1 at a time is referred
to as one-hot encoded, meaning that the single bit that is set to 1 is deemed to be
“hot.”
• The outputs of a binary decoder are one-hot encoded.
• A decoder can be designed to have either active-high or active-low outputs.
Decoder
2-to-4 Decoder (Active High Output)-
Decoder
2-to-4 Decoder (Active Low Output)-
Decoder
3-to-8 Decoder-
• Larger decoders can be built using the sum-of-products structure as shown for 2-
to-4 decoder.
Logic Circuit
Code Converter
Binary to Gray code converter
Gray code-
• Gray code- also known as Cyclic Code, Reflected Binary Code (RBC), Reflected Binary (RB) –
is defined as an ordering of the binary number system such that each incremental value can only
differ by one bit.
• In gray code, while traversing from one step to another step only one bit in the code group changes.
That is to say that two adjacent code numbers differ from each other by only one bit.
How to Convert Binary to Gray Code
1. The MSB (Most Significant Bit) of the gray code will be exactly equal to the first bit of the given
binary number.
2. The second bit of the gray code will be exclusive-or (XOR) of the first and second bit of the given
binary number, i.e if both the bits are same the result will be 0 and if they are different the result will
be 1.
3. The third bit of gray code will be equal to the exclusive-or (XOR) of the second and third bit of the
given binary number. Thus the binary to gray code conversion goes on. An example is given below
to illustrate these steps.
Code converter
Binary to Gray code converter
How to Convert Binary to Gray Code
we have a binary number 01001 which we wish to convert to gray code-
Code converter
Binary to Gray code converter
Truth Table
g3 = Ʃm (8,9,10,11,12,13,14,15)
g2 = Ʃm (4,5,6,7,8,9,10,11)
g1 = Ʃm (2,3,4,5,10,11,12,13)
g0 = Ʃm (1,2,5,6,9,10,13,14)
Code converter
Binary to Gray code converter
K-map Simplification
Code converter
Binary to Gray code converter
Logic Circuit-
Code Converter
Gray to Binary code converter
How to Convert Gray Code to Binary-
1.The MSB of the binary number will be equal to the MSB of the given gray code.
2.Now if the second gray bit is 0, then the second binary bit will be the same as the
previous or the first bit. If the gray bit is 1 the second binary bit will alter. If it was 1
it will be 0 and if it was 0 it will be 1.
3.This step is continued for all the bits to do Gray code to binary conversion.
Code Converter
Gray to Binary code converter
Truth Table
b3 = Ʃm (8,9,10,11,12,13,14,15)
b2 = Ʃm (4,5,6,7,8,9,10,11)
b1 = Ʃm (2,3,4,5,8,9,14,15)
b0 = Ʃm (1,2,4,7,8,11,13,14)
Code Converter
Gray to Binary code converter
K-map Simplification
b2 = b3 ⊕ g2
= b2 ⊕ g1
Code Converter
Gray to Binary code converter
K-map Simplification
=
b0 = b 1 ⊕ g0
Code converter
Gray to binary code converter
Logic Circuit-
Code converter
BCD to Excess-3 code converter
BCD code
• Binary Coded Decimal or BCD is simply the 4-bit binary code representation of a
decimal digit with each decimal digit replaced in the integer and fractional parts
with its binary equivalent. BCD Code uses four bits to represent the 10 decimal
digits of 0 to 9.
• To display decimal numbers in the range of 0-to-9, (one digit) we would need 4 data
bits (a nibble), decimal numbers in the range of 0-to-99, (two digits) we would need
8 bits (one byte), decimal numbers in the range of 0-to-999, (three digits) we would
need 12 bits, and so on
Excess-3 code
• Excess-3 codes are unweighted and can be obtained by adding 3 to each BCD digit
then it can be represented by using 4 bit binary number for each digit.
Code converter
BCD and Binary Representation for Decimal numbers-
1. Find the binary and BCD representation for following numbers-
(a) (6)10
Binary = (110)2
BCD = (0110)BCD
(b) (13)10
Binary = (1101)2
BCD = (0001 0011)BCD
(c) (28)10
Binary = (11100)2
BCD = (0010 1000)BCD
Code converter
BCD to Excess-3 code converter
1. Find the Excess-3 code for the BCD representation of 53.
Ans. According to excess-3 code we need to add 3 to both digit in the BCD number
then convert into 4-bit binary number for result of each digit. Therefore,
= 53+33=86 =1000 0110 which is required excess-3 code for given number 53.
w = Ʃm (5,6,7,8,9) + d (10,11,12,13,14,15)
x = Ʃm (1,2,3,4,9) + d (10,11,12,13,14,15)
y = Ʃm (0,3,4,7,8) + d (10,11,12,13,14,15)
z = Ʃm (0,2,4,6,8) + d (10,11,12,13,14,15)
Code converter
BCD to Excess-3 code converter
K-map Simplification-
K-map for w K-map for x K-map for y K-map for z
OR
Code converter
Excess-3 to BCD code converter
Truth Table
A = Ʃm (11,12) + d (0,1,2,13,14,15)
B = Ʃm (7,8,9,10) + d (0,1,2,13,14,15)
C = Ʃm (5,6,9,10) + d (0,1,2,13,14,15)
D = Ʃm (4,6,8,10) + d (0,1,2,13,14,15)
Code converter
Excess-3 to BCD code converter
K-map Simplification
a = Ʃm (0,2,3,5,6,7,8,9) + d(10,11,12,13,14,15)
b = Ʃm (0,1,2,3,4,7,8,9) + d(10,11,12,13,14,15)
c = Ʃm (0,1,3,4,5,6,7,8,9) + d(10,11,12,13,14,15)
d = Ʃm (0,2,3,5,6,8,9) + d(10,11,12,13,14,15)
e = Ʃm (0,2,6,8) + d(10,11,12,13,14,15)
f = Ʃm (0,4,5,6,8,9) + d(10,11,12,13,14,15)
g = Ʃm (2,3,4,5,6,8,9) + d(10,11,12,13,14,15)
Code converter
BCD to 7-segment Display decoder
K-map Simplification-
K-map for a K-map for b K-map for c K-map for d
• Define a set of intermediate signals called i3, i2, i1, and i0. Each signal, ik , is 1 if the
bits of A and B with the same index are equal. That is,
ik = ak ⊕ bk