0% found this document useful (0 votes)
118 views9 pages

Ass No 3

The document contains solutions to problems involving representation of decimal numbers in binary, twos complement arithmetic, floating point number representation, and multiplication using Booth's algorithm. Problem 10.1 shows decimal to binary conversion using sign magnitude and twos complement. Problem 10.2 decodes twos complement values. Later problems involve twos complement addition, subtraction, and multiplication using Booth's algorithm. Further problems express decimal numbers as IEEE 32-bit floating point format and decode floating point values.

Uploaded by

Areeb Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views9 pages

Ass No 3

The document contains solutions to problems involving representation of decimal numbers in binary, twos complement arithmetic, floating point number representation, and multiplication using Booth's algorithm. Problem 10.1 shows decimal to binary conversion using sign magnitude and twos complement. Problem 10.2 decodes twos complement values. Later problems involve twos complement addition, subtraction, and multiplication using Booth's algorithm. Further problems express decimal numbers as IEEE 32-bit floating point format and decode floating point values.

Uploaded by

Areeb Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

BAHRIA UNIVERSITY (KARACHI CAMPUS)

Assignment # 3 - FALL 2020

Computer Architecture and organization (CAO)


Class: BSE 3(A) Submission Deadline: 7th jan 2021
Course Instructor: DR. Syed samar yazdani
SUBMITTED BY:

Problem # 10.1:
Represent the following decimal numbers in both binary sign/magnitude and twos
complement using 16 bits: + 512; - 29.

Solution:
512 0000 0010 0000 0000
Sign Magnitude
-29 0000 0010 0000 0000
512 1000 0000 0001 1101
Two’s Complement
-29 1111 1111 1110 0011

Problem # 10.2:
Represent the following twos complement values in decimal: 1101011; 0101101

Solution:
1101011: This is a negative number as it starts with 1 in the left, its magnitude
can be calculated by flipping the bits and adding 1.
0010100 + 1 = 0010101
Answer= -21 (where negative sign shows that number is started from
leftmost 1).

0101101: This is a positive number as it starts with 0 in the left, and its
magnitude can simply be calculated and we get,
Answer=45

Problem # 10.10:
Assume numbers are represented in 8-bit twos complement representation. Show
the calculation of the following:
a. 6 + 13
b. -6 + 13
c. 6 – 13
d. -6 – 13

Solution:
a. 6+13 = 00000110 + 00001101 = 00011011
b. -6+13 = 11111010 + 00001101 = (1)00000111
c. 6-13 = 00000110 + 11110011 = 11111001
d. -6-13 = 11111010 + 11110011 = (1)11101101

Problem # 10.11:
Find the following differences using twos complement arithmetic:

a. 111000 – 110011
b. 11001100 -101110
c. 111100001111 – 110011110011
d. 11000011 – 11101000
Solution:
a. 111000
-110011
111000
+001101
= (1)000101

b. 11001100
- 101110
11001100
+ 010010
=11011110

c. 111100001111
-110011110011
111100001111
+ 001100001101
= (1)001000011100
d. 11000011
-11101000
11000011
+ 00011000
= 11011011
Problem # 10.14:
Given x = 0101 and y = 1010 in twos complement notation (i.e.,
x = 5, y = -6),
compute the product p = x * y with Booth’s algorithm.

Solution:
A Q Q-1 M

0000 1010 0 0101 Initial


0000 0101 0 0101 Shift
1011 0101 0 0101 A←A–M
1101 1010 1 0101 Shift
0010 1010 1 0101 A←A+M
0001 0101 0 0101 Shift
1100 0101 0 0101 A←A–M
1110 0010 1 0101 Shift
Problem # 10.15:
Use the Booth algorithm to multiply 23 (multiplicand) by
29 (multiplier), where each number is represented using 6
bits.
Solution:
A Q Q-1 M
000000 010111 0 010011 Initial
101101 010111 0 010011 A←A–M
110110 101011 1 010011 Shift
111011 010101 1 010011 Shift
111101 101010 1 010011 Shift
010000 101010 1 010011 A←A+M
001000 010101 0 010011 Shift
110101 010101 0 010011 A←A–M
111010 101010 1 010011 Shift
001101 101010 1 010011 A←A+M
000110 110101 1 010011 Shift

Answer = 0001 1011 0101 = 437

Problem # 10.23:
Express the following numbers in IEEE 32-bit floating-point format:
a. -5
b. -6
c. -1.5
d. 384
e. 1/16
f. -1/32

Solution:
a. -5
5 = 101 = 1.01 x 22
exponent = 127 + 2 = 129 = 10000001

1 10000001 01000000000000000000000

b. -6
6 = 110 = 1.10 x 22
exponent = 127 + 2 = 129 = 10000001

1 10000001 10000000000000000000000

c. -1.5
1.5 = 1.1 = 1.1 x 20
exponent = 127 = 01111111

1 01111111 10000000000000000000000

d. 384
384 = 384-256 = 128 -128 = 0; = 110000000 = 1.1 x 28
exponent = 8 + 127 = 135 = 10000111

0 10000111 10000000000000000000000

e. 1/16
1/16 = .0001 = 1.0 x 2-4
exponent = 127 – 4 = 123 = 01111011

0 01111011 00000000000000000000000

f. -1/32
1/32 = .00001 = 1.0 x 2-5
exponent = 127 – 5 = 122 = 01111010

1 01111010 00000000000000000000000
Problem # 10.24:
The following numbers use the IEEE 32-bit floating-point
format. What is the equivalent decimal value?
a. 1 10000011 11000000000000000000000
b. 0 01111110 10100000000000000000000
c. 0 10000000 00000000000000000000000

Solution:
a. 1 10000011 11000000000000000000000
sign = -
exponent = 131 – 127 = 4
1.11 x 24 = 11100 = 28
Answer=-28 (Negative sign is due to the leftmost 1 in the value which
shows the value is negative)

b. 0 01111110 10100000000000000000000
sign = +
exponent = 126 – 127 = -1
1.101 x 2-1 = .1101 = ½ + ¼ + 1/16 = .8125
Answer=.8125
c. 0 10000000 00000000000000000000000
sign = +
exponent = 128 – 127 = 1
1.0 x 21 = 10 = 2
Answer=2

You might also like