CMPT-150 Assignment 1 *** SOLUTIONS *** (40 marks total)
Available Wednesday, May 9, 2001
Due Wednesday, May 23, 2001
Due by 12:00 noon on Wednesday, May 23, in the CMPT-150-ARC drop boxes outside K9507. Make sure you put your assignment in the box labeled for CMPT-150-ARC.
Question 1.(4 marks, 2 for each) Convert the following numbers to binary, using successive division and successive multiplication. Show your work.
SOLUTION
(a)
Separate the number into fractional part and integer part, and convert each part separately.
1875/2 = 937 r 1
937/2 = 468 r 1
468 / 2 = 234 r 0
234 / 2 = 117 r 0
117 / 2 = 58 r 1
58 / 2 = 29 r 0
29 / 2 = 14 r 1
14 / 2 = 7 r 0
7 / 2 = 3 r 1
3 / 2 = 1 r 1
1 / 2 = 0 r 1
0.1875 * 2 = 0.375
0.375 * 2 = 0.75
0.75 * 2 = 1.5
0.5 * 2 = 1.0
So 1875.187510 = 11101010011.00112.
(b)
Separate the number into fractional part and integer part, and convert each part separately.
13 / 2 = 6 r 1
6 / 2 = 3 r 0
3 / 2 = 1 r 1
1 / 2 = 0 r 1
2/7 * 2 = 4/7 = 0 4/7
4/7 * 2 = 8/7 = 1 1/7
1/7 * 2 = 2/7 = 0 2/7
2/7 * 2 = 4/7 = 0 4/7
4/7 * 2 = 8/7 = 1 1/7
etc...
so 13 2/7 = 1101.¯0¯1¯0
(Note. <SUP>¯</SUP>1 => ¯1 is as good as I can do for overline in html.
If anyone has any ideas on how to do overline better than that, please
let me know.
Question 2.(4 marks, 2 for each)
SOLUTION
(a)
First, convert to binary, then re-organize in groups of 4.
2510.724 = 010 101 001 000 . 111 010 100 = 0101 0100 1000 . 1110 1010 = 548.EA
(b)
First, convert to binary, then re-organize in groups of 3.
FACE.951 = 1111 1010 1100 1110 . 1001 0101 0001 = 001 111 101 011 001 110 . 100 101 010 001 = 175316.4521
Question 3.(2 marks) Answer problem 1-3 from the text.
SOLUTION
Problem 1-3 (a) asks for the largest binary integer in 8 bits.
1111 1111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Note that this is 28-1.
(b) asks for the largest binary integer in 32 bits.
232-1 = 4,294,967,295.
Question 4. (9 marks)We have looked at number systems in base 2, 8, and 16. Another common base that we use every day is base 60, for time measurement.
SOLUTION
(a)
We need 60 different symbols. If we start with 10 numerical digits, then use the 26 upper case letters and the
first 24 lower case letters, we will have enough symbols. Counting from 0 to 60 would then look like this:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,10
You could also use greek letters, colours, and any other single-digit symbols you can find. It's probably not a good
idea to use any punctuation or spaces, because those symbols are used in mathemtics for other things. For example, if
you used "+" to represent a number, how would you represent addition?
Also, it is important to restrict your symbol system to a
single character per symbol. A base-60 symbol system using "10"
to represent the symbol after "9" would be confusing and problematic for math.
(b)
Converting first to Decimal, then to base-60:
(1) 2008 = 12810
128 / 60 = 2 r 8
2 / 60 = 0 r 2
So 2008 = 2860
(2) 4510 = j60 (the 46th symbol)
(3) FF16 = 25510
255/60 = 4 r 15
4 / 60 = 0 r 4
so FF16 = 4F60
(c)
Advantages: Reduces the number of digits, digital clocks will be smaller, Math would be easy because base-60 has many factors (2,3,4,5,6 etc)
Disadvantages: Lots of symbols makes it hard to get a feel for number values, difficult to work with a large symbol base, etc. For computers, 60 is not a power of 2 so some translation would be necessary.
Question 5. (15 marks, 3 for each) Answer problem 2-6 from the text.
a) ABC+AB¯C+¯AB
=AB(C+¯C) +¯AB (distributive)
=AB+¯AB (Identity)
=B(A+¯A) (distributive)
=B (identity)
b) (¯A¯+¯
B¯)(¯A+¯B)
=(¯A¯B)(¯A+¯B) (Demorgan)
=¯A(¯A¯B)+¯
B(¯A¯B)(Distributive)
=¯A¯B + ¯A¯B (duplicaiton)
=¯A¯B (Duplication)
c) ¯ABC+AC
=C(¯AB+A) (Distributive)
=C(¯AB+A(B+¯B)) (Identity)
=C(¯AB+AB+A¯B) (Distributive)
=C(¯AB+AB+AB+A¯B) (Duplication)
=C((¯A+A)B +A(B+¯B)) (Distributive)
=C(B+A) (Identity)
d) BC + B(AD + A¯D)
=BC+B(A(D+¯D)) (Distributive)
=BC+BA (Identity)
=B(C+A) (Distributive)
e) (A+¯B+A¯B)(AB+¯AC+BC)
Take first sum term: (A+¯B+A¯B)
=(A+A¯B+¯B+A¯B)(Duplication)
=(A+¯B) (Absorption)
Take second sum term: (AB+¯AC+BC)
=(AB+¯AC+BC(A+¯A)) (identity)
=(AB+ABC+¯AC+¯ABC) (commutative)
=(AB+¯AC) (absorption)
Now take both simplified sum terms together:
(A+¯B)(AB+¯AC)
=AAB+¯BAB+A¯AC + ¯B¯AC (distributive)
=AB+¯B¯AC (absorption, identity)
Question 6. (6 marks) Answer problem 2-13(b) from the text. Use DesignWorks or LogicWorks for your circuit diagram. Also answer the following questions about the circuit:
