星期三, 9月 12, 2007

EE 2000 Logic Circuit Design - Semester A, 2007/08 - Tutorial 1

EE 2000 Logic Circuit Design,
Semester A, 2007/08
Tutorial 1
Week 2 (12th September, 2007)
The questions are divided into two levels. Level 1 is the basic level question. You should
be able to answer them after completing the lecture. Level 2 is the advanced level
question. You may have to take a research before answering them. Please be prepared
before the tutorial.
Level 1
Question 1: Complete the following table by converting the below numbers to decimal,
binary, octal and hexadecimal number systems.

DecimalBinaryOctalHexadecimal
2711011331B
237.2511101101.01355.2ED.4
250.81111 1010.1100 1100…372.6314 6314…FA.CC…


Question 2:
(a) What is the largest binary number that can be obtained with 16 bits?
(1111 1111 1111 1111)2

(b) What is its decimal equivalent?
 215 + 214 + … + 21 + 20 = 216 – 1 = 65535

Question 3: Find the 1's and 2's complements of the following 8-digit binary numbers:

(a) 0010 1010
1101 0101 (1’s complement)
1101 0110 (2’s complement)

(b) 1111 1111
0000 0000 (1’s complement)
0000 0001 (2’s complement)


Question 4: Perform the arithmetic operations (-128) + (-1) in binary using

(a) 8-bit signed 2's complement representation for negative numbers

-128 = 1000 0000;
-1 = 1111 1111;
(-128) + (-1)
= 1000 0000 + 1111 1111
= (1) 0111 1111
Discard carry, we get 0111 1111
(Result incorrect. Overflow because –ve + -ve becomes +ve)

(b) 9-bit signed 2’s complement representation for negative numbers
Does overflow happen? Why?

-128 = 1 1000 0000;
-1 = 1 1111 1111;
(-128) + (-1)
= 1 1000 0000 + 1 1111 1111
= (1) 1 0111 1111
Discard carry, we get 1 0111 1111 (= -129)
(No overflow as –ve + -ve gives a –ve number)


Level 2
Question 5: Please calculate a + b, a - b, a · b, and a / b for the pair of binary numbers a
= 10101 and b = 1011 without converting to decimal (Show your work and the carries)



A = 10101, B = 1011
  11110
   10101
+)  1011
 100000 a + b = 100000

01010
 10101
-) 1011
   1010 a - b = 1010 (You can get the same result if using 2’s complement)

      10101
x)     1011
10101000
              0
    101010
      10101
11100111 a · b = 11100111

                 01
1011 ) 10101
             1011
               1010 a / b: quotient = 1, remainder = 1010






Question 6: Determine the value of x if (211)x = (152)8.


(211)x = (152)8
2 · x2 + 1 · x + 1 = 1 · 82 + 5 · 8 + 2
2x2 + x – 105 = 0
(2x + 15)(x – 7) = 0
∴ x = 7 (x must be a positive integer so cannot be -7.5)


Question 7: Formulate a simple procedure for converting base-4 numbers directly to
hexadecimal number. Use the procedure to convert (12321)4 to base 16. (Hints: 42 = 16)

Partition the digits into groups of 2 each (one hex digit = 2 base-4 digits)
Add necessary 0s to the left and right
Replace each group of base-4 digits by the hex equivalent
So, (12321)4
= (01 23 21)4 (Note: 234 = 2·41+ 3·40 = 11 = B16)
= (1 B 9)16

Question 8: In the lecture, we only discuss the r’s-complement and (r-1)’s-complement
of an integer number. Find the 1’s complement and 2’s complement of the following
fractional binary numbers.
(a) 010.11

1’s complement: 23 - 010.11 - 2-2 = 101.00
                                2’s complement: 23 - 010.11 = 101.01


(b) 11011.100


1’s complement: 25 - 11011.100 - 2-3 = 00100.011
                                 2’s complement: 25 - 11011.100 = 00100.100

沒有留言:

張貼留言