Problem Solving

advertisement
Problem Solving
Problem 1:
Use the repeated subtraction method to convert the number 91 to binary (show your conversion steps clearly).
What would be the representation of (-91)10 in an 8-bit binary signed magnitude form?
91 – 64 = 27; 27 – 16 = 11 ; 11 – 8 = 3 ; 3 - 2 = 1 ; 1 – 1 = 0
(91)10 = (01011011)2
In an 8-bit signed magnitude form: (-91)10 = (11011011)2
Problem 2:
Convert the following binary numbers to the destination base (show your conversion steps clearly):
a) (1011.11000)2 = ( 11.75)10
b) (111110110001)2 = ( FB1 )16
Problem 3:
A computer system uses a simplified 14-bit floating point with excess-16 bias to represent binary numbers.
What are the least and the biggest binary number handled by this computer? (Give the numbers in a scientific
binary representation)
The least binary number: -0.11111111x215
The biggest binary number: +0.11111111x215
Problem 4:
Use only two input gates to draw the logical diagram of the following Boolean expression: F(x,y,z) = π‘₯Μ… 𝑦 +
π‘₯Μ… 𝑦𝑧 + Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
(𝑦 + 𝑧). Simplification is not allowed.
Problem 5: Binary representation systems
Consider the binary number 10110100. What does this binary number represents in decimal (base 10) when it is
used in:
a) An 8-bit unsigned whole numbers system?
(10110100)2 = (180)10
b) An 8-bit signed magnitude system?
(10110100)2 = (-52)10
c) An 8-bit one’s complement system?
(10110100)C1 = -(01001011)2 = -(75)10
d) An 8-bit two’s complement system?
(10110100)C2 = -(01001100)2 = -(76)10
Problem 6: Explaining an advertisement
The detailed specifications of a laptop are:
 Intel Core i3 / 2.2 GHz
Intel Core i3: The processor type
2.2 GHz: Processor’s speed or processor’s clock speed
 4 GB ( 2 x 2 GB) DDR2 SDRAM
DDR2 SDRAM: Main memory type (RAM type)
4 GB (2 x 2 GB): The main memory capacity is 4GB. It is divided into two parts (two 2GB chips)
 500 GB HDD / 5400 rpm
Hard disk capacity is 750GB
Disk rotation speed is 5400 round per minute
 15.6-inch, 1366 x 768 ( HD )
Monitor resolution is 1366x768 pixels
The size of the monitor is 15.6 inches
 VGA ¦ 2 x headphone output ¦ Microphone input ¦ 2 x USB 2.0 ¦ 2 x USB 3.0 ¦ LAN ¦ HDMI
