Está en la página 1de 21

UNIVERSITY OF

DAR ES SALAAM

COLLEGE OF ENGINEERING AND TECHNOLOGY

FACULTY OF ELECTRICAL AND COMPUTER SYSTEMS


ENGINEERING

DEPARTMENT OF COMPUTER SYSTEMS ENGINEERING

CS 251: INTRODUCTION TO COMPUTER ENGINEERING

ASSIGNMENT 3

GROUP MEMBERS:

SURNAME FIRST NAME DEG. PROG. REG. NUMBER

HUSSEIN TATU TE 2007-04-05286


SADICK EUGENE TE 2007-04-00360
JUNE, 2009.
1. Perform the following base conversions using subtraction or division-
remainder:
a) 45810 to base
458  3  152  2 LSB c) 151810 to base7
152  3  50  2 1518  7  216  6
LSB

216  7  30  6
50  3  16  2
30  7  4  2
47  0 4
16  3  5  1
151810  4266 7
MSB
53 1  2
MSB
1 3  0  1
d) 440110 = to base 9
 45810  121222 3

4401  9  489  0
489  9  54  3 LSB
b) 67710 to base5 54  9  6  0
LSB 69  0 6
677  5  135  2
 440110  6030 9
135  5  27  0
27  5  5  2 MSB
5  5  1 0
1 5  0 1
MSB
67710  10202 3

2. Convert the following decimal fractions to binary with a maximum of six places
to the right of the binary point:
a) 26.78125
26  2  13  0 0.87125  2  0.7425  1
Lsb Msb
13  2  6  1 0.7421 2  0.485  1
62  30 0.485  2  0.97  0
3  2  11 0.97  2  0.94  1
1 2  0 1 0.94  2  0.88  1
Msb 0.88  2  0.76  1

 26.7812510  11010 .110111 2 Lsb

b) 194.03125

194  2  97  0 Lsb 0.03125  2  0.0625  0 Msb


97  2  48  1 0.0625  2  0.125  0
48  2  24  0 0.125  2  0.25  0
24  2  12  0 0.25  2  0.5  0
12  2  6  0 0.5  2  0  1
62  3 0 Lsb
3  2  11
1 2  0 1

Msb
194.0312510  11000010.0000102

c) 16.1240234375

16  2  8  0 0.1240234375 2  0.248046875  0
Lsb Msb
82  40 0.248046875 2  0.49609375  0
42  20 0.49609375 2  0.9921875  0
2  2  1 0 0.9921875  2  0.984375  1
1 2  0 1 0.984375  2  0.96875  1
0.96875  2  0.9375  1
Msb
16.124023437510  10000.0001112 Lsb

3. Represent the following decimal numbers in binary using 8 – bit signed


magnitude, one’s compliment and two’s compliment:
a) 77
b) -42
c) 119
d) -107
Number 8-bit signed One’s Two’s
magnitude compliment compliment
77 77  2  38  1 7710 = 10011012 7710 = 10011012
38  2  19  0 Lsb
+7710=010011012 +7710=010011012
19  2  9  1
9  2  4 1
42  20
2  2  1 0
1 2  0 1
7710 = 10011012
+7710 = 01001101
Msb 2

-42 42  2  21  0 4210 = 1010102 4210 = 1010102


Lsb
21  2  10  1
= 001010102 = 001010102
10  2  5  0
5  2  2 1
-4210 = 110101012 Using drop down
2  2  1 0 trailing zeros up
1 2  0 1 to the first 1, then
4210 = 101010
Msb
2 complimenting
-4210 = 101010102 the rest,
00101010
11010110
-4210 = 110101102
119 119  2  59  1 11910 = 11101112 11910 = 11101112
Lsb
59  2  29  1
+11910 = +11910 =
29  2  14  1
14  2  7  0
011101112 011101112
7  2  3 1
3  2  11
1 2  0 1
11910 = 11101112
Msb
+11910=011101112
-107 107  2  53  1 10710 = 11010112 10710 = 11010112
53  2  26  1 = 011010112 = 011010112
26  2  13  0 -10710 = 100101002 Using drop down
13  2  6  1 trailing zeros up to
62  3 0 Lsb the first 1, then
3  2  11 complimenting the
1 2  0 1 rest,
10710 = 11010112 01101011
-10710 = 11101011
Msb2 10010101
-10710 = 100101012
4. Given a (very) tiny computer that has a word size of 6 bits, what are the
smallest negative numbers and the largest positive numbers that this computer
can represent in each of the following representations?

a) One’s compliment
Given N = No. of bits = 6 bits
 Smallest negative number = - (2N-1-1) = - (26-1-1) = - (25-1) = -31
 Largest positive number = + (2N-1-1) = + (26-1-1) = + (25-1) = +31

b) Two’s compliment
 Smallest negative number = - (2N-1) = - (26-1) = - (25) = -32
 Largest positive number = + (2N-1-1) = + (26-1-1) = + (25-1) = +31

5. Using Booths algorithm to find the multiplication of the below binary


