2 Code Logic Gate 26.8.22
2 Code Logic Gate 26.8.22
2 Code Logic Gate 26.8.22
GATE
• In general we understand or use digital data, but computer system
understand binary.
• So the digital data is represented and stored as group of bits called binary
codes.
CODES • Code is a symbolic representation of discrete information, which may be
present in the form of numbers, letters or physical quantities.
• The symbols used are the binary digits 0 and 1 which are arranged
according to the rules of codes.
• Codes are broadly classified into five groups:
(i) Weighted Binary Codes
(ii) Non-weighted Codes
• Weights are attached to each binary digits. Bits are multiple by
the weights indicates; the sum of these weighted bits given the
equivalent decimal digits.
WEIGHTED • BCD code : represented using 4 bits and follows 8421
BINARY CODES sequence or weights are attached t each binary digits as per
8421 sequence.
5----0101
Decimal number 8421(BCD code) 5421
0 0000 0000
1 0001 0001
2 0010 0010
SOME WEIGHTED 4-BIT
3 0011 0011
BINARY CODES
4 0100 0100
5 0101 1000
69
0110 1001 6 0110 1001
10
1010 7 0111 1010
00010
8 1000 1011
15.45
0001 0101. 0100 0101 9 1001 1100
• Non-weighted codes are codes that are not
positionally weighted.
• 12 10 9
1 0
• 1100 1010 1001 3 3
B---0101
• Conversion of a Gray code into its binary form involves the
G---1011
reverse of the previous procedure:
B-- 1101
(i) The first binary bit (MSB) is the same as that of the first Gray
code bit.
CONVERSION (ii) If the second Gray bit is 0, the second binary bit is the same
FROM GRAY as that of the first binary; if the second Gray bit is 1, the second
CODE TO BINARY binary bit is the inverse of its first binary bit.
(iii) Step 2 is repeated for each successive bit.
1011----1101
EXAMPLES
• Binary to gray
• A. 10110 B. 10101101
• Gray to binary
• 110101
• 1010111
LOGIC GATES
OR Gate
If A and B are the input variables of an OR gate and Y is its output, then
Y = A+B
Input A INPUT B OUTPUT Y
0 0 0
0 1 1
1 0 1
1 1 1
LOGIC GATES
• AND Gate
If A and B are the input variables of an AND gate and Y is its output, then
Y = A⋅B
Input A OUTPUT Y
0 1
1 0
DEMORGAN’S THEOREMS
• The first theorem states that the complement of a product is equal to the sum of the complements. That
is, if the variables are A and B, then
• The second theorem states that, the complement of a sum is equal to the product of the complements.
In equation form, this can be written as
LOGIC GATES
• NAND Gate
NAND is a contraction of the NOT–AND gates. It has two or more inputs and only one output, i.e. Y = (A .B)’
• NOR Gate
NOR is a contraction of NOT–OR gates. It has two or more inputs and only one output, i.e. Y = (A+B)’
• The exclusive-NOR gate, is an Ex-OR gate, followed by an inverter. An exclusive-NOR gate has two
or more inputs and one output. The output of a two-input Ex-NOR gate assumes a HIGH state if both
the inputs assume the same logic state or have an even number of 1s, and its output is LOW when the
inputs assume different logic states or have an odd number of 1s
Input A INPUT B OUTPUT Y
0 0 1
0 1 0
1 0 0
1 1 1