This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: ECE 212 HW 3 SOLUTIONS p 1 of 10 //home/vdimitrov/7724/3831d36a335cc1b5beffe233599ac9ab9e042d0f.doc ECE 212 Homework Set 3 SOLUTIONS 1. (a) Using multiplication Algorithm A (repeated addition): (i) If X = 0, Y = 15 how many times do you perform an addition? (ii) If X = 15, Y = 0 how many times do you perform an addition? (b) Using multiplication Algorithm B (test, add, shift): (i) If X = 0, Y = 15 how many times do you perform an addition? (ii) If X = 15, Y = 0 how many times do you perform an addition? Solution: (a) Y goes to the counter, X gets added Y times. (i) If Y = 15, you add 15 times . (ii) If Y = 0, you add zero times . (b) You examine the bits in X; the number of times you add equals the number of ones in X. (i) If X = 0, you add zero times . (ii) If X = 15 = 1111, you add 4 times . ECE 212 HW 3 SOLUTIONS p 2 of 10 2. (a) In Algorithm A, why do we use a 'whiledo' loop? That is, why do we check the counter before executing the body of the loop? (b) Construct a State Transition Diagram for a controller that realizes Algorithm A. Solution: (a) If Y = 0, then we must not add. For this to happen, we must check the counter first. This is exactly how a 'whiledo' loop performs. (b) A possible solution: Alternate Solution: We can use a looping state, but we must be careful to coordinate the decrementing of the counter and loading of the product register. ECE 212 HW 3 SOLUTIONS p 3 of 10 3. Shown below is a Data Path and State Transition Diagram for Algorithm A....
View
Full
Document
This homework help was uploaded on 04/17/2008 for the course ECE 212 taught by Professor Greco during the Spring '08 term at Lafayette.
 Spring '08
 greco

Click to edit the document details