Docsity

Homework 4 Solutions - Discrete Math | EECS 203, Assignments of Discrete Mathematics

Toggle sidebar
bg1
EECS 203 Homework 4 Solutions
3. (5 pts)
(a) 39 = (27)16
(b) 21 = (15)16
(c) 126 = (7E)16
(d) 119 = (77)16
4. (5 pts)
Decimal Sign Magnitude 2โ€™s Complement Sign Mag. (8-bit) 2โ€™s Comp. (8-bit)
-12 11100 10100 1000 1100 1111 0100
34 0100010 0100010 0010 0010 0010 0010
-6 1110 1010 1000 0110 1111 1010
7 0111 0111 0000 0111 0000 0111
5.
(a) (10 pts)
a2 a1 a0 b2 b1 b0
a2โ€™ a1โ€™ a0โ€™ b2โ€™ b1โ€™ b0โ€™
SubtractAdd /
s3โ€™ s2โ€™ s1โ€™ s0โ€™
overflow
s3 s2 s1 s0
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
i2 1
i i1 0
i i0
0 0 0
i
2โ€™ i1โ€™ i0โ€™
FA FA FA
2:1
MUX 2:1
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
pf3
pf4

Partial preview of the text

Download Homework 4 Solutions - Discrete Math | EECS 203 and more Assignments Discrete Mathematics in PDF only on Docsity!

EECS 203 Homework 4 Solutions

  1. (5 pts) (a) 39 = (27) 16 (b) 21 = (15) (^16) (c) 126 = (7E) (^16) (d) 119 = (77) 16
  2. (5 pts) Decimal Sign Magnitude 2โ€™s Complement Sign Mag. (8-bit) 2โ€™s Comp. (8-bit) -12 11100 10100 1000 1100 1111 0100 34 0100010 0100010 0010 0010 0010 0010 -6 1110 1010 1000 0110 1111 1010 7 0111 0111 0000 0111 0000 0111

(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 โ€™

FA FA FA

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.

  1. (15 pts) The sign bit is simply an XOR of the two input sign bits. And 1-bit multiplication in binary is the same as using an AND gate. Hence, using the math shown below on the right, we can implement the following function drawn on the left.

a 1 a 0 x b 1 b 0 a 1 b 0 a 0 b 0

  • a 1 b 1 a 1 b 0 p 3 p 2 p 1 p 0

p 4 = a 2 XOR b 2

  1. (10 pts) This answer can vary. It may help to use a Karnaugh map. Examples of three possible solutions are shown below with the corresponding Karnaugh map traversal shown on the right.

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)

FA FA FA

a 2 b 2 a 1 b 1 a 0 b (^0)

p 4 p 3 p 2 p 1 p (^0)

HA HA

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

  1. (10 pts) Other solutions are possible, simply by โ€œbubble-pushingโ€ this solution

CLK S R Qโ€™ 0 X X Q 1 0 0 Q 1 0 1 1 1 1 0 0 1 1 1 undef.

  1. (10 pts) ai bi CLK RESET

c (^) in c (^) out

s (^) i

Full Adder

Reset D Q