Computer Arithmetic Operations PDF
Document Details
Uploaded by Deleted User
Tags
Summary
These notes detail computer arithmetic operations, including logic gates, Boolean algebra, and number systems. The content provides a foundational understanding of digital circuits and their mathematical representation.
Full Transcript
Unit - 02 Computer arithmetic operations Lecture-01 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...
Unit - 02 Computer arithmetic operations Lecture-01 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 Basic Logic Gates Universal Logic Gates Special Logic Gates AND gate, NAND Gate Ex-OR Gate OR gate NOR Gates Ex-NOR Gate 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 Universal Logic Gates A universal logic gate is a logic gate that can be used to construct all other logic gates. NAND and NOR gates are known as universal logic gates. NAND Gate A AND-NOT operation is known as NAND operation. It has n input (n >= 2) and one output. Logic diagram Truth Table 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. Rule in Boolean Algebra Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW. Complement of a variable is represented by an overbar (-). Example : A is represented as A OR operation of the variables is represented by plus (+) sign between them. Example : ORing of A, B, C is represented as A + B + C. AND operation of the two or more variable is represented by dot between them such as A.B.C. Sometime the dot may be omitted like ABC. Unit - 02 Computer arithmetic operations Lecture-04 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. A.B = B.A A+B=B+A 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 AND law OR law These laws use the AND operation. These laws use the OR operation. Therefore they are called as AND laws. Therefore they are called as OR laws. 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. There are four types of Number system 1) Binary number system consists of only two values, either 0 or 1 2) Octal number system represents values in 8 digits from 0 to 7. 3) Decimal number system represents values in 10 digits from 0 to 9. 4) Hexadecimal number system represents values in 16 digits from 0 to 9, A, B, C, D, E & F. Unit - 02 Computer arithmetic operations Lecture-01 Data representation : Magnitude representation Complement representation Signed unsigned 1’s Complement 2’s Complement representation representation representation representation Unit - 02 Computer arithmetic operations Lecture-07 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 2's complement multiplication Unit - 02 Computer arithmetic operations Lecture-07 2's complement multiplication Unit - 02 Computer arithmetic operations Lecture-08 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. Some of the characteristics of combinational circuits are following : The combinational circuit do not use any memory. The output of combinational circuit at any instant of time, depends only on the present at input. The previous state of input does not have any effect on the present state of the circuit. A combinational circuit can have an n number of inputs and m number of outputs. 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 It can add two one-bit numbers, and carry. The full adder is a three input and two output combinational circuit. Block diagram 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 BORROW = AB + ABin + BBin Unit - 02 Computer arithmetic operations Lecture-13 Booth's Multiplication/Hardware implementation for multiplication The booth algorithm is a multiplication algorithm that allows us to multiply the two signed binary integers in 2's complement. It is also used to speed up the performance of the multiplication process. Unit - 02 Computer arithmetic operations Lecture-13 Booth's Algorithm/Flow chart to multiplying binary numbers Unit - 02 Computer arithmetic operations Lecture-13 Multiplying binary numbers Unit - 02 Computer arithmetic operations Lecture-13