You are on page 1of 9

Student name: Nguyễn Hoàng Long

Student number: BI11-157


Class: A1

Computer Architecture

1. 3710 has 0010 0101 in signed magnitude notation.


Find the signed magnitude of –3710?

- The left-most bit represents the sign of the integer.


- 0 for positive numbers.
- 1 for negative numbers.
We have 3710 = 00100101 => 3710  = 10100101

2. Using the signed magnitude notation find the 8-bit binary representation
of the decimal value 2410 and -2410.

We have 24 = 23 + 24
 2410 8-bit representation: 2410 = 00011000, -2410=10011000

3. Find the signed magnitude of –63 using 8-bit binary sequence?

We have 63 = 1 + 2 + 4 + 16 + 8 + 32
 6310  8-bit binary 63 = 00111111, -63 = 10111111
4. Fill in the empty slots in the table by converting numbers into different
representations. All numbers are 8 bits in length. Use 2’s compliment
representation in binary and hexadecimal numbers.
Binary Hexadecimal Unsigned Signed Decimal
Decimal
0010 0001 33
6F
1010 0100
-25

Binary to hexadecimal:
- "0"–"9" to represent values 0 to
- "A"–"F" to represent values 10 to 15.
- The left-most bit represents the sign of the integer.
- 0 for positive numbers.
- 1 for negative numbers.
 We have the result
Binary Hexadecimal Unsigned Signed Decimal
Decimal
0010 0001 21 33 33
0110 1111 6F 111 111
1010 0100 A4 164 -92
1110 0111 E7 231 -25
5. Find 10011001 is an 8-bit binary sequence.
Find the decimal value it represents if it was in unsigned and signed
magnitude.
- Signed: -25 = 23 + 24 + 1
- Unsigned: 153 = 23 + 24 + 1 + 27

Suppose this representation is excess notation, find the decimal value it


represents?
Excess notation: 153 – 2(8-1) = 25 (28-1 unchange value)

6. Using 8-bit binary sequence notation, find the unsigned, signed


magnitude and excess notation of the decimal value 1110 ?
11 = 1 + 21 + 23
- Unsigned: 1110 = 00001011
- Signed: 1110 = 00001011
- Excess: 1110 + 2(8-1) = 139 = 10001011
- 2’s complement: 1110 = 00001011

7. Determine the decimal value represented by 10001011 in each of the


following four systems.
a. Unsigned notation?
1000 1011 = 20 + 21 + 23 + 27 = 139

b. Signed magnitude notation?


1000 1011 = - (20 + 21 + 23) = -11

c. Excess notation?
1000 1011 – (27) = 20 + 21 + 23 + 27 - 27 = 11

d. Two’s complements?
1000 1011 = 20 + 21 + 23 + (-27) = -117

8. Find the 2's complement of the following binary numbers:


a. 0100 1010 1011 0110
NOT(0100 1010 1011 0110) + 1 = (1011 0101 01001001) + 1
= 1011 0101 0100 1010

b. 1001 0000 0111 0000


NOT(1001 0000 0111 0000) + 1 = (0110 1111. 1000 1111) + 1
= 0110 1111 1001 0000
9. Assuming two’s complement notation, perform the following :(4)
a. 11000011 + 00100011
b. 01000011 + 00100011
c. 11000011 – 00100011
d. 01111111 + 01111111
e. 11000011 + 11000011
f. 10000011 + 10000011

Assume your answer must also use only eight bits and are in two’s
complement notation. Do all the above operations still work correctly? If
not, which ones have problems, and why?

- Add 2 number in two’s complement notation


- Using sign rule to check the answer value

11 Decimal
1100 0011 -61
+0010 0011 35
1110 0110 -26 OK

11 Decimal
0100 0011 67
+0010 0011 35
0110 0110 102 OK

1 Decimal
1100 0011 -61
-0010 0011 35
1010 0000 -96 OK

111 111 Decimal


0111 1111 127
+0111 1111 127
1111 1110 (254) -2 Not OK

1000 011 Decimal


1100 0011 -61
+1100 0011 +(-61)
(1)1000 0110 -122 OK

10000 011 Decimal


1000 0011 -125
+1000 0011 +(-125)
10000 0110 -250 10 Not OK

