


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



EECS 203 Homework 4 Solutions
(a) (10 pts)
a2 a1 a0 b2 b1 b
a2โ a1โ a0โ b2โ b1โ b0โ
Add / Subtract
s3โ s2โ s1โ s0โ overflow
s3 s2 s1 s
The 2โs Complement Adder-Subtractor is shown in Problem 5(b).
The Sign-Magnitude to 2โs Complement Converter is same as the 2โs Complement to Sign- Magnitude Converter, and the 3-bit version is shown below. The 4-bit version is just an extension of this with an extra 2:1 MUX and Full-Adder
i 2 i 1 i 1 i 0 i (^0)
i 2 โ i 1 โ i 0 โ
2: MUX
2: MUX
Sign-Magnitude to 2โs Complement Converter
2โs Complement Adder-Subtractor
Sign-Magnitude to 2โs Complement Converter
2โs Complement to Sign- Magnitude Converter
The Full Adder is implemented as shown below. Half Adders could also be used, but for the sake of minimizing different functional pieces in the design, Iโve chosen to use only Full Adders.
(b) (5 pts) Shown below is a 3-bit Ripple Carry 2โs Complement Adder/Subtractor with the Full Adder used above.
a 1 a 0 x b 1 b 0 a 1 b 0 a 0 b 0
p 4 = a 2 XOR b 2
a b sum
cout
cin
b 2 a 2 b 1 a 1 b 0 a (^0) sign
c 2 c 1 c 0
o 3 o 2 o 1 o (^0)
a 2 b 2 a 1 b 1 a 0 b (^0)
p 4 p 3 p 2 p 1 p (^0)
Decimal Answer 1 Answer 2 Answer 3 0 000 000 000 1 001 100 010 2 101 101 011 3 111 001 001 4 011 011 101 5 010 111 111 6 110 110 110 7 100 010 100
a\bc 00 01 11 10
0
S Q
CLK
Q
R
CLK S R Qโ 0 X X Q 1 0 0 Q 1 0 1 1 1 1 0 0 1 1 1 undef.
c (^) in c (^) out
s (^) i
Full Adder
Reset D Q