• No results found

IMPLEMENTATION OF N-BIT ADDER ANDSUBTRACTOR OF LIBRARY COMPONENTSFOR ARITHMETIC UNIT

N/A
N/A
Protected

Academic year: 2022

Share "IMPLEMENTATION OF N-BIT ADDER ANDSUBTRACTOR OF LIBRARY COMPONENTSFOR ARITHMETIC UNIT"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

IMPLEMENTATION OF N-BIT ADDER AND SUBTRACTOR OF LIBRARY COMPONENTS

FOR ARITHMETIC UNIT

Vishal Kumar Srivastava*, Subhash Kumar Sharma**, S. N. Shukla***

and Himanshu Pandey****

*Department of Physics & Electronics Dr. R.M.L. Avadh University, Faizabad (India)

**Department Of Electronics

D.D.U. Gorakhpur University, Gorakhpur (India)

***Department of Physics & Electronics Dr. RML Avadh University, Faizabad (India)

****Department of Mathematics & Statistics D.D.U. Gorakhpur University, Gorakhpur (India)

ABSTRACT

This paper deals with development of an n-bit ALU using VHDL.

Normally the most of the industries, now a days are using either 4-bit ALU or 8-bit ALU, so We have generalized this, thus We need not to worry about the bit size of ALU. It has solved all the problems of 4-bit, 8- bit and 16-bit ALU's and so on. Hence, We have utilized VHSIC Hardware Description Language and Xilinx in accomplishing this task of development of an n-bit ALU. An Arithmetic and Logic Unit (ALU) is a combinational circuit that performs logic and arithmetic micro-operations on a pair of n-bit operands. The operations performed by an ALU are controlled by a set of function-select inputs. The ALU is the part of computer that actually performs arithmetic and logical operations on data. All of the other elements of the computer system-control unit registers, memory, I/Os are mainly to bring data into the ALU for it to process and then to take the results back out.

Key words: Half adder, Full adder, Ripple adder, n-bit adder, Subtractor, n-bit Subtactor.

INTRODUCTION

Addition is the most commonly performed arithmetic operation in digital systems. An adder

combines two arithmetic operands using the addition rules. An adder can perform subtraction as the addition of the minuend and the comple- mented (negated) subtrahend, but we can also

(2)

requires two bits to express. The low-order bit of the sum may be named HS (half sum), and the high-order bit may be named CO (carry out). We can write the following equations for HS and CO:

HS = X XOR Y = X Y'+X'Y CO = X Y

To add operands with more than one bit, we must provide for carries between bit positions. The building block for this operation is called a full adder. Besides the addend-bit inputs X and Y, a full adder has a carry-bit input, CIN. The sum of the three inputs can range from 0 to 3, which can still be expressed with just two output bits, S and COUT, having the following equations:

S = X XOR Y XOR CIN

= X Y' CIN'+X' Y CIN'+X' Y' CIN+X Y CIN

COUT= X Y + X CIN + Y CIN

Here, S is 1 if an odd number of the inputs are 1, and COUT is 1 if two or more of the inputs are 1. One possible circuit that performs

Ripple Adder:

Two binary words, each with n bits, can be added using a ripple adder-a cascade of n full-adder stages, each of which handles one bit. Fig.(3) shows the circuit for a 4-bit ripple adder.

The carry input to the least significant bit (c0) is normally set to 0, and the carry output of each full adder is connected to the carry input of the next most significant full adder. A ripple adder is slow, since in the worst case a carry must propagate from the least significant full adder to the most significant one. This occurs if, for example, one addend is 11...11 and the other is 00 …01. Assuming that all of the addend bits are presented simultaneously, the total worst- case delay is

Fig. (2) Full adder: logic symbol

(3)

Fig. (3) 4 bit ripple adder

where tXYCout is the delay from X or Y to COUT

in the least significant stage, tCinCout is the delay from CIN to COUT in the middle stages, and tCinS

is the delay from CIN to S in the most significant stage. A faster adder can be built by obtaining each sum output si with just two levels of logic.

This can be accomplished by writing an equation for si in terms of x0-xi, y0-yi, and c0,

"multiplying out" or "adding out" to obtain a sum- of-products or product-of-sums expression, and building the corresponding AND-OR or OR-AND circuit. Unfortunately, beyond s2, the resulting expressions have too many terms, requiring too many first-level gates and more inputs than typically possible on the second-level gate.

Subtractor:

A full subtractor handles one bit of the binary subtraction algorithm, having input bits X (minuend), Y (subtrahend), and BIN (borrow in), and output bits D (difference) and BOUT

(borrow out). We can write logic equations corresponding to the binary subtraction table as follows:

D = X XOR Y BIN

BOUT = X' Y + X' BIN + Y BIN

