Presentation is loading. Please wait.

Presentation is loading. Please wait.

Other Arithmetic Functions Section 4-5

Similar presentations


Presentation on theme: "Other Arithmetic Functions Section 4-5"— Presentation transcript:

1 Other Arithmetic Functions Section 4-5

2 Combinational Multiplier
Example: 4-Bit Multiplicand B = {B3 B2 B1 B0} 3-Bit Multiplier A = {A2 A1 A0} Product is a 7-Bit number, C = {C6 C5 C4 C3 C2 C1 C0 }

3 Computing the Product Let us work out the multiplication on the board:

4 Multiplier 4-Bit by 3-Bit Binary Multiplier

5 Contraction Can implement other functions ( Like increment, decrement ) by using basic arithmetic circuits (e.g. Adder) And removing unused portions This is called contraction

6 To increment A = { A2 A1 A0 }, do
Incrementing Very common Computation of memory address for the next instruction to execute by CPU Use a customized adder To increment A = { A2 A1 A0 }, do A2 A1 A ; Do not use C3 (why?) Hiding Box

7 Customized adder To increment A = { A2 A1 A0 }, do
Reference Customized adder To increment A = { A2 A1 A0 }, do A2 A1 A ; Ignore C3 C2

8 Eliminate Unneeded Gates
No need for C3 C2 Cell 0 C1 C2 For the right cell, the output of gate 1 becomes A0’ so it can be replaced by an inverter. The output of gate 2 becomes A0, so it can be replaced by a wire connected to A0. Applying A0 and 0 to gate 3, it can be replaced by a wire, connecting A0 to the output S0. The output of gate 4 is 0, so it can be replaced with a 0 value. Applying this 0 and A0 from gate 2 to gate 5, gate 5 can be replaced by a wire connecting A0 to C1. The resulting circuit is shown as the right cell in Figure 5-12(b). Apply the same technique to the typical cell 1 Cell 2 Cell 1

9 Multiplication by Constant
Case 1: Constant is a power of two Case 2: Constant is NOT a power of two

10 Multiplication by Power of 2
Just wires Division by power of 2 similar C = 4 * B C = B / 4

11 Multiplication by A Constant Which Is Not A Power Of 2
AND gates removed because A is a constant First adder removed by contraction

12 Contraction Not Always Best
Sometimes it pays to rethink the function Example: study decrementer in book (Example 4-6 page 167)

13 Sign Extension Changing the number of bits used to store a number is common Example: -5 in stored in 4-bits (1011) to store -5 in 8 bits, extend the “Sign Bit” in the 4 left most bits 1011 is changed to 1011 = -5 is also -5

14 We’ve Covered Adders Subtracting unsigned numbers Signed numbers
Ripple carry Subtracting unsigned numbers New design for adder-subtractor Signed numbers Signed addition/subtraction Multiplication – just basic Modified Circuits


Download ppt "Other Arithmetic Functions Section 4-5"

Similar presentations


Ads by Google