# L03 - 18-447 Lecture 3 Computer Arithmetic Multiplication...

This preview shows pages 1–5. Sign up to view the full content.

CMU 18-447 S’08 L3-1 © 2008 J. C. Hoe 18-447 Lecture 3: Computer Arithmetic: Multiplication and Division James C. Hoe Dept of ECE, CMU January 23, 2008 Announcements: Verilog Refresher Friday 11~12:30, Hamburg 237 Read P&H Ch 3 Read IEEE 754-1985 Handouts: Handout03: HW1 (due 2/4) IEEE 754-1985 (download from Blackboard) CMU 18-447 S’08 L3-2 © 2008 J. C. Hoe Mult and Divide by Powers of 2 ± left shift b n-1 b n-2 …b 2 b 1 b 0 by s positions yields b n-1 b n-2 …b 2 b 1 b 0 000. ..00 i.e., Works for 2’s-complement numbers (??) ± What about right shifts? ­ Does right-shift b n-1 b n-2 …b 2 b 1 b 0 by s positions yield 000. ..00_b n-1 b n-2 …b s+1 b s or 111. ..11 _b n-1 b n-2 …b s+1 b s or b n-1 ...b n-1 _b n-1 b n-2 …b s+1 b s = = + = 1 0 1 0 2 2 2 n i i i n i s i s i b b logical right shift vs arithmetic r. shift

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CMU 18-447 S’08 L3-3 © 2008 J. C. Hoe Multiply 2 n-bit numbers: a x b ± Given unsigned numbers a n-1 a n-2 …a 2 a 1 a 0 and b n-1 b n- 2 …b 2 b 1 b 0 ± Construct a full adder array where the summand ( a n-1:0 x 2 i ) can be conditionally zero’ed according to b i of b n-1:0 ± 2n bits are required to represent all possible products without overflow ∑∑ = = = 1 0 1 0 2 2 n j n i i i j j a b b a 2’s complement? b 0 ? a n-1:0 : 0 b 1 ? a n-1:0 : 0 b 2 ? a n-1:0 : 0 b n-1 ? a n-1:0 : 0 + 2n-bit product CMU 18-447 S’08 L3-4 © 2008 J. C. Hoe Prelude to Multiply: adding many numbers quickly
CMU 18-447 S’08 L3-5 © 2008 J. C. Hoe Adding k n-bit numbers V 0 FA FA FA FA FA V 1 FA FA FA FA FA V 2 FA FA FA FA FA V 3 FA FA FA FA FA V k-1 k-1 adders to sum k numbers Critical Path: O( k + log n ) or if n k then O(k) CMU 18-447 S’08 L3-6 © 2008 J. C. Hoe Using “Pop. Count” ab s 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 y x b a c c s 1 parity 3-way majority s 0 = a b c s 1 = bc+ac+ab Where have you seen this before? How many bits of a, b and c are set?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CMU 18-447 S’08 L3-7 © 2008 J. C. Hoe 0 Takes A, B, and C and produce X and Y such that A+B+C=X+Y Carry-Save Adder (CSA) FA b 0 a 0 c 0 FA b 1 a 1 c 1 FA b n-2 a n-2 c n-2 FA b 2 a 2 c 2 FA b n-1 a n-1 c n-1 y 1 x 2 y 0 x 1 x
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

L03 - 18-447 Lecture 3 Computer Arithmetic Multiplication...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online