These equations are very similar to equations for a full adder. A two's-complement subtraction operation, X - Y, can be performed by an addition operation, namely, by adding the two's complement of Y to X. The two's com- plement of Y is Y + 1, where Y is the bit-by-bit complement of Y. A binary adder can be used to perform an unsigned subtraction operation X - Y, by performing the operation X + Y + 1.

We can build a full subtractor from a full adder.

Any n-bit adder circuit can be made to function as a subtractor by complementing the subtrahend and treating the carry-in and carryout signals as borrows with the opposite active level.

(4)

Fig. (4) Subtractors using adders; (a) full adder (b) full subtractor (c) interpreting 74x999 as a full subtractor (d) ripple adder.

Simulation Results of ALU Components Using Xilinx

n-bit Full Adder:

Input1

a1=10101, b1=11001

Required Sum=01110, Required Carry=1 Obtained Sum=01110, Obtained Carry=1

Input2

a1=11100, b1=10001

Required Sum=01101, Required Carry=1 Obtained Sum=01101, Obtained Carry=1

(5)

n-bit Full Subtractor:

Input1

a1=11100, b1=10010

Required Difference = 01010, Required Borrow = 0 Obtained Difference = 01010, Obtained Difference = 0

Input2

a1=10010, b1=11100

Required Difference=10110, Required Borrow=1

Obtained Difference=10110 (2's complement), Obtained Borrow=1

(6)

CONCLUSIONS

This paper deals with development of an n-bit adder and subtractor for ALU in VHDL with the help of ModelSim and synthesized with Xilinx tools. We have designed adder, subtractor VHDL programs. All programs are on an n-bit format; hence they can be treated as Universal programs. Normally most of the industries now-a-days are using either 4-bit ALU or 32-bit ALU, we have generalized it. Hence now we need not to worry about the bit size of ALU. This will solve all the problems of 4-bit, 8-bit and 16-bit ALU's and so on. Simulation results of all the designed programs have been carried out for various inputs with the help of ModelSim tool.

In future, we can design ALU which can handle floating point numbers and shifters. Shifters include Right Level Logic and Left Level Logic.

Also, various mathematical expressions handling ALU can be designed. E.g. modulus, percentage etc. ALU which can follow BODMAS rule can also be designed. Hence, in future we can add any type of mathematical and logical modules provided they must be on an n-bit format.

Tools Used :

Platform: Windows XP

Simulator: Model Sim SE, Version 5.5f and

5.5a, Mentor Graphics Company

Synthesizer: Leonardo Spectrum 2003a.33, Mentor Graphics, Inc., Xilinx 6.3i

REFERENCES

1. The VHDL Cookbook, First Edition, Peter J. Ashenden, Dept. Computer science, Uni- versity of Adelaid, South Australia (1990).

2. D. Gajski and R. Khun, "Introduction: New VLSI Tools," IEEE Computer, Vol. 16, No.

12, pp. 11-14, Dec. (1983).

3. M. Mano and C. Kime, "Logic and Computer Design Fundamentals," 2nd Edition, Prentice Hall, Upper Saddle River (2001).

4. S. Yalamanchili, "VHDL Starter's Guide,"

Prentice Hall, Upper Saddle River (1998).

5. J. Bhasker, "VHDL Primer," 3rd Edition, Prentice Hall, Upper Saddle River (1998).

6. P. J. Ashenden, "The Student's Guide to VHDL," Morgan Kaufmann Publishers, Inc, San Francisco (1998).

7. A. Dewey, "Analysis and Design of Digital Systems," PWS Publishing Company, New York (1997).

8. C. H. Roth, "Digital System Design using VHDL", PWS Publishing Company, New York (1998).

9. D. Pellerin and D. Taylor, "VHDL Made Easy!", Prentice Hall, Upper Saddle River, (1997).

References

Related documents

forty-page signed holograph containing a critical examina- tion of the poet-an essay "which, as far as is now known, has remained unpublished" (COLBY LIBRARY QUARTERLY,

[r]

The difference in the dispersal profile of the two tree species may be a reflection of the reproductive ability of their mother trees, their seed disperser activity and dif-

The effective strains observed at the end of the rod crimp- ing process lead to the prediction that the cases with min- imum flow stress and higher coefficient of friction would

The results obtained from the gasification of wood chip in term of high heating values (HHV) of producer gas were considered for further exploitations such as a compression

water, available water, utilized flow, utilizable outflow, incre- mental ET, reserved outflow, non-utilizable outflow, and sur- face and groundwater outflows (see Fig.. Gross inflow

In the Thick of National Consciousness: Difference and the In the Thick of National Consciousness: Difference and the Critique of Identity in Elias Khoury’s Little Mountain and

Low level of human resource development can be attributed to several factors like high growth rate of population, poverty, unemployment inequality, illiteracy