Note:
In Addition check the left bit
(0)a + (0)b -> (0)c -> OK
(0)a + (0)b -> (1)c -> Not OK
(1)a + (1)b -> (1)c -> OK
(1)a + (1)b -> (0)c -> Not OK
(0)a + (1)b -> (x)c -> Always OK
Similar with Subtraction

10.Consider the 8-bit binary bit pattern 10101010. What is its decimal (base
ten) value if the bit pattern is A two’s complement integer?

- The bit pattern is a two’s complement integer


- 1 for negative numbers.
- The number is a positive so reversing all bits except the right most bits
upto 1st 1
 10101010: -(01010101+1) = -01010110 = -86

11.Find the unsigned fixed-point binary representation of the decimal


number 128.125.

128.125 = 10000000.001

12.
a. Convert 101.101 from unsigned fixed point representation to
decimal.
5.625
b. Convert 72.375 from decimal to unsigned fixed point binary
100 0.010(1001)
13.
a. Represent +0.8 in the following floating-point representation:
1-bit sign
4-bit exponent
6-bit normalised mantissa (significand).

4-bit exponent: bias = 2(4 -1) - 1 = 7


0.8: 0.8 x 2
1.6: 0.6 x 2
1.2: 0.2 x 2
0.4: 0.4 x 2
0.8: 0.8 x2
1.6: …
 0.810 = 0.11001100…2
Nomalize: 1.100110 x 2-1
Sign (+) 1 bit : 0
Exponent 4 bit: -1 + 7 = 610 = 01102
Mantissa 6 bit: 100110
 Result: 0 0110 110011

b) Convert the value represented back to decimal?


= +1.1001102 x 2-1 = (20 + 2-1 + 2-4 + 2-5) x 2-1
= (1 + 0.5 + 0.0625 + 0.03125) x 2-1
= 1.59375 x 2-1 = 0.796875

c) Calculate the relative error of the representation?


14.Convert the following 32bit floating point hexadecimal number to its
decimal value 3EA00000

Hex: 3EA00000
Binary: 0011 1110 1010 0000 0000 0000 0000 0000

IEEE 745:
Sign (1bit): 0 -> positive
Exponent (8bit): 0111 1101 -> 125 – 127 (bias) = -2
Mantissa (23bit): 010 0000 0000 0000 0000 0000 -> 1.01 (binary) = 2^1
+ 2^(-2) = 1.25 (decimal)

Value = 1.25 * 2^(-2) = 0.3125

15.Do the following calculations below in single precision floating point


representation. Show the floating-point binary values for the operands,
show the result of the add or subtract, then show the final normalized
binary representation.
a. 0.5 + 0.3125;
 0.5

Sign Exponent Mantissa

+1 2-1 1.0

 0.5 = 00111111000000000000000000000000

 0.3125

Sign Exponent Mantissa

+1 2-2 1.25

 0.3125 = 00111110101000000000000000000000
 0.5 + 0.3125 = 00111111010100000000000000000000 = 0.8125
b. 12 – 3.875.
 12

Sign Exponent Mantissa

+1 23 1.5

 12 = 01000001010000000000000000000000
 3.875

Sign Exponent Mantissa

+1 21 1.9375
 3.875 = 01000000011110000000000000000000
 12 - 3.875 = 01000001000000100000000000000000 = 8.125

16.Convert the ASCII string “9.75” to its hexadecimal representation. Only


represent the characters between the quotation marks and assume it is a
null terminated string.
Answer: 39 2e 37 35

17.Convert the following binary code into an ASCII string:


0111 0000 0011 0001 0011 0011 0111 0011 0000 0000
Answer: p13s

18.Assume a color display using 8 bits for each of the primary colors (red,
green, blue) per pixel and a frame size of 1280 × 1024.
a. What is the minimum size in bytes of the frame buffer to store a
frame?
Answer: 1*3*1280*1024 = 3932160 bytes
b. How long would it take, at a minimum, for the frame to be sent
over a 100 Mbit/s network?
8 6
Answer: 3932160 × 100 ×10 =0.3145728( s)
19.Given the two 16-bit numbers expressed in hexadecimal representation:
xABCD and xFEED, evaluate the following expression. Give your
answer in hexadecimal(base16). xABCD AND (NOT(xFEED)

You might also like