Logic Gates
Logic Gates
Logic Gates
Logic gates are the basic building blocks of any digital system.
It is an electronic circuit having one or more than one input and only one output.
The relationship between the input and the output is based on a certain logic.
There are three types logic gates :
Logic Gates
NOT gate
Unit - 02 Computer arithmetic operations Lecture-01
AND Gate
A circuit which performs an AND operation is called AND Gate.
It has n input (n >= 2) and one output.
Logic diagram
Truth Table
Logic expression
Y = A AND B
= A.B
= AB
Unit - 02 Computer arithmetic operations Lecture-01
OR Gate
A circuit which performs OR operation is called OR Gate.
It has n input (n >= 2) and one output.
Logic diagram
Truth Table
Logic expression
Y = A OR B
=A+B
Unit - 02 Computer arithmetic operations Lecture-01
NOT Gate
NOT gate is also known as Inverter.
It has one input A and one output Y.
Logic diagram
Truth Table
Logic expression
Y = NOT A
= A
Unit - 02 Computer arithmetic operations Lecture-02
NAND Gate
A AND-NOT operation is known as NAND operation.
It has n input (n >= 2) and one output.
Logic expression
Y = AB
Unit - 02 Computer arithmetic operations Lecture-02
NOR Gate
A OR-NOT operation is known as NOR operation.
It has n input (n >= 2) and one output.
Logic diagram
Truth Table
Logic expression
Y= A+B
Unit - 02 Computer arithmetic operations Lecture-03
X-OR Gate
XOR gate is a special type of gate.
It can be used in the half adder, full adder and subtractor.
The exclusive-OR gate is also known as EX-OR gate or sometime as X-OR gate.
It has n input (n >= 2) and one output.
Truth Table
Logic diagram
Logic expression
Y = A XOR B
= A⊕B
= AB + BA
Unit - 02 Computer arithmetic operations Lecture-03
X-NOR Gate
XNOR gate is a special type of gate.
It can be used in the half adder, full adder and subtractor.
The exclusive-NOR gate is also known as EX-NOR gate or sometime as X-NOR gate.
It has n input (n >= 2) and one output.
Truth Table
Logic diagram
Logic expression
Y = A XNOR B
= A⊙B
= A.B + AB
Unit - 02 Computer arithmetic operations Lecture-04
Boolean algebra :
Boolean Algebra is used to analyze and simplify the digital logic circuits.
It uses only the binary numbers i.e. 0 and 1.
It is also called as logical Algebra.
Boolean algebra was invented by George Boole in 1854.
Boolean Laws
There are six types of Boolean Laws.
1) Commutative law
2) Associative law
3) Distributive law
4) AND law
5) OR law
6) Inversion law
Unit - 02 Computer arithmetic operations Lecture-04
Commutative law
Commutative law states that changing the sequence of the variables does not have any effect on the
output of a logic circuit.
Associative law
This law states that the order in which the logic operations are performed is
irrelevant as their effect is the same.
(A.B).C = A(B.C) (A + B) + C = A + (B + C)
Distributive law
A .(B + C) = A.B + A.C)
Unit - 02 Computer arithmetic operations Lecture-04
1) A . 0 = 0
1) A + 0 = A
2) A . 1 = A
2) A + 1 = 1
3) A . A = A
3) A + A = A
4) A . A = 0
4) A + A = 1
Inversion law
This law uses the NOT operation.
The inversion law states that double inversion of a variable results in the
original variable itself.
A =A
Unit - 02 Computer arithmetic operations Lecture-05
De Margan theorem
De Morgan has suggested two theorems which are useful in Boolean Algebra.
Theorem 1
A. B = A + B
Unit - 02 Computer arithmetic operations Lecture-05
Theorem 2
A + B = A.B
Unit - 02 Computer arithmetic operations Lecture-01
Number System
As we know that for a computer, everything is a number.
For computer alphabets, pictures, sounds, etc., are numbers.
Data representation :
Data representation :
Digital Computers use Binary number system to represent all types of information inside the computers.
There are two major methods to store real numbers :
1) Fixed Point representation
2) Floating Point representation.
Fixed-Point Representation :
Unit - 02 Computer arithmetic operations Lecture-07
Floating-Point Representation :
The floating number representation of a number has two part:
First part represents a signed fixed point number called mantissa.
Second part of designates the position of the decimal point and is called the exponent.
Floating -point is always represent a number in the following form:
m x be
Unit - 02 Computer arithmetic operations Lecture-07
IEEE 754
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point
computation.
It was established in 1985 by the Institute of Electrical and Electronics Engineers.
IEEE 754 has 3 basic components:
1) Sign
2) exponent
3) Mantissa
Unit - 02 Computer arithmetic operations Lecture-07
Single precision
Double precision
Unit - 02 Computer arithmetic operations Lecture-07
Unit - 02 Computer arithmetic operations Lecture-07
Unit - 02 Computer arithmetic operations Lecture-07
Unit - 02 Computer arithmetic operations Lecture-01
Complement Arithmetic
Binary system complements
As the binary system has base r = 2.
So the two types of complements for the binary system are :
1) 1's complement and
2) 2's complement
1's complement
The 1's complement of a number is found by changing all 1's to 0's and all 0's to 1's.
This is called as taking complement or 1's complement.
Unit - 02 Computer arithmetic operations Lecture-01
2's complement
The 2's complement of binary number is obtained by adding 1 to the Least Significant
Bit (LSB) of 1's complement of the number.
2's complement = 1's complement + 1
Unit - 02 Computer arithmetic operations Lecture-01
Combinational Circuits
Combinational circuit is a circuit in which we combine the different logic gates in the circuit.
Example adder, Subtractor, encoder, decoder, multiplexer and demultiplexer etc.
Block diagram
Unit - 02 Computer arithmetic operations Lecture-08
Block diagram
Unit - 02 Computer arithmetic operations Lecture-09
Half Adder
Half adder is a combinational circuit with two inputs and two outputs.
This circuit has two outputs sum and carry.
It does not take any carry.
It is designed to add two single bit binary numbers.
Truth Table
Circuit Diagram
Logical Expression :
Sum = A XOR B = A ⊕ B
Carry = A AND B = AB
Unit - 02 Computer arithmetic operations Lecture-10
Full Adder
Full adder is developed to overcome the drawback of Half Adder. Truth Table
Circuit Diagram
Logical Expression :
SUM = (A XOR B) XOR Cin = (A ⊕ B) ⊕ Cin
CARRY-OUT = A.B + Cin(A ⊕ B)
= AB + BC + AC
Unit - 02 Computer arithmetic operations Lecture-11
Half Subtractors
Half subtractor is a combination circuit with two inputs and two outputs (difference and borrow).
It produces the difference between the two binary bits and an output (Borrow).
In the subtraction (A-B), A is called as Minuend bit and B is called as Subtrahend bit.
Truth Table
Circuit Diagram
(A ⊕ B)
Logical Expression
AB Difference = A XOR B
Borrow = AB
Unit - 02 Computer arithmetic operations Lecture-12
Full Subtractors
The disadvantage of a half subtractor is overcome by full subtractor.
The full subtractor is a combinational circuit with three inputs and two output Diff. and Borrow'.
Circuit Diagram
Truth Table
DIFFERENCE = (A ⊕ B) ⊕ Cin