Computer Arithmetic || freecodeit

What is Computer Arithmetic?

Arithmetic instructions manipulate data to produce solution for computational problems. The 4 basic arithmetic operations are addition, subtraction, multiplication and division. From these 4, it is possible to formulate other scientific problems by means of numerical analysis methods. Here, we’ll discuss these 4 operations only on fixed-point binary data (there are other types too, viz. floating point binary data, binary- coded decimal data) and hence the unitnamed.
1. Addition and Subtraction of signed Magnitude Data
2. Addition and Subtraction of signed 2's Complement Data
3. Multiplication of Signed Magnitude Data
4. Multiplication of Signed 2's Complement Data

Addition and Subtraction

There are 3 ways of representing negative fixed-point binary numbers: signed magnitude, signed 1’s complement or signed 2’s complement. Singed 2’s complemented form used most but occasionally we deal with signedmagnitude representation.

Addition and Subtraction with signed-magnitude data

Everyday arithmetic calculations with paper and pencil for signedbinary numbers are straight forward and are helpful on deriving hardware algorithm. When two signed numbers A and B are added are added are subtracted,we find 8 different conditions to consider as described in following table:

Hardware Implementation

To implement the two arithmetic operations with hardware, we have to store numbers into two register A and B. let As and Bs be two flip-flops that holds corresponding signs.The result is transferred to A and As. A and As to gether form a accumulator.
Block Diagram Description: Hardware above consists of registers A and B and sign flip-flops As and Bs. subtraction is done by adding A to the 2’s complement of B. Output carry is transferred to flip-flop E, where it can be checked to determine the relative magnitude of two numbers. Add-overflow flip-flop AVF holds overflow bit when A and B are added. Addition of A and B is done through the parallel adder. The S output of adder is applied to A again. The complementer provides an output of B or B’ depending on mode input M. Recalling unit 2, when M = 0, the output of B is transferred to the adder, the input carry is 0 and thus output of adder is A+B. when M=1, 1’s complement of B is applied to the adder, input carry is 1 and output is S = A+B’+1 (i.e. A- B).

Hardware Algorithm

The flowchart for the H/W algorithm is given below:






Youtube Videos

0 Comments