﻿ Boolean algebra and logical gates
 Logical gates subjects list ▲
 Boolean algebra laws Boolean algebra calculator Karnaugh 3 & 4 variables tables Logical gates symbols Karnaugh maps Seven Segment Decoder
 Logical gates overview ▲
Logical gates are the basic of the computerized world and is based on the digital values of the binary numbers  0  and  1. The implementation of the logical gates are performed by the rules of the boolean algebra, and based on the combinations of the operations  OR, AND  and  NOT. The specific gate operation is attained by using diodes or transistors that acts like a switch  0  is off  (0 Volt)  and  1  is on  (5 Volt).
Operation Logical OR and AND gates description OR AND
 Logical gates examples 1, 2 and 3 ▲
Num X    Y    Z XY' Output F(X, Y,Z) = XY' + Z 1 0    0    0 0 0 2 0    0    1 0 1 3 0    1    0 0 0 4 0    1    1 0 1 5 1    0    0 1 1 6 1    0    1 1 1 7 1    1    0 0 0 8 1    1    1 0 1
Num A    BOutput
10    01
20    11
31    00
41    10
 Output
 From the output result we can see that the system can be simplified to the equivalent form.
Num A     B Output F(A, B) = A XOR B 1 0     0 0 2 0     1 1 3 1     0 1 4 1     1 0
 Output
 This system is the equivalent of the XOR gate.
 Seven Segment Decoder ▲
 Segment:
 A seven segment display is an electronic device for displaying decimal numbers. widely used for electronic clocks and counters. The display is designed by using logical gates. Each segment of the number can be calculated by using the Karnaugh method (see above).
 Logical gates example 4 ▲
The truth table at points  D, E, F, G, H and K  of the system described above are.

ABCDEFGHK
000000000
000100100
001000000
001100100
010001100
010100100
011001100
011100100
100000000
100100111
101000000
101100111
110011111
110110111
111001111
111100111
 Port Value Notes E F G D + F H A‧G K E + H
 Logical gates example 5 ▲
The truth table at points  D, E, F, G, H, I, J, and K  of the system described above are.

ABCDEFGHIJK
00011100110
00111010100
01010110100
01110010100
10001110100
10101010100
11000110100
11100011011
 Port Value Notes D NOT Buffer E NOT Buffer F NOT Buffer G De Morgan's theorem H I J K
 Logical gates example 6 ▲
The truth table at points  C, D, E, F and G  of the system described above are.

ABCDEFG
0001000
0101101
1001101
1111000
Port Value
C
D
E
F         (D equals 1 see above)
G
 Logical gates example 7 ▲
The truth table at points  D, E, F, G, H and K  of the system described above are.

ABCDEFGHK
000000000
001000111
010110011
011111101
100100010
101100000
110000000
111001011
 Port Value Notes D E F G H K
 Logical gates example 8 - 4 bit comparator ▲
 If the 4 bits at the upper left side are the same as the 4 bits at the lower left side then the output is 1 (green) else the output is 0 (red).
 Logical gates 4 bits left shift example 9 ▲
 Left shift is performed by moving all the bits one place to the left and filling  0  in the last place, most left bit is lost or moved to the next higher level. For example the byte   10011001   after left shift will be:   00110010 If we remember the most left bit, the left shift operation is equivalent to multiplying the number by  2. For example the byte  00001110  equals  14 decimal, after left shift we get  00011100  which is equal to 28.
 Draw logical gate circuit from boolean expression example 11 ▲
 If we have a logical expression such as we can draw the equivalent logical gate circuit by the following steps:
1 Divide the expression into 2 expressions seperated by the OR (+) operator marked by X and Y.
 this is equivalent to the gate:
2
The X expression can be divided into AND gate after simplifying:
 this expression is the gate:
3
Perform the same process on the  Y  expression to get an  AND  of  2  expressions:
 this expression is the gate:
4
Combine the gates of section 1, 2 and 3 to get the final scheme of the complete gate:
The full adder adds the values of two bits  A  and  B,  if both bits are equal to 1 then it passed through the value of the carry to the next calculation level. For the first loop (rightmost bit) the input carry equals to 0. In order to add two bytes we can add 8 full adders (see next example).
The truth table for full adder is:

Carry-inABDEFSumCarry-out
00000000
00110010
01010010
01100101
10000010
10111001
11011001
11100111
 For example 2 bits A and B
 Port Value D A'·B + A·B' E C·D = C·(A'·B + A·B') = C·A'·B + C·A·B' F A·B Sum Carry-out
 4 bits adder example 13 ▲
 0 0 0
The 4 bits adder adds the values of two 4 bits values and gives the result at right, notice that the result contains additional carry that can be used for the next higher calculations. This process can be easily extended to more bits.

Example - Add the  4  bits binary number  1011 (decimal 11)  to the binary number  0110 (decimal 6)..
 Notice that in binary addition         0 + 0 = 0         0 + 1 = 1         1 + 1 = 0     and carry 1.