# Digital Design LAB Lab 5 ADDER SUBTRACTOR

Download Digital Design LAB Lab 5 ADDER SUBTRACTOR

## Preview text

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Digital Design LAB Eng. Ahmed Abumarasa

Digital Design LAB

Lab 5

ADDER SUBTRACTOR

Introduction:

In electronics, an adder or summer is a digital circuit that performs addition of numbers. In many computers and other kinds of processors, adders are used not only in the arithmetic logic unit(s), but also in other parts of the processor, where they are used to calculate addresses, table indices, and similar.

Half Adder:

A half adder adds two one-bit binary numbers A and B. It has two outputs, S and C (the value theoretically carried on to the next addition); the final sum is 2C + S. The simplest halfadder design, pictured on the right, incorporates an XOR gate for S and an AND gate for C. Half adders cannot be used compositely, given their incapacity for a carry-in bit.

input

A

B

0

0

0

1

1

0

1

1

Output

S

C

0

0

1

0

1

0

0

1

S = A xor B. C = A.B

Full Adder:

A full adder adds binary numbers and accounts for values carried in as well as out. A one-bit full adder adds three one-bit numbers, often written as A, B, and Cin; A and B are the operands, and Cin is a bit carried in (in theory from a past addition). The circuit produces a two-bit output sum typically represented by the signals Cout and S, where

. The one-bit full adder's truth table is:

input

output

A

B

Cin

S

Cout

0

0

0

0

0

0

0

1

1

0

0

1

0

1

0

0

1

1

0

1

1

0

0

1

0

1

0

1

0

1

1

1

0

0

1

1

1

1

1

1

S = A xor B xor Cin. Cout = A.B + A.Cin + B.Cin = (A xor B).Cin + A.Cin

Half subtractor :

The half-subtractor is a combinational circuit which is used to perform subtraction of two bits. It has two inputs, X (minuend) and Y (subtrahend) and two outputs D (difference) and B (borrow).

input

X

Y

0

0

0

1

1

0

1

1

Output

D

B

0

0

1

1

1

0

0

0

D = X xor Y. B = X.Y

Full subtractor :

The full-subtractor is a combinational circuit which is used to perform subtraction of three bits. It has three inputs, X (minuend) and Y (subtrahend) and Z (subtrahend) and two outputs D (difference) and B (borrow).

D = X- Y- Z. B = 1 if (X < y+ z)

input

output

X

Y

Z

D

B

0

0

0

0

0

0

0

1

1

1

0

1

0

1

1

0

1

1

0

1

1

0

0

1

0

1

0

1

0

0

1

1

0

0

0

1

1

1

1

1

D = X xor Y xor Z. B = Z.( X xnor Y) + X.Y

4-bit Adder:

It is possible to create a logical circuit using multiple full adders to add N-bit numbers. Each full adder inputs a Cin, which is the Cout of the previous adder. This kind of adder is a ripple carry adder, since each carry bit "ripples" to the next full adder. Note that the first (and only the first) full adder may be replaced by a half adder.

Adder-Subtractor:

In digital circuits, an adder–subtractor is a circuit that is capable of adding or subtracting numbers (in particular, binary). Below is a circuit that does adding or subtracting depending on a control signal. It is also possible to construct a circuit that performs both addition and subtraction at the same time.

M: controller, adding when M=0 and Subtracting when M=1.

Adding: A+B.

Sub: A-B.

V: overflow flag, denote that an overflow happened when V=1.

Lab work:

Implement the four circuit (half and full adder and subtractor).

Implement the 4-bit adder-subtractor.

Digital Design LAB

Lab 5

ADDER SUBTRACTOR

Introduction:

In electronics, an adder or summer is a digital circuit that performs addition of numbers. In many computers and other kinds of processors, adders are used not only in the arithmetic logic unit(s), but also in other parts of the processor, where they are used to calculate addresses, table indices, and similar.

Half Adder:

A half adder adds two one-bit binary numbers A and B. It has two outputs, S and C (the value theoretically carried on to the next addition); the final sum is 2C + S. The simplest halfadder design, pictured on the right, incorporates an XOR gate for S and an AND gate for C. Half adders cannot be used compositely, given their incapacity for a carry-in bit.

input

A

B

0

0

0

1

1

0

1

1

Output

S

C

0

0

1

0

1

0

0

1

S = A xor B. C = A.B

Full Adder:

A full adder adds binary numbers and accounts for values carried in as well as out. A one-bit full adder adds three one-bit numbers, often written as A, B, and Cin; A and B are the operands, and Cin is a bit carried in (in theory from a past addition). The circuit produces a two-bit output sum typically represented by the signals Cout and S, where

. The one-bit full adder's truth table is:

input

output

A

B

Cin

S

Cout

0

0

0

0

0

0

0

1

1

0

0

1

0

1

0

0

1

1

0

1

1

0

0

1

0

1

0

1

0

1

1

1

0

0

1

1

1

1

1

1

S = A xor B xor Cin. Cout = A.B + A.Cin + B.Cin = (A xor B).Cin + A.Cin

Half subtractor :

The half-subtractor is a combinational circuit which is used to perform subtraction of two bits. It has two inputs, X (minuend) and Y (subtrahend) and two outputs D (difference) and B (borrow).

input

X

Y

0

0

0

1

1

0

1

1

Output

D

B

0

0

1

1

1

0

0

0

D = X xor Y. B = X.Y

Full subtractor :

The full-subtractor is a combinational circuit which is used to perform subtraction of three bits. It has three inputs, X (minuend) and Y (subtrahend) and Z (subtrahend) and two outputs D (difference) and B (borrow).

D = X- Y- Z. B = 1 if (X < y+ z)

input

output

X

Y

Z

D

B

0

0

0

0

0

0

0

1

1

1

0

1

0

1

1

0

1

1

0

1

1

0

0

1

0

1

0

1

0

0

1

1

0

0

0

1

1

1

1

1

D = X xor Y xor Z. B = Z.( X xnor Y) + X.Y

4-bit Adder:

It is possible to create a logical circuit using multiple full adders to add N-bit numbers. Each full adder inputs a Cin, which is the Cout of the previous adder. This kind of adder is a ripple carry adder, since each carry bit "ripples" to the next full adder. Note that the first (and only the first) full adder may be replaced by a half adder.

Adder-Subtractor:

In digital circuits, an adder–subtractor is a circuit that is capable of adding or subtracting numbers (in particular, binary). Below is a circuit that does adding or subtracting depending on a control signal. It is also possible to construct a circuit that performs both addition and subtraction at the same time.

M: controller, adding when M=0 and Subtracting when M=1.

Adding: A+B.

Sub: A-B.

V: overflow flag, denote that an overflow happened when V=1.

Lab work:

Implement the four circuit (half and full adder and subtractor).

Implement the 4-bit adder-subtractor.

## Categories

## You my also like

### Design, Simulation, and Analysis of Different Operational

2.3 MB72.7K26.9K### Design of Optimized Reversible BCD Adder/Subtractor

833.3 KB59.8K14.4K### IACSIT International Journal of Engineering and Technology

833.3 KB18.3K2K### Digital Logic Design

797.8 KB26.3K7.9K### EE 109 Adders

720.2 KB59.6K28K### High Speed CMOS VLSI Design Lecture 12: Adders

84.3 KB8.1K1.3K### Arithmetic Logic Unit (ALU)

926.4 KB10.2K1K### Lab 1: Full Adder

120.5 KB18.9K5.3K### XOR and XNOR gates: Basics and Applications Objectives

292.3 KB29.6K4.7K