External ports
Problem 7: Combinational and sequential logic
Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
Μ… + 𝑐) + Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
Μ… + 𝑐̅).
Consider the Boolean expression F(a,b,c) = π‘ŽΜ…π‘π‘ + (𝑏
(𝑏 + 𝑐̅) + π‘Ž(𝑏
a) Use DeMorgan’s law to convert F(a,b,c) to a sum of products form.
F(a,b,c) = π‘ŽΜ…bc + b𝑐̅ + 𝑏̅c + abc
b) Draw the truth table of F(a,b,c).
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
F(a,b,c)
0
1
1
1
0
1
1
1
c) Use Boolean identities and Boolean algebra to simplify F. Show your simplification steps clearly.
Hint: Your answer should contain only two terms.
F(a,b,c) = a’bc + bc’ + b’c + abc =
a’bc + abc + bc’ + b’c =
bc(a+a’) + bc’+b’c =
bc+bc’+b’c =
b(c+c’) + b’c =
b + b’c =
(b + b’) (b + c) =
b + c.
Problem 8:
The capacity of a recent external hard disk drive is 2 Terabytes (TB). How many Gigabytes (GB) and Kilobytes
(KB) are there in this hard disk drive?
2 TB = 2 x 103 GB ≈ 2 x 210 GB
2 TB = 2 x 109 KB ≈ 2 x 230 KB
(The student can represent his answer is a power of 2 or a power of ten. Both can be considered as
correct.)
Problem 9:
Express the number -33 in an 8-bit Complement one and complement two binary forms.
-33 = -(001000012) = 11011110C1
-33 = -(001000012) = (11011110 + 1)2 = 11011111C2
Problem 10: Signed Magnitude representation and arithmetic
A computer uses an 8-bit Signed Magnitude system to represent numbers.
a. What is the decimal equivalent of the following binary numbers: 000010012 and 000111002?
00001001SM = +(000010012) = +(8+1)10 = +910
00011100SM = +(000111002) = +(16+8+4)10 = +2810
b. Use signed magnitude arithmetic to add 000010012 to 000111002.
We are adding two positive numbers the result is also positive. The results’ sign bit is “0” and we should
add 0001001 to 0011100
sign
Carries:
0
1
1
0
0
0
0
0
0
0
1
1
1
0
0
0
+ 0
0
0
1
0
0
1
0
0
1
0
0
1
0
1
The result is: 001001012 = + 3710
c. Does the system overflow in the previous question (Problem 1-b)? Why/Why not?
We are adding 9 to 28, the result is 37 which is less than 127, so there is no overflow.
Problem 11: Boolean Algebra
Consider the following Boolean function: F(a,b,c)=π‘ŽΜ…π‘Μ…π‘Μ… + π‘Žπ‘Μ….
a. Use DeMorgan’s law, other Boolean identities and Boolean algebra to find the complement 𝐹̅ of the
function F. You should also represent 𝐹̅ in its simplest sum of products form.
Μ…Μ…Μ…Μ…Μ…
Μ…Μ…Μ…Μ…) = (π‘Ž + 𝑏 + 𝑐). (π‘ŽΜ… + 𝑏)
Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
𝐹(π‘Ž, 𝑏, 𝑐) = Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…Μ…
π‘ŽΜ…π‘Μ…π‘Μ… + π‘Žπ‘Μ… = (π‘Ž
̅𝑏̅𝑐̅). (π‘Žπ‘
= π‘Žπ‘ŽΜ… + π‘Žπ‘ + π‘π‘ŽΜ… + 𝑏𝑏 + π‘π‘ŽΜ… + 𝑐𝑏 =
0 + π‘Žπ‘ + π‘π‘ŽΜ… + 𝑏 + π‘π‘ŽΜ… + 𝑐𝑏 =
𝑏 + π‘π‘ŽΜ…
b. Draw the truth table of the function F and deduce the truth table of its complement function 𝐹̅ .
Hint: Including the terms π‘ŽΜ…π‘Μ…π‘Μ… ; π‘Žπ‘Μ…π‘ ; F and 𝐹̅ is quite enough.
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
π‘ŽΜ…π‘Μ…π‘Μ…
1
0
0
0
0
0
0
0
π‘Žπ‘Μ…
0
0
0
0
1
1
0
0
F
1
0
0
0
1
1
0
0
𝐹̅
0
1
1
1
0
0
1
1
c. Using the pre-drawn truth table give another sum of products form for the complement function 𝐹̅ .
Hint: One of the terms is π‘ŽΜ…π‘Μ…π‘ and still four other terms: 𝐹̅ = π‘ŽΜ…π‘Μ…π‘ + π‘₯π‘₯π‘₯ + π‘₯π‘₯π‘₯ + π‘₯π‘₯π‘₯ + π‘₯π‘₯π‘₯
𝐹̅ = π‘ŽΜ…π‘Μ… 𝑐 + π‘ŽΜ…π‘π‘Μ… + π‘ŽΜ…π‘π‘ + π‘Žπ‘π‘Μ… + π‘Žπ‘π‘
Problem 12:
Using a "word" of 3 bits, list all of the possible signed binary numbers and their decimal equivalents that are
representable in a Signed magnitude system.
011 to111, or +3 to -3
Problem 13:
Draw the truth table of π‘₯𝑦
Μ…Μ…Μ… and π‘₯Μ… +𝑦̅ to prove that the following DeMorgan's Laws is valid: π‘₯𝑦
Μ…Μ…Μ… = π‘₯Μ… +𝑦̅.
x
y
(xy)'
x' + y'
0
0
1
1
0
1
1
1
1
0
1
1
1
1
0
0
Since π‘₯𝑦
Μ…Μ…Μ… and π‘₯Μ… +𝑦̅ present the same truth table, they are logically equivalent
Problem 14: Boolean Algebra and digital logic
The following table is the truth table of a function F.
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
F(a,b,c)
1
0
1
0
0
0
0
0
a) Give the Boolean expression of the function F(a,b,c) in a sum of products form.
F(a,b,c) = π‘ŽΜ…π‘Μ…π‘Μ… + π‘ŽΜ…π‘π‘Μ…
b) Draw the truth table of the complement 𝐹̅ of the function F. Deduce 𝐹̅ in a sum of products form.
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
Μ… (a,b,c)
F(a,b,c) 𝑭
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
𝐹̅ = π‘ŽΜ…π‘Μ… 𝑐 + π‘ŽΜ…π‘π‘ + π‘Žπ‘Μ…π‘Μ… + π‘Žπ‘Μ…π‘ + π‘Žπ‘π‘Μ… + π‘Žπ‘π‘
c) Use Boolean algebra and Boolean identities to simplify 𝐹̅ to its simplest form.
𝐹̅ = π‘ŽΜ…π‘Μ… 𝑐 + π‘ŽΜ…π‘π‘ + π‘Žπ‘Μ…π‘Μ… + π‘Žπ‘Μ…π‘ + π‘Žπ‘π‘Μ… + π‘Žπ‘π‘ =
π‘ŽΜ…π‘(𝑏 + 𝑏̅) + π‘Žπ‘Μ…(𝑐 + 𝑐̅) + π‘Žπ‘(𝑐 + 𝑐̅) =
π‘ŽΜ…π‘ + π‘Žπ‘Μ… + π‘Žπ‘ =
π‘ŽΜ…π‘ + π‘Ž(𝑏 + 𝑏̅) =
π‘ŽΜ…π‘ + π‘Ž =
(π‘ŽΜ… + π‘Ž)(π‘Ž + 𝑐) =
π‘Ž+𝑐
Problem 15: Binary representations
Show how the number -127 is represented in binary using:
a) 8-bit Signed magnitude system
12710 = (1111111)2
In signed magnitude system: -12710 = 111111112
b) 8-bit two’s complement system
-12710 = -(01111111)2 = (10000000+1)C2 = 10000001C2
c) 14-bit floating point representation with excess 16 bias (1 sign bit, 5 bits exponent, 8 bits significand)
12710=11111112 = 0.1111111x27
Exponent = 7. With excess 16 bias: 7+16 = 2310 = 101112
Mantissa: 11111110
In floating point form: 1 10111 11111110
Problem 16:
Convert the following decimal fraction to binary with a maximum of four places to the right of the binary point:
57.55. Show your conversion steps clearly.
57.5510= 111001.10002
Problem 17:
Construct the XOR operator using only NAND gates.
Hint: x XOR y = ((x ' y)' (xy' )' )'
Problem 18: Boolean Algebra and digital logic
Μ…Μ…Μ… ) + π‘Žπ‘ + 𝑏
Consider the Boolean expression F= a(b+𝑐̅) + π‘ŽΜ…(𝑏𝑐̅
a) Use the distributive law and DeMorgan’s law to represent F in a sum of product form.
Μ…Μ…Μ… ) + π‘Žπ‘ + 𝑏 = π‘Žπ‘ + π‘Žπ‘Μ… + π‘ŽΜ…(𝑏̅ + 𝑐) + π‘Žπ‘ + 𝑏 = π‘Žπ‘ + π‘Žπ‘Μ… + π‘ŽΜ…π‘Μ… + π‘ŽΜ…π‘ + π‘Žπ‘ + 𝑏
F= a(b+𝑐̅) + π‘ŽΜ…(𝑏𝑐̅
b) Draw the truth table of F.
Μ…
a
c
F
b
ab
ac
̅𝒄
a𝒄̅
𝒂
̅𝒃
𝒂
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
0
1
1
1
0
0
0
1
0
1
0
1
0
0
1
0
0
0
1
1
1
0
0
0
0
0
1
1
0
1
1
1
1
0
0
0
1
1
1
1
1
0
0
0
1
c) Analyze your truth table, what can you deduce?
F is always 1. So the output is true whatever are the values of the inputs a, b and c.
d) What would be the most simplified version of F and its complement function 𝐹̅ ?
Hint: No need to do any simplification. Recall what you deduced in part c.
Problem 19: Binary representations and arithmetic
A computer system has two different ways to represent signed numbers: Signed magnitude and two’s
complement.
a) Show how this computer represents the number 7710in these two different binary systems (an 8-bit
signed magnitude and 8-bit two’s complement).
7710 = (64 +8 + 4 + 1)10=010011012
Since 77 is positive, 7710 = 01001101 in signed magnitude and two’s complement system.
b) Show how this computer represents the number (-42)10 in these two different binary systems (an 8-bit
signed magnitude and 8-bit two’s complement).
4210 = (32 + 8 + 2)10 =1010102
In signed magnitude system: -4210 = - (101010)2 = 101010102
In two’s complement system: -4210 = -(00101010)2 = (11010101+1)C2= 11010110C2
c) Show how this computer uses two’s complement arithmetic to add these numbers in binary (77 + (-42)).
Is there an overflow? Why or why not?
Carries
(+77)
(-42)
1
+
1
0
1
0
0
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
1
0
0
1
1
There is no overflow because the last two carries are identical.
1
0
1
Problem 20:
Convert the following binary numbers to the destination base.
a. (A4D.F)16 = (……………)2 ?
b. (732)8 = (……………)2 ?
Solution:
(A4D.F)16 = (1010 0100 1101.1111)2
(732)8 = (111 011 010)2
Problem 21: Binary representation systems
Consider the following decimal numbers: + 17 and -26.
A. Signed magnitude system:
a. How does an 8-bit signed-magnitude computer system represent these numbers in binary?
In an 8 bit signed magnitude system:
+17 = 000100012 (17 = 16 + 1)
-26 = 100110102 (26 = 16 + 8 +2)
b. Add these binary numbers in binary (in a signed magnitude system). Show your calculations clearly.
17 + (-26) = 17 – 26 = – (26 – 17) ; So the sign is negative and the sign bit of the result is “1”.
(10011010 – 00010001)2 = – (0011010 – 0010001 )2 = (100010012) = (-9)10
B. Two’s complement system:
a. How does an 8-bit two’s complement computer system represent these numbers in binary?
1710 = +(000100012)=00010001C2
-2610 = - (00011010) = (11100101 + 1)C2 = 11100110C2
b. Add these binary numbers in binary (in a two’s complement system). Show your calculations clearly.
Problem 22: A simple floating point system
A computer system uses a simplified 14-bit floating point with excess-16 bias to represent binary numbers.
a) How does this system represent the number -33 in binary? +33?
33 = (100001)2 = (0.100001)2 x 26
Exponent = 6 + 16 = 2210 = (10110)2; Mantissa: 10000100
+33 in floating point format (with excess 16) is: 01011010000100
-33 in floating point format (with excess 16) is: 11011010000100
b) How does this system represent the number 64 in binary?
64 = +(1000000)2 = + (0.1)2 x 27
Sign bit = 0; Exponent = 7 + 16 = 2310 = (10111)2; Mantissa: 10000000
Binary number in floating point format (with excess 16) is: 01011110000000
c) Show how can this system add +33 and 64 in binary? Represent your answer in a 14-bit floating point with
excess-16 bias form.
The first number is: +(0.100001)2 x 26 = (0.0100001)2 x 27
The second number is: +(0.1)2 x 27
The sum is given by: (0.0100001)2 x 27+ (0.1)2 x 27 = (0.0100001 + 0.1)2 x 27
The system adds: 0.0100001+0.1000000=0.1100001
The result is 0.1100001 x 27
Exponent 7 so in excess 16 bias: 2310 = 101112
The sum is: 0 10111 11000010
Verification: 0.110000102 x 27 = 11000012 = 9710. So Correct!
Problem 23: Boolean algebra
Consider the following Boolean function:
a) Draw the truth table of F(x,y,z).
Hint: No need for too many details in the truth table (x,y,z and F are enough)
b) Use Boolean identities and Boolean algebra to simplify F to its simplest form. Show your simplification
steps clearly.
c) Verify your answer by drawing the truth table of your simplified F.
d) Draw the logical diagram of your simplified F.
Solution:
Problem 24:
Convert the following binary numbers to the destination base. Show your conversion steps clearly.
a. (1001100)2 = (114)8
b. (011010101)2 = (D5)16 or (0D5)16
Problem 25:
Use the division remainder method to convert the number 115 to binary. Show your conversion steps clearly.
11510 = (1110011)2
2 |115 remainder 1
2 |57 remainder 1
2 |28 remainder 0
2 |14 remainder 0
2 |7 remainder 1
2 |3 remainder 1
2 |1 remainder 1
0
Problem 26:
Convert 0.0625 from base 10 to base 2. Show your conversion steps clearly.
0.0625 x 2 = 0.125; 0.125 x 2 = 0.25; 0.25 x 2 = 0.5; 0.5 x2 = 1.0
So, 0.062510 = (0.0001)2
Problem 27:
Construct an AND gate using only NAND gates. Put labels on your logical circuit to explain how you have
obtained the output “xy” from the inputs “x” and “y”.
Problem 28: Binary representations and arithmetic
Consider the decimal numbers -93.
a) Represent this number in an 8-bit binary signed magnitude form.
9310 = (01011101)2; In signed magnitude, -93 is hence: 11011101.
b) Represent this number in an 8-bit binary two complement’s form.
9310 = (01011101)2 = (10100011)C2
c) Use 8-bit two complement’s arithmetic to subtract 93 from 01100111 (+103). Show your calculations
clearly. Show the result in two complement and decimal form.
Hint: you should calculate 103 - 93.
103 – 93 = (01100111)C2 + (10100011)C2 = (00001010)C2 = (10)10
Problem 29: Boolean expressions and digital logic
The truth table of the Boolean expression F(a,b,c) is given below:
a) Give the Boolean expression F(a,b,c) in a sum of products form.
F(a,b,c) = a’b’c’ + a’bc’ + ab’c’ + ab’c + abc’ + abc
b) Use Boolean identities and Boolean algebra to simplify F. Show your simplification steps clearly.
Hint: Your answer should contain only two terms.
The most simplified version is: F(a,b,c) = a + c’
Two other less simplified are possible: F(a,b,c) = ac + c’ or F(a,b,c) = a + a’c’
Note that: ac + c’ = ac + c’(a + a’) = ac +c’a + c’a’ = a(c + c’) + c’a’ = a + a’c’ = a(1 +c’) + a’c’ = a + ac’ + a’c’
= a + c’(a + a’) = a + c’
Problem 30: A simple floating point system
A computer system uses a simplified 14-bit floating point with excess-16 bias to represent binary numbers.
a) How does this system represent the number -0.062510 in binary?
Hint: You have already converted 0.062510 to binary in Part 2 - question 5.
0.0625 = (0.0001)2 = (0.1)2 x 2-3
Sign bit = 1; Exponent = -3 + 16 = 1310 = (01101)2; Mantissa: 10000000
Binary number in floating point format (with excess 16) is: 10110110000000
b) What is the decimal version of: 01010010110000?
Exponent: (10100)2 = 2010
Removing excess 16: 20 -16 = 4
Mantissa: 0.10110000
The number is: 0.1011 x 24 = (1011)2 = (11)10
Problem 31:
Assuming 2’s complement 8-bit representation, consider the following:
Is the result correct? Why or why not? What can you deduce?
No . The result is a different sign than the two numbers we are adding so overflow has occurred
Problem 32:
Draw the combinational circuit that directly implements the Boolean expression:
F(x,y,z)= xz + (xy + z')
Problem 33: Boolean Algebra and Digital Logic
Consider the following logical diagram of a logical function F:
a) Give the Boolean expression of the above logical diagram’s output function F(a,b,c).
b) Draw the detailed truth table of F.
c) If F1 is the simplified version of F and
what would be the Boolean expression of F1?
d) Use Boolean algebra and Boolean identities to prove that F1 is really a simplified version of F (found in part
a).
Problem 34: Binary representations
Consider the binary number 10011100. What does this binary number represent in decimal (base 10) when it is
used in:
a) An 8-bit unsigned whole numbers system?
100111002 = 128 + 16 + 8 + 4 = 15610.
b) An 8-bit signed magnitude system?
100111002 = - (0011100)2 = -2810
c) An 8-bit one’s complement system?
10011100C1 = -(01100011)2 = -9910
d) An 8-bit two’s complement system?
10011100C2=-(01100011+1)2 = -(01100100)2 = -10010
Problem 35:
Convert each of the following decimal numbers to the destination radix (unsigned 8 bits representation).
a) (102)10 = (……………)2
b) (168)10=(………….)16
c) (01001010)2 = (………)10
d) (01001010)2= (……….)16
e) 618 = (……………)2
a)
b)
c)
d)
e)
01100110
A8
74
4A
110001
Problem 36:
A) How many nano seconds (ns) are in 12 microseconds (s)?
B) How many bits do we have in 6 MB file?
A) 12s = 12 x 1000 ns
B) 6 x 1024 x 1024 x 8 bits
Problem 37:
Draw the truth table and rewrite the expression below as the products of sum: f=xz’+y’z+x’y
Problem 38:
Given the following expression F=(x+y)(x+z)(x’+z)
a) Use Boolean algebra and Boolean identities to simplify F to its simplest form.
F=(x+xz+yx+yz)(x’+z)=(x+yz)(x’+z)=xz+x’yz+yz=yz+xz (2 marks)
b) Draw the truth table of the function F.
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
F
0
0
0
1
0
1
0
1
c) Draw the logic diagram for simplified F.
x
z
xz+yz
y
z
Problem 39: The Von-Neumann Model
The Von-Neumann model given below contains three main components: CPU, Main Memory and Input/Output
system. It also contains the following sub-components: Control Unit (CU), Arithmetic Logic Unit (ALU),
Program Counter Register (PC), Instruction Register (IR), data registers (also called general purpose registers).
Use the two lists given above to answer the following questions.
1) During the fetch process:
a. In which component does the system find the needed instruction?
In the Main Memory.
b. In which sub-component does the system find the address of the needed instruction?
In the PC.
c. Which sub-component is responsible for fetching the instruction?
CU
d. In which sub-component does the system store the fetched instruction?
In the IR.
In the following, consider that the fetched instruction is an “Add” instruction (add two numbers).
2) During the decode process, in which sub-components does the system store the needed operands? (0.5 Mark)
In data registers
3) During the execute process:
a. Which sub-component is responsible for executing the instruction?
ALU
b. Where does this sub-component store the result?
Data register or Main Memory
Download