0% found this document useful (0 votes)
35 views

Number Arithmetic p2

1) Addition and subtraction can be performed using basic logic gates arranged in a series of one-bit adders. Carry bits must propagate from right to left through the adders. 2) Look-ahead carry circuits can reduce the propagation delay by computing carry bits in parallel rather than series. 3) Multiplication can be performed using a series of additions and left shifts, where each bit of the multiplicand is used to conditionally add the multiplier to a running product.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Number Arithmetic p2

1) Addition and subtraction can be performed using basic logic gates arranged in a series of one-bit adders. Carry bits must propagate from right to left through the adders. 2) Look-ahead carry circuits can reduce the propagation delay by computing carry bits in parallel rather than series. 3) Multiplication can be performed using a series of additions and left shifts, where each bit of the multiplicand is used to conditionally add the multiplier to a running product.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Arithmetic Circuits

Elementary School

Arithmetic
COMP375 Computer Architecture and dO Organization i ti

17 +7 24

010001 +000111 011000

You add two numbers together. If the sum is greater than the number base, you add one to the next column. When you add two numbers, you may also have to add the carry from the column to the right.

1 Bit Adder
A one bit adder has three inputs, numbers A and B and Carry in. There are two outputs, t t the th Sum S and d Carry C out. t
A B

1 bit Adder Truth Table

Cout

one bit adder

Cin

Sum

figure from textbook

COMP375

Arithmetic Circuits

Addition Sum
~A ~B ~Cin Cin 0 1 ~A B 1 0 A B 0 1 A ~B 1 0 ~Cin Cin

Addition Carry Out


~A ~B 0 0 ~A B 0 1 A B 1 1 A ~B 0 1

Sum = ~AB~C + A~B~C + ~A~BC + ABC

Cout = AB + BC + AC

Multiple Bit Adder

Cout

one bit adder

one bit adder

one bit adder

Sum

Sum

Sum

COMP375

Arithmetic Circuits

Subtraction
Instead of building a separate subtraction circuit, you can add the negative of the operand. To make a twos complement number negative, you must invert the bits and add one A NOT gate can be used to invert all the bits. Setting the Carry In on the rightmost bit will add one to the result. A+~B+1 = A + (~B+1) = A + (-B) = A - B

Propagation Delay
To make a 32 bit adder, you can use 32 one bit adders. dd The left most bit cannot be computed until all of the other bits are computed so that the Carry In value will be known. Each one bit adder requires the signal to go through two gates. Each gate takes a small amount of time to react. This limits the speed of the adder.

Look Ahead Carry


The Carry Out is determined by Ci+1 = Ai*B Bi + Ai*C Ci + B B*C Ci Ci+1 = Ai*Bi + Ci*(Ai+ Bi) The A*B term is true when this bit generates a carry out. Call it Gi The other term is true when a carry propagates from an earlier bit. Call it Pi

Carry Equations
We can express the carry as: Ci+1 = Gi + (Pi * Ci) Ci+2 = Gi+1 + (Pi+1 * Gi) + (Pi+1 * Pi * Ci) Ci+4 = Gi+3 +(Pi+3 * Gi+2) + (Pi+3 * Pi+2 * Gi+1) + (Pi+3 * Pi+2 * Pi+1 * Gi) + (Pi+3 * Pi+2 * Pi+1 * Pi * Ci)

COMP375

Arithmetic Circuits

Reduced Propagation
The simple n bit ripple adder took O(2n) ti time to t add dd n bits bit d due t to carry propagation. ti With carry look ahead, it takes O(3) time to propagate the carry. The look ahead requires more circuitry.

Further Simplification
Creating a big adder out of groups of adders can reduce propagation and circuitry
As Bs As Bs As Bs

Cout

four bit adder

four bit adder

four bit adder

Sums

Sums

Sums

Multiplication Tables
Decimal
1 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 2 2 4 6 8 10 12 14 16 18 20 3 3 6 9 12 15 18 21 24 27 30 4 4 8 12 16 20 24 28 32 36 40 5 5 10 15 20 25 30 35 40 45 50 6 6 12 18 24 30 36 42 48 54 60 7 7 14 21 28 35 42 49 56 63 70 8 8 16 24 32 40 48 56 64 72 80 9 9 18 27 36 45 54 63 72 81 90 10 10 20 30 40 50 60 70 80 90 100 0 1

Multiplication
543 *312 312 1086 543 1629 169416
decimal

Binary
0 0 0 1 0 1

110 *101 101 110 000 110 11110


binary

COMP375

Arithmetic Circuits

Add and Shift


Multiplication can be done by a series of adds and left shifts. Assume you have operands A & B and Product P (initially zero). for each bit i in B { if ( (Bi is one) ) add A to P shift A left by one bit } A

5 x 5 initial setup 00101 00101


P B

00000

B0 is 1 so Add
A

Shift A left one bit


A

00101
+

01010
+

00101

B P

00101

00101

00101

COMP375

Arithmetic Circuits

B1 is zero so do nothing
A

Shift A left one bit


A

01010 00101
B

10100 00101
B

00101

00101

B2 is 1 so Add
A

Shift A left one bit


A

10100
+

01000 00101
B

00101

B P

11001

11001

COMP375

Arithmetic Circuits

B3 is zero so do nothing
A

Shift A left one bit


A

01000 00101
B

10000 00101
B

11001

11001

B4 is zero so do nothing
A

Done
A

10000 00101
B

10000 00101
B

11001

11001

COMP375

Arithmetic Circuits

Combinatorial Multiplier

One Bit Multiplier


Pin Cout B A A Cin B if B = 0 then Pin if B = 1 then Pin + A

Division
Division is difficult. (Every elementary school h l child hild k knows th that.) t) Some small computers do not have multiplication or division. Some have multiplication but not division.

COMP375

You might also like