Вы находитесь на странице: 1из 6

HW1 Solution

Problems:
1. Convert the following numbers into binary, octal and hex.
a) 43
b) 102
Ans:
Number

binary

octal

hex

43

101011

53

2B

102

1100110

146

66

2. Perform binary addition with the following twos complement numbers, and check whether
these operations generate an overflow or not using the two methods discussed in the course.
Assume signed integers.
a) 1001 + 0111
Ans: 1001 + 0111 = 0000
Bit Position
4
C (Carry)
1
A (Num 1)
B (Num 2)
S (Sum)
1

3
1
1
0
0

2
1
0
1
0

1
1
0
1
0

0
0
1
1
0

2
0
0
1
1

1
1
0
0
1

0
0
1
1
0

Method 1:
No
A3B3S3 + A3B3S3 = 1.0.1 + 0.1.0 = 0
Number with opposite signs added
Method 2:
No

C3 xor C4 = 1 xor 1 = 0
Carry in and carry out in sign bit matched

b) 1001 + 1101
Ans: 1001 + 0111 = 0110
Bit Position
4
C (Carry)
1
A (Num 1)
B (Num 2)
S (Sum)
1

3
0
1
1
0

Method 1:
Yes!!
A3B3S3 + A3B3S3 = 1.1.1 + 0.0.0 = 1
Two negative numbers added and we got positive number!!!
Method 2:
Yes!!

C3 xor C4 = 0 xor 1 = 1
Carry in and carry out in sign bit mismatched!!

3. Perform operations listed by first converting all numbers to binary and using +,-,*, / methods
presented in class. The base of each number is shown as a subscript, 16=hex, 10=decimal,
8=octal, 2=binary. Assume unsigned integers.
a)

12C16 + 4010

b) 1C916 - 11101012
c) AA16 * 248
d)

D4816 / 10102

Ans:
Problem

Original Form

Binary Form

Result

a)

12C16 + 4010

1001011002 + 1010002

1010101002

b)

1C916 - 11101012

1110010012 - 11101012

1010101002

c)

AA16 * 28

101010102 * 102

1010101002

d)

4810 / 10102

1100002 / 010102

1002

a)

Addition
1001011002
1010002
___________________________
1010101002

b)

Subtraction
1110010012
11101012
_________________________

Making them to have same number of digit

1110010012
0011101012

Getting Twos complement of 0011101012


1100010102 ( 1s Complement )
12

(Adding 1)

_________________________
1100010112

Subtraction through addition


1110010012
1100010112

(2s complement of the original number)

_________________________
1010101002
c) Multiplication
101010102
102
_________________________
0 0 0 0 0 0 0 02
1 0 1 0 1 0 1 02
_________________________
1 0 1 0 1 0 1 0 02
Just follow the same procedure that you do in decimal

d) Division
Iteration #
1

Dividend
110000
1010

Quotient
0+
1

100110
1010

1+
1

11100
1010

10+
1

10010
1010

1000

11+
1

100

Scratch (2s Complement)


0001010
1110101 (1sComplement)
0000001 (add 1)
1110110 (2s Complement)
0001010
1110101 (1sComplement)
0000001 (add 1)
1110110 (2s Complement)
001010
110101 (1sComplement)
000001 (add 1)
110110 (2s Complement)
001010
110101 (1sComplement)
000001 (add 1)
110110 (2s Complement)
Dividend smaller than Divisor

Scratch (Addition)
0110000
1110110
1 |0100110 (No overflow)
0100110
1110110
1 |0011100 (No overflow)
011100
110110
1|010010 (No overflow)
010010
110110
1|001000(No overflow)
DONE !!

4. Prove the following Boolean equation using axioms of Boolean algebra; list what axiom you
used.
a) XY +XZ + YZ = XY+XZ
Ans:
LHS
= XY + XZ + YZ
= XY +XZ + YZ.1

Identity

= XY + XZ + YZ (X + X)

Complement

= XY + XYZ + XZ + XZY

Distributive, Commutative

= XY (1 + Z) + XZ ( 1 + Y )

Distributive

= XY .1+ XZ.1

Null Element

= XY + XZ

Identity

= RHS

b) (X+Y)(X+Y)(Y+Z)(Y+W)X = YX
Ans:
LHS
= (X+Y)(X+Y)(Y+Z)(Y+W)X
= (Y+X)(Y+X)(Y+Z)(Y+W)X

Commutative

= (Y+XX) (Y+ZW ) X

Distributive

= (Y+0 ) ( Y+ ZW ) X

Complements

= Y(Y+ZW)X

Identity

= YX

Covering

= RHS

5. Draw the schematics of the following functions using the minimum number of NAND,
NOR, AND, OR, and NOT gates
a) XY + XZ
Ans:

b) (X + Y) (Y + Z) (X + Z)
Ans:
Using simplification we find:
f (X,Y,Z)
= (X + Y) (Y + Z) (X + Z)
= (Y + XZ)(X+Z) Distributive
=YX + YZ + XXZ + XZ Distributive

= YX + YZ + XZ Complements, Null element


= XY + XZ + YZ (X+X) Complements, Commutative
= XY + XZ +XYZ +XYZ Distributive
= XZ(Y+1) + XY(1+Z) Commutative, Distributive
= XZ + XY Null Element

Вам также может понравиться