numbers
a) 1100
x 101
Multiplicand = 1100;
Its 2’s compliment is 0011 +1 = 111110100
Multiplier = 0101
Record = 01010
+1 -1 +1 -1

1 1 0 0
X +1 -1 +1 -1
1 1 1 1 0 1 0 0
0 0 0 1 1 0 0
1 1 0 1 0 0
0 1 1 0 0
0 0 1 1 1 1 0 0

So
1100 X 101 = 111100
b) 10101
x 111
Multiplicand = 10101, its 2’s compliment is 01010 +1 = 01011;
Multiplier is 111; the store is 01110
+100-1
1 0 1 0 1
X +1 0 0 -1
1 1 1 0 1 0 1 1
0 0 0 0 0 0 0
0 0 0 0 0
1 0 1 0 1
1 0 0 1 0 0 1 1
So 10101 X 111 = 10010011

6. Using Booths algorithms to solve the below division.


a) 1010111 ÷101
Divisor = 1011

A register Q
register
Initially 0000 1010111
Shift left 0001 010111
Subtract divisor 1011
Set Qo 1100 0101110
Shift left 11000 101110
Add 00101
divisor
Set Qo 11101 1011100
Shift left 111011 011100
Add 000101
divisor
Set Qo 000000 0111001
Shift left 0000000 111001
Subtract divisor 1111011
Set Qo 1111011 1110010
Shift left 1111011 110010
1
Add 0000010
divisor 1
Set Qo 1111110 1100100
0
Shift left 1111110 100100
01
Add 0000001
divisor 01
Set Qo 1111111 1001000
10
Shift left 1111111 001000
101
Add 0000000
divisor 101
Set Qo 0000000 0010001
010

The Quotient is 0001 0001 and the remainder is 10.


b) 10000001÷101 -divisor= 1011

A register Q register
Initially 0000 10000001
Shift left 00001 0000001
Subtract 11011
divisor
Set Qo 11100 00000010
Shift left 111000 0000010
Add 000101
divisor
Set Qo 111101 00000100
Shift left 1111010 0000100
Add 0000101
divisor
Set Qo 1111111 00001000
Shift left 11111110 0001000
Add 00000101
divisor
Set Qo 00000011 00010001
Shift left 00000110 0010001
Subtract 11111011
divisor
Set Qo 00000001 0100011
Shift left 00000001 100011
0
Subtract 11111101
divisor 1
Set Qo 11111110 1000110
1
Shift left 11111110 000110
11
Add 00000001
divisor 01
Set Qo 00000000 0001100
00

The Quotient is 1100, with a remainder of 0


7.
Sign=1digit Exponent = 5 digits Mantissa =8
digits
Exponent bias = 16.

The number 100.010 =01100100.0 = 1.1001 X 106


Mantissa = 10010000
Exponent = 6+16 = 22 = 10110
Sign = 0

0 10110 10010000

The number 0.25 = 0.01=1.0X10-2


Mantissa = 01000000
Exponent = 16+-2=14 = 1110
Sign =0
0 01110 01000000

8. Why do we usually store floating point numbers in the normalized form? What
are the advantages of using a bias as opposed to adding a sign bit to the exponent?
Answer:
 The reason of using the normalized form floating point numbers is
that they tend to allow very large and very small numbers to be
presented using only few digits at the expense of precision
 Used in many application to represent numbers since most of them
they are not capable of using integers
Advantages of using bias as opposed to sign bit is
 Easy to present the floating point numbers
 Accuracy in the floating numbers representation

9.
 Given that the ASCII code for A is 1000001, what is the ASCII code for J?
 Given that the EBCDIC code for A is 11000001, what is the EBCDIC code
for J?

(a) A=1000001
To change A into hexadecimal number:
A=0100|0001=4116
From A to J we have 9 characters, so add 9 in A to get J
9 in binary is 1001
J=A+9=1000001+1001=1001010
J=1001010
Hence the value of J is 1001010
(b) A=11000001
To change A into hexadecimal number:
A=1100/0001=121
From A to J we have 9 characters, so add 9 in A to get J
9 in binary is 1001
J=A+9=11000001+1001=11001010
J=11001010
Hence the value of J is 11001010
10.
Assume a 24 –bit word on a computer .In these 24 bits we wish to represent the
value 295.
(a) If our computer uses even parity ,how would the computer represent the
decimal value 295?
(b) If our computer uses 8-bit ASCII and even parity ,how would be
computer represent the string 295
(c) If our computer uses packed BCD ,how would the computer represent the
number +295

(a) To represent the decimal value 295


Change 295 into binary
29510=100100111
If we use even parity 295 will be 000000000000001100100111

(b) If we use 8-bit ASCII and even parity


To change 295 into binary
295=100100111
If we use even parity 295 will be 000000000001000100100111

(c) If a computer uses packed BCD


295 in BCD=001010010101
BCD using 24 bits 295 will be equal to 000000000000001010010101
11.
Decode the following ASCII message, assuming 7-bit ASCII character and no
parity.
1001010 1001111 1001000 1001110 0100000 1000100 1000101.

