Professional Documents
Culture Documents
1) Convert the following numbers from the given base to the bases indicated:
(a) Decimal 255.225 to binary, octal, and hexadecimal.
(b) Hexadecimal 2AC5.D to decimal, octal, and binary.
(c) Hexadecimal EF.C to base 5
(d) Binary 1010101111.01101 to base 3
Solution:
(b) (2AC5.D)H:
In decimal: 2x163+10x162+12x161+5x160+13x16-1 = (10949.8125)10
In binary: (0010 1010 1100 0101 . 1101)2 – through direct translation of hex digits
In Octal: (25305.64)8 – the binary digits takes in threes are translated to octal digits
HW_1_coe_081_202_02_sol.doc Page 1 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
2) Perform the following unsigned arithmetic operations using the designated bases without
converting to decimal. Verify your result by converting the numbers to decimal and then
performing the operation in decimal.
(a) (10111011)2 – (01001111)2
(b) (10E)16 – (13F)16
(c) (54)16 * (20)16
(d) (11011.0111)2 + (11.1101)2
Solution:
(a)
1 0 1 1 1 0 1 1 Æ 187
- 0 1 0 0 1 1 1 1 Æ - 79
------------------ -----
0 1 1 0 1 1 0 0 Æ 108
One can check that (110 1100)2 = (108)10.
(d)
1 1 0 1 1 . 0 1 1 1 Æ 27.4375
+ 1 1 . 1 1 0 1 Æ 3.2500
----------------------- -------
1 1 1 1 1 . 0 1 0 0 Æ 31.2500
To check, (11111.0100)2 is indeed equal to sum (31.25)10.
HW_1_coe_081_202_02_sol.doc Page 2 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
Solution:
(a) (121)r = (25)10 Î r2 + 2r + 1 = 25 Î r2 + 2r – 24 = 0 Î (r+6)(r-4) = 0;
Therefore, r = 4.
The required base is 4.
4) Show how the decimal integers +120 and -120 would be represented in signed magnitude, 1’s
complement, and 2’s complement notation using 8 bits and 10 bits, respectively.
Solution
8 bits 10 bits
+120 -120 +120 -120
0111 1000 1111 1000 00 0111 1000 10 0111 1000
Signed magnitude
0111 1000 1000 0111 00 0111 1000 11 1000 0111
1’s complement
0111 1000 1000 1000 00 0111 1000 11 1000 1000
2’s complement
HW_1_coe_081_202_02_sol.doc Page 3 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
5) Perform the operations M+N, M-N, and N-M using both radix and diminished radix
complement systems using the specified number of digits. Specify when an overflow condition
has occurred.
(a) n = 4, M = (A2B)16, N = (56C)16
(b) n = 3, M = (821)10, N = (785)10
(c) n = 8, M = (10010)2, N = (11011)2
(d) n = 6, M = (10010)2, N = (10011)2
Solution:
--------------------------------------------------------------------------------------------------
HW_1_coe_081_202_02_sol.doc Page 4 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
The result 606 is correct. Note -179 + (-215) = -394 which is 606 in n = 3 and 10’s complement
system.
M - N = M + N’ = 821 + 215 = 036 and the end carry is ONE. No overflow. Ignore carry.
The result 036 is correct. Note -179 – (-215) = 36 which is 036 in n = 3 and 10’s complement
system.
N – M = N + M’ = 785 + 179 = 964 and the end carry is ZERO. No overflow
The result 964 is correct. Note -215 – (-179) = - 36 which is 964 in n = 3 and 10’s complement
system.
--------------------------------------------------------------------------------------------------
HW_1_coe_081_202_02_sol.doc Page 5 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
The result (1111 0110)2 is correct. Note 18 - 27 = -9 which is (1111 0110)2 in n = 8 and 1’s complement
system.
N – M = N + M’ = (0001 1011)2 + (1110 1101)2 = (0000 1000)2 and the end carry is ONE. No overflow.
Need to correct result Î (0000 1000)2 + 1 (end carry) = (0000 1001)2
The result (0000 1001)2 is correct. Note 27 - 18 = 9 which is (0000 1001)2 in n = 8 and 1’s
complement system.
--------------------------------------------------------------------------------------------------
HW_1_coe_081_202_02_sol.doc Page 6 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
6) A microcontroller uses 16-bit registers. Give the following in both binary and decimal:
(a) The maximum unsigned integer number that can be stored.
(b) The smallest (negative) number and the largest (positive) number that can be
stored using the sign-magnitude notation.
(c) The smallest (negative) number and the largest (positive) number that can be
stored using the 2`s complement notation.
Solution:
n = 16, R = 2
(i) maximum unsigned integer = (1111 1111 1111 1111) = 216 – 1 = 65535.
(ii) For signed magnitude representation – MSB is reserved for sign Î remaining = 15 bits for
magnitude
Î smallest negative integer = -(215-1) = -32767
Î largest positive integer = +(215-1) = +32767
(iii) Using 2’s complement:
smallest negative integer = -216-1 = 32768,
largest positive integer = +(216-1 -1) = 32767
Solution:
a) LHS = x’y’ + xy + x’y = x’y’ + xy + x’y + x’y = x’(y’+y) + y(x’+x)
= x’ + y
= RHS
b) LHS = x’y + xy’ + xy + x’y’ = x’(y+y’) + x(y’+y) = x’ + x = 1
= RHS
c) LHS = xy’ + y’z’ + x’z’ = xy’z + xy’z’ + xy’z’ + x’y’z’ + x’y’z’ + x’yz’
= xy’z + xy’z’ + x’y’z’ + x’yz’
= xy’(z+z’) + x’z’(y’+y) = xy’ + x’z’
= RHS
HW_1_coe_081_202_02_sol.doc Page 7 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
Solution:
a) F’ = (xy+z)’ = (xy)’ z’ = (x’+y’) z’
10) Derive the truth table and draw the logic diagram of the following function:
A B C D BC’ AB ACD F
f(A,B, C, D) = BC’ + AB + 0 0 0 0 0
ACD 0 0 0 1 0
0 0 1 0 0
Solution: 0 0 1 1 0
0 1 0 0 1 1
a) 0 1 0 1 1 1
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1 1
1 1 0 0 1 1 1
1 1 0 1 1 1 1
1 1 1 0 1 1
1 1 1 1 1 1 1
HW_1_coe_081_202_02_sol.doc Page 8 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
11) For the Boolean functions E and F, as given in the following truth table:
a) List the minterms and the maxterms of each function X Y Z E F
0 0 0 1 0
b) List the minterms of E and F
0 0 1 1 0
c) List the minterms of E + F and EF 0 1 0 1 1
d) Express E and F in the sum-of-minterms algebraic form 0 1 1 0 1
number of literals 1 0 1 1 0
1 1 0 0 1
1 1 1 0 1
Solution:
a) E(X,Y,Z) = m0+m1+m2+m5, F(X,Y,Z) = m2+m3+m6+m7
E(X,Y,Z) = M3.M4.M6.M7 F(X,Y,Z) = M0.M1.M4.M5
d) E ( X , Y , Z ) = X Y Z + X Y Z + X Y Z + X Y Z ,
F ( X , Y , Z ) = X Y Z + X YZ + XY Z + XYZ
YZ
00 01 11 10
X
0 1 1 0 1
1 0 1 0 0
YZ
00 01 11 10
X
0 0 1 1 0
1 0 1 1 0
HW_1_coe_081_202_02_sol.doc Page 9 of 10
Dr. Ashraf S. Hasan Mahmoud Nov 9th, 2008
12) Convert the following expressions into sum-of-products and product of sums forms:
a) (AB+C)(B+C’D)
b) X’+X(X+Y’)(Y+Z’)
c) (A+BC’+CD)(B’+EF)
Solution:
HW_1_coe_081_202_02_sol.doc Page 10 of 10