CSE370 Quiz 3 (6 November) Solution
 

Using only two 4-bit adders construct a circuit to compute the expression 3x + 2y + z where x is a 2-bit number (x0 and x1), y is a 2-bit number (y0 and y1), and z is a 1-bit number (z0). The 4-bit adders are similar to those you designed for assignment #5 with two 4-bit numbers and a carry as inputs and a 4-bit sum as output. Make sure to clearly label all inputs and outputs.
 

We can easily add 2x + 2y + z by lef shifting x and y by 1 bit (equivalent to multiplying by 2) and using the carry input of the 4-bit adder for z.  The result can then be added with x to yield 3x + 2y + z by using the second 4-bit adder.  Note that only the carry-out of the second adder is significant as there can be no carry out from the first adder since the maximum value of 2x + 2y + z is 2(3) + 2(3) + 1 which is equal to 13.

Of course, there are many other possible solutions including: using one of the low-order bit inputs of the first adder instead of the carry-in for z0, forming x + y in the first adder and then x + 2(x + y) + z in the second, etc..


Comments to: cse370-webmaster@cs.washington.edu (Last Update: )