To change each binary into hexadecimal


1001010=4A, 1001111=4F, 1001000=48, 1001110=4E,
0100000=20, 1000100=44,
1000101=45
To change each hexadecimal into its equivalent character
4A=J ,4F=0 ,48=H ,4E=N ,20=BLANK ,44=D ,45=E
When 1001010 1001111 1001000 1001110 0100000 1000100
1000101 is decoded it will be equal to JOHN DE
12.
Find the quotients and remainders for the following division problems
modules.
(a) 10101112÷11012
(b) 10111112÷111012
Solution.
0000110
a/ 1101 101011
-1101
10001
- 1101
1001
0000
1001
Quotient is 110 and remainder is 1001

b/ 0000011
11101 1010111
-11101
100101
-11101
01000
Quotient is 11 and remainder is 10000
13.
Convert the IEEE single precision Floating Point numbers to the decimal values

Answer:

The number i

The number is

14.
In order to print out number 3.142, which five ASCII characters must be sent to
the printer?
Answer:
15.
Describe IEEE 754 Floating Point Standard of representing fraction numbers.
Answer:
This is the standard format for representing binary floating point numbers
introduced by IEEE.The number is represented by using three fields,sign
field,exponent field and mantissa field.The three fields are represented in the
form of where “ f” is the value of the fraction field and “e” is the
biased exponent.

Example:

In single precision

In tabular form:
S e
m
0
0000...........................0000
1 bit 8 bits
32 bits
In double precision

S e
m
0 0000........................................0000
1 bit 11 bits
64 bits

16.
Calculate the decimal value represented by the binary number 10101 using
a) Signed magnitude c) Two’s complement
b) One’s complement d) Excess representation
Answer:
a) Using Signed magnitude

b) Using One’s complement

20

c) Using Two’s complement


hence the number is 9
d) Using Excess representation

16.
Calculate the decimal value represented by the binary number 10101 using
(a) signed magnitude
(b) one’s compliment
(c) two’s compliment
(d) excess representation

(a) signed magnitude


In signed magnitude the msb indicates the sign of the decimal number
then 1 in 101012 indicates that the number is negative of magnitude
= 20 +22 = 1+4 = -510
b) one’s compliment
In one’s complement 101012 become 010102
= 21 +23
=1010
(c) two’s compliment
In 2’s complement 101012 become 010112
=20 +21 +23
=1110
(d) excess representation
101012 its bias = 25-1 =16=100002
2’s complement = 010112
Add bias = 16 = 1000
Answer = 110112
The number is positive since msb is 1,
=20 +21+23
=1110

17.
What is the Booth’s Algorithm? State the steps required for multiplying two
signed binary numbers. When multiplying -6 times -5, what is the sequence of
values in the (P, A) register pair?
Booth algorithm- Is the technique used to speed up the multiplication
operation based on the observation that the larger the number of
consecutive zeros and ones, the fewer partial products that have to be
generated.

Steps required performing multiplication


1) If x is the count of bits of the multiplicand, and y is the count of bits of the
multiplier :
2) Draw a grid of three lines, each with squares for x + y + 1 bits. Label the
lines respectively A (add), S (subtract), and P (product).
3) In two's complement notation, fill the first x bits of each line with :
4) A: the multiplicand
5) S: the negative of the multiplicand
6) P: zeroes
7) Fill the next y bits of each line with :
8) A: zeroes
9) S: zeroes
i. P: the multiplier
10) Fill the last bit of each line with a zero.
11) Do both of these steps |y| (the Absolute Value of y) times :
12) If the last two bits in the product are...
13) 00 or 11: do nothing.
14) 01: P = P + A. Ignore any overflow.
15) 10: P = P + S. Ignore any overflow.
16) Arithmetically shift the product right one position.
17) Drop the last bit from the product for the final result.

18) Sequence value is of (P, A) in register pair for -6*-5


19) A = 0011 0000 0
20) S = 1101 0000 0
21) P = 0000 1100 0
22) Perform the loop four times :
23) P = 0000 1100 0. The last two bits are 00.
24) P = 0000 0110 0. A right shift.
25) P = 0000 0110 0. The last two bits are 00.
26) P = 0000 0011 0. A right shift.
27) P = 0000 0011 0. The last two bits are 10.
28) P = 1101 0011 0. P = P + S.
29) P = 1110 1001 1. A right shift.
30) P = 1110 1001 1. The last two bits are 11.
31) P = 1111 0100 1. A right shift.
a. The product is 1111 0100, which is 30

18.
Design a full subtractor using only the NOR gates
Truth table

X Y Bin D Bout

0 0 0 0 0

0 0 1 1 1

0 1 0 1 1

0 1 1 0 1

1 0 0 1 0

1 0 1 0 0

1 1 0 0 0

1 1 1 1 1

Logic expressions:
X Y Bin

Bout

19. Design a full adder circuit using only the NAND gates.
A B Cin

Sum

Carry

También podría gustarte