parallel adders

Post on 22-Jan-2018

72 Views

Category:

Presentations & Public Speaking

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Digital Logic Design (DLD)

Lecture # 4

Prepared By

Tayyaba Altaf

Binary Addition

Rules

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 0 (10, carry of one to the next bit)

Addition

• Take 4-bit values by adding 6 and 7.

• 1 1 carry

0110 6

0111 7 8 4 2 1

1101 13 1 1 0 1

One Bit Adder

a b Cin Cout S

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 1

4-bit Full Adder

Signed Number

• Every Number can have both positive +5 andnegative -5 number. In binary number systempositive number can easily expressed.

• Take 4-bit, Normally 0 as a last bit representpositive number (i.e. +5 = 0101)

• Make last bit 1 for negative number (i.e. -5=1101)

Problem with Signed Number

With 3-bit magnitude, the range of numbersavailable would be from +7 to -7.

Most computers use a larger number of bits tostore numbers.

The major problem with signed magnitude iscomplexity of arithmetic.

Examples

Consider following problems with signed numbers.

+5 -5

+3 -3

+8 - 8

-8 can not be represented in 4 bit signed number.

2’s Complement

Signed binary numbers are nearly always storedin two’s complement format.

Leading bit is still the sign bit (0 for positive)

The largest number that can be stored is 2n-1 -1

(7 for n=4)

The negative number –a is stored as the binaryequivalent of 2n – a in an n-bit system. E.g. -3 isstored as the binary for 16-3 = 13, that is 1101.

2’s Complement• Convert 4-bit positive number into negative by

using two’s complement method is follow

+5 0101

For negative number, convert all 1’s into 0’s and all 0’s into 1’s and add 1. above binary number will become.

1010

+ 1

1011 -5

2’s Complement• Note that there is no negative zero; the process of

complementing +0 produces an answer 0000. Intwo’s complement addition, the carry out of themost significant bit is ignored.

• For Example: -0

0: 0000

1111

+ 1

0000

2’s Complement

• For 4-bit numbers, that range is -8<=sum<=+7

• The reason that two’s complement is sopopular in the simplicity of addition.

Singed and unsigned 4-bit numbers.

Binary Positive Signed (2’s comp)0000 0 0

0001 1 +1

0010 2 +2

0011 3 +3

0100 4 +4

0101 5 +5

0110 6 +6

0111 7 +7

1000 8 -8

1001 9 -7

1010 10 -6

1011 11 -5

1100 12 -4

1101 13 -3

1110 14 -2

1111 15 -1

Class Task

• Solve following operation.

i) 5-7

ii) 7- (-5)

iii) -5 +3

top related