Computer Organization and Architecture UNIT - III Data Representation : Data types, Complements, Fixed Point Representation, Floating Point Representation. Computer Arithmetic : Addition and subtraction, multiplication Algorithms, Division Algorithms, Floating– point Arithmetic operations. Decimal Arithmetic unit, Decimal Arithmetic operations. List of Topics
CONTENTS UNIT-III Data Representation The digital computer is a digital system that performs various computational tasks. The word digital implies that the information in the computer is represented by variables that take a limited number of discrete values. Digital computers use the binary number system, which has two digits: 0 and 1. A binary digit is called a bit. Information is represented in digital computers in groups of bits. Represent binary numbers, discrete symbols - decimal digits or letters of the alphabet.
UNIT-I Data Representation UNIT-III
UNIT-I Data Representation NUMBER SYSTEM UNIT-III
Representation of Decimal Systems The memory of a computer contains storage for instructions and data. It is called a random-access memory (RAM) UNIT-I Data Representation UNIT-III
Complements The input and output devices connected to the computer include keyboards, printers, terminals, magnetic disk drives, and other communication devices. UNIT-I Data Representation UNIT-III
Computer organization is concerned with the way the hardware components operate and the way they are connected together to form the computer system. The various components are assumed to be in place and the task is to investigate the organizational structure to verify that the computer parts operate as intended. UNIT-I Data Representation UNIT-III
Floating Point Representation Computer design is concerned with the determination of what hardware should be used and how the parts should be connected. This aspect of computer hardware is sometimes referred to as computer implementation. UNIT-I Data Representation UNIT-III
UNIT-I Data Representation UNIT-III
EXAMPLE • Register Transfer • Bus and Memory Transfers • Arithmetic Microoperations • Logic Microoperations • Shift Microoperations UNIT-I Data Representation UNIT-III
Fixed-point Representation Positive integers, including zero, can be represented as unsigned numbers. However, to represent negative integers, we need a notation for negative values. In ordinary arithmetic, a negative number is indicated by a minus sign and a positive number by a plus sign. Because of hardware limitations, computers must represent everything with l’s and 0’s, including the sign of a number. As a consequence, it is customary to represent the sign with a bit placed in the leftmost position of the number. The convention is to make the sign bit equal to 0 for positive and to 1 for negative. UNIT-I Data Representation UNIT-III
UNIT-I Data Representation Integer Representation When an integer binary number is positive, the sign is represented by and the magnitude by a positive binary number. When the number is negative, the sign is represented by 1 but the rest of the number may be represented in one of three possible ways: Signed-magnitude representation Signed-1’s complement representation Signed 2’s complement representation As an example, consider the signed number 14 stored in an 8-bit register. +14 is represented by a sign bit of 0 in the leftmost position followed by the binary equivalent of 14:00001110. In signed-magnitude representation 1 0001110 In signed-1’s complement representation 1 1110001 In signed-2’s complement representation 1 1110010 UNIT-III
UNIT-I Data Representation Arithmetic Addition - Set of registers and their functions - Microoperations set Set of allowable microoperations provided by the organization of the computer - Control signals that initiate the sequence of microoperations (to perform the functions) UNIT-III
UNIT-I Data Representation Arithmetic Subtraction UNIT-III
UNIT-I Computer Arithmetic Topic 2 : Contents Addition and subtraction multiplication Algorithms Division Algorithms Floating – point Arithmetic operations Decimal Arithmetic unit Decimal Arithmetic operations UNIT-III
UNIT-I Computer Arithmetic Computer Arithmetic Introduction Arithmetic instructions in digital computers manipulate data to produce results necessary for the solution of computational problems. These instructions perform arithmetic calculations and are responsible for the bulk of activity involved in processing data in a computer. The four basic arithmetic operations are addition, subtraction, multiplication, and division. From these four basic operations, it is possible to formulate other arithmetic functions and solve scientific problems by means of numerical analysis methods. UNIT-III
UNIT-I Computer Arithmetic There exists various arithmetic algorithms and we consider addition, subtraction, multiplication, and division for the following types of data: Fixed-point binary data in signed-magnitude representation Fixed-point binary data in signed-2’s complement representation Floating-point binary data Binary-coded decimal (BCD) data UNIT-III
UNIT-I Computer Arithmetic Addition and Subtraction We concentrate on the addition and subtraction algorithms for data represented in Signed-magnitude. Signed-2’s complement. UNIT-III
UNIT-I Computer Arithmetic Table. Addition and Subtraction of Signed-Magnitude Numbers UNIT-III
UNIT-I Computer Arithmetic Figure. Hardware for signed-magnitude addition and subtraction This is similar to an “if” statement in a programming language In digital systems, this is often done via a control signal , called a control function If the signal is 1, the action takes place This is represented as: P: R2 R1 Which means “if P = 1, then load the contents of register R1 into register R2”, i.e., if UNIT-III
UNIT-I Computer Arithmetic Multiplication Algorithms We concentrate on the multiplication algorithms for data represented in Signed-magnitude. Signed-2’s complement. Multiplication with Signed-Magnitude Data Multiplication of two fixed-point binary numbers in signed-magnitude representation is done with paper and pencil by a process of successive shift and adds operations. This process is best illustrated with a numerical example. UNIT-III
UNIT-I Computer Arithmetic UNIT-III
UNIT-I Computer Arithmetic Figure: Hardware for multiply operation UNIT-III
UNIT-I Computer Arithmetic Multiplication with Signed-2’s Complement Data Figure : Hardware for Booth algorithm UNIT-III
UNIT-I Computer Arithmetic Division Algorithms Division of two fixed-point binary numbers in signed-magnitude representation is done with paper and pencil by a process of successive compare, shift, and subtract operations. The same is represented in the figure below. UNIT-III
UNIT-I Computer Arithmetic Figure: Hardware for division operation UNIT-III
UNIT-I Computer Arithmetic EXAMPLE: UNIT-III
Floating-point Arithmetic Operations A floating-point number in computer registers consists of two parts: A mantissa represented as m An exponent represented as e The two parts represent a number obtained from multiplying m times a radix r raised to the value of e , can be written as m x r e UNIT-I Computer Arithmetic UNIT-III
Computer Arithmetic Addition and Subtraction operations During addition or subtraction, the two floating-point operands are in AC and BR. The sum or difference is formed in the AC. The algorithm can be divided into four consecutive parts: Check for zeros. Align the mantissas. Add or subtract the mantissas. Normalize the result. UNIT-III
UNIT-I Computer Arithmetic R1 M[MAR] Figure : Addition and subtraction of floating-point numbers UNIT-III
UNIT-I Computer Arithmetic Multiplication operation The multiplication algorithm can be subdivided into four parts: Check for zeros. Add the exponents. Multiply the mantissas. Normalize the product. UNIT-III
UNIT-I Computer Arithmetic Division operation The division algorithm can be subdivided into five parts: Check for zeros. Initialize registers and evaluate the sign. Align the dividend. Subtract the exponents. Divide the mantissas. UNIT-III
UNIT-I MICROOPERATIONS Decimal Arithmetic Unit Computers capable of performing decimal arithmetic must store the decimal data in binary-coded form. The decimal numbers are then applied to a decimal arithmetic unit capable of executing decimal arithmetic microoperations. UNIT-III
UNIT-I ARITHMETIC MICROOPERATIONS Table : Derivation of BCD Adder UNIT-III
UNIT-I Computer Arithmetic BCD Subtraction A straight subtraction of two decimal numbers is by taking the 9’s or 10’s complement of the subtrahend and adding it to the minuend. Since the BCD is not a self-complementing code, the 9’s complement cannot be obtained by complementing each bit in the code. It must be formed by a circuit that subtracts each BCD digit from 9. UNIT-III
UNIT-I Computer Arithmetic x 1 = B 1 M I + B I 1 M x 2 = B 2 x 4 = B 4 M I + (B I 4 B 2 + B 4 B I 2 )M x 8 = B 8 M I + B I 8 B I 4 B I 2 M UNIT-III
UNIT-III Computer Arithmetic Figure: One stage of a decimal arithmetic unit
UNIT-III Computer Arithmetic Decimal Arithmetic Operations The algorithms for arithmetic operations with decimal data are similar to the algorithms for the corresponding operations with binary data. In fact, except for a slight modification in the multiplication and division algorithms, the same flowcharts can be used for both types of data provided that we interpret the micro-operation symbols properly. Decimal numbers in BCD are stored in computer registers in groups of four bits. Each 4-bit group represents a decimal digit and must be taken as a unit when performing decimal micro-operations .
UNIT-III Computer Arithmetic
UNIT-III Computer Arithmetic Three ways of adding Decimal Number
UNIT-III Computer Arithmetic MULTIPLICATION Registers for arithmetic multiplication and division
UNIT-III Computer Arithmetic Flow chart for Decimal Multiplication
UNIT-III Computer Arithmetic Division Floe chart for Decimal Division
UNIT-III Computer Arithmetic The partial remainder and the quotient bits are shifted once to the left and the process is repeated k times to form k quotient digits. The remainder is then found in register A and the quotient is in register Q. The value of E is neglected.