Tutorial ITI 1100 Dewan Tanvir Ahmed SITE Uof

  • Slides: 37
Download presentation
Tutorial: ITI 1100 Dewan Tanvir Ahmed SITE, Uof. O 1

Tutorial: ITI 1100 Dewan Tanvir Ahmed SITE, Uof. O 1

Today’s topics Comparators Multiplier 2

Today’s topics Comparators Multiplier 2

Comparators • A comparator compares a two n-bit binary values to determine which is

Comparators • A comparator compares a two n-bit binary values to determine which is greater or if they are equal • Consider the simple 1 -bit comparator to illustrate the design • It is possible to extend the design for multi-bit numbers 3

Equality Comparator Design a logic circuit which will compute F 0 = (A =

Equality Comparator Design a logic circuit which will compute F 0 = (A = B) XNOR X Y Z X 0 0 1 1 Y 0 1 Z 1 0 0 1 4

2 -bit Equal Comparator Truth Table b 1 b 0 a 1 a 0

2 -bit Equal Comparator Truth Table b 1 b 0 a 1 a 0 F 0 0 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 5

Solution You can show, 6

Solution You can show, 6

N-bit Equal Comparator 7

N-bit Equal Comparator 7

Not Equal Comparator • Design a logic circuit which will compute F = (A

Not Equal Comparator • Design a logic circuit which will compute F = (A <> B) F = (A = B) i. e. Just invert our Equal Comparator circuit 8

Magnitude Comparator • Design a logic circuit which will compute F 2 = (A>B)

Magnitude Comparator • Design a logic circuit which will compute F 2 = (A>B) F 1 = (A<B) Let’s develop a truth table for 2 -bits 9

2 -bit Magnitude (unsigned) Comparator Truth Table b 1 b 0 a 1 a

2 -bit Magnitude (unsigned) Comparator Truth Table b 1 b 0 a 1 a 0 F 2 F 1 0 0 0 1 0 0 0 1 1 0 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 0 10

You can show 11

You can show 11

1 -bit Comparator x y x>y x=y x<y x>y CMP x=y x<y x y

1 -bit Comparator x y x>y x=y x<y x>y CMP x=y x<y x y 12

8 -bit comparator xn>yn xn=yn x>y x=y CMP xn<yn x<y x y 13

8 -bit comparator xn>yn xn=yn x>y x=y CMP xn<yn x<y x y 13

1 bit comparators • X>Y only if Xi=1, Yi=0 • X<Y only if Xi=0,

1 bit comparators • X>Y only if Xi=1, Yi=0 • X<Y only if Xi=0, Yi=1 • X=Y only if Xi=Yi=0 or Xi=Yi=1 14

1 bit comparator with propagated inputs 15

1 bit comparator with propagated inputs 15

N bit comparator • If: X = Yin is active then the numbers are

N bit comparator • If: X = Yin is active then the numbers are equal so far • If X>Yin or X<Yin is active, that value is simply passed through; This corresponds to the case where we have checked the high-order bits and already know which value is larger. 16

Comparators (computer intelligence? ) • Let's build a comparator circuit for two 4 -bit

Comparators (computer intelligence? ) • Let's build a comparator circuit for two 4 -bit positive binary numbers. • Nine inputs, three outputs (three 512 entries truth tables? ) A 3 A 2 A 1 A 0 B 3 B 2 B 1 B 0 A>B A=B A<B ENABLE 17

Designing Comparators Functionally 1. Build a one-bit comparator A A B B 0 1

Designing Comparators Functionally 1. Build a one-bit comparator A A B B 0 1 A>B : AB' 0 A=B A<B A=B : A'B' + AB 1 A>B A=B A<B : A'B OR What? A>B A=B A<B 18

Designing Comparators Functionally 2. Add an enable line A A>B A=B B Enable 19

Designing Comparators Functionally 2. Add an enable line A A>B A=B B Enable 19

Build a four-bit Comparator (from four one-bit ones) Not bad 20

Build a four-bit Comparator (from four one-bit ones) Not bad 20

Combinational Multiplier Basic Concept multiplicand multiplier 1101 (13) * 1011 (11) product of 2

Combinational Multiplier Basic Concept multiplicand multiplier 1101 (13) * 1011 (11) product of 2 4 -bit numbers is an 8 -bit number 1101 Partial products 1101 0000 1101 10001111 (143) 21

Multiplication • Example: 22

Multiplication • Example: 22

Multiplication • Example: 23

Multiplication • Example: 23

Multiplication • Example: 24

Multiplication • Example: 24

Multiplication • Example: 25

Multiplication • Example: 25

Multiplication • Example: 26

Multiplication • Example: 26

Multiplication • Example: • M x N-bit multiplication – Produce NM-bit partial products –

Multiplication • Example: • M x N-bit multiplication – Produce NM-bit partial products – Sum these to produce M+N-bit product 27

General Form • • Multiplicand: Multiplier: • Product: Y = (y. M-1, y. M-2,

General Form • • Multiplicand: Multiplier: • Product: Y = (y. M-1, y. M-2, …, y 1, y 0) X = (x. N-1, x. N-2, …, x 1, x 0) 28

16 X 16 Mult. Dot Diagram • Each dot represents a bit 29

16 X 16 Mult. Dot Diagram • Each dot represents a bit 29

Combinational Multiplier Partial Product Accumulation S 7 A 3 A 2 A 1 A

Combinational Multiplier Partial Product Accumulation S 7 A 3 A 2 A 1 A 0 B 3 B 2 B 1 B 0 A 3 B 0 A 2 B 0 A 1 B 0 A 0 B 0 A 3 B 1 A 2 B 1 A 1 B 1 A 0 B 1 A 3 B 2 A 2 B 2 A 1 B 2 A 0 B 2 A 3 B 3 A 2 B 3 A 1 B 3 A 0 B 3 S 6 S 5 S 4 S 3 S 2 S 1 S 0 30

Partial Product Accumulation Note use of parallel carry-outs to form higher order sums 12

Partial Product Accumulation Note use of parallel carry-outs to form higher order sums 12 Adders, if full adders, this is 6 gates each = 72 gates 16 gates form the partial products total = 88 gates! 31

Another Representation of the Circuit Building block: full adder + and 4 x 4

Another Representation of the Circuit Building block: full adder + and 4 x 4 array of building blocks 32

Parallel Binary Multiplier P Y C Y X + CO X PO 33

Parallel Binary Multiplier P Y C Y X + CO X PO 33

One-Bit Multiplier Cell P Y C Y X + CO X PO 34

One-Bit Multiplier Cell P Y C Y X + CO X PO 34

2 -bit by 2 -bit Binary Multiplier With J multiplier bits and K multiplicand

2 -bit by 2 -bit Binary Multiplier With J multiplier bits and K multiplicand bits – need Jx. K AND gates and (J-1) K-bit adders to produce J+K bits 35

4 -bit by 3 -bit Binary Multiplier With J=3 (A 0 A 1 A

4 -bit by 3 -bit Binary Multiplier With J=3 (A 0 A 1 A 2) multiplier bits, K=4 (B 3 B 2 B 1 B 0) multiplicand bits – need 12 (Jx. K) AND gates, 2 (J-1) 4 -bit(K-bit) adders to produce 7(J+K) bits 36

Thank You! 37

Thank You! 37