Sie sind auf Seite 1von 7

EE2323

Assignment #1

EE2323: Microprocessors & Computer Architecture

Assignment # 1: Solution
(Due-Date: Sec-3: April 11, 2011, Due in Class)
(Due-Date: Sec-2: April 12, 2011, Due in Class)
(Due-Date: Sec-1: April 13, 2011, Due in Class)

NOTE: This is an individual assignment. You have to submit it in handwriting. No


Computer print outs will be accepted. No Late Submission is allowed!!

Q # 1. Do the following Conversions and show all intermediate steps :

(a). Convert the following from Octal to Hexadecimal


(347.65)8
=(1110_0111.1101_01)2
=(E7.D4)16
(251.473)8
=(1010_1001.1001_1101_1000)2
=(A9.9D8)16

(b). Convert the following from Hexadecimal to decimal


(C98.45)16
= 12*162 + 9*161 + 8*160 + 4 * 16-1 + 5 * 16-2
= (3224.2695)10
(1FE.125)16
= 1*162 + 15*161 + 14*160 + 1 * 16-1 + 2 * 16-2 + 5 * 16-3
= (510.0715)10

Page 1 of 7

(35-Points)

EE2323

Assignment #1

(c ). Convert the following from Decimal to BCD


135
= (000100110101)2
7956
= (0111100101010110)2

(d). Convert the following from Decimal fraction to Single precision Floating point
representation and show result in hexadecimal form
79.35
= (1001111.010110)2
= 1. 001111010110 x 26 (Normalized Form)
Sign = 0
Exponent = 6
Biased Exponent = 127 + 6 = 133 = (10000101)2
Fraction = 001111010110
Mantissa = 00111101011000000000000
Single Precision Floating Point No. = 01000010_10011110_10110000_00000000
= 0x429EB000H
-143
= (10001111)2
= 1.0001111 x 27 (Normalized Form)
Sign = 1 (-ve Number)
Exponent = 7
Biased Exponent = 127 + 7 = 134 = (10000110)2
Fraction = 0001111
Page 2 of 7

EE2323

Assignment #1

Mantissa = 00011110000000000000000
Single Precision Floating Point No. = 11000011_00001111_00000000_00000000
= 0xC30F0000H
0.0325
= (0.00001000)2
= 1.000 x 2-5 (Normalized Form)
Sign = 0
Exponent = -5
Biased Exponent = 127 - 5 = 122 = (01111010)2
Fraction = 0000
Mantissa = 00000000000000000000000
Single Precision Floating Point No. = 00111101_00000000_00000000_00000000
= 0x3D000000H
Q #2. Do the following arithmetic

(20-Points)

(a) Do the following computation in 2s complement arithmetic and convert result back into
decimal
i.

64 71 in 2s complement

64 = (01000000)2
71 = (01000111)2

-71 = (10111001)2

01000111 + 10111001 = 11111001 (Carry out is ZERO so Result will be ve)


(11111001)2 = -7
ii. 34 + 55 in 2s complement
34 = (0100010)2 , -34 = (1011110)2
55 = (0110111)2
1011110 + 0110111 = 0010101 (Carry out is ONE so Result will be +ve)

Page 3 of 7

EE2323

Assignment #1

(0010101)2 = 21
(b) Do the following computation in BCD arithmetic and convert result back into decimal
i.

35+49

35 = 00110101

, 49 = 01001001

00110101 + 01001001 = 01111110 (1110 > 9 so add correction factor of 6 = 0110)


01111110 + 00000110 = 10000100
Result in Decimal = 84
ii. 73-57
73 = 01110011

, 57 = 01010111

01110011 - 01010111 = 00011100 (1100 > 9 so subtract correction factor of 6 = 0110)


00011100 - 00000110 = 00010110
Result in Decimal = 16
Q #3. Show how the following 8-bit , 16-bit and 32-bit data in hex is stored in a byte

addressable memory starting from address 0x01F6. Data will be stored in same
sequence it is written.
(20-Points)
0xA0C0 , 0x42526272 , 0x7F , 0x4321 , 0x5A , 0x49 , 0xBBAA9988
(a). If memory is Little endian
Address

Memory Data

Address

Memory Data

0x0305

0x02FD

0x21

0x0304

0xBB

0x02FC

0x7F

0x0303

0xAA

0x02FB

0x42

0x0302

0x99

0x02FA

0x52

0x0301

0x88

0x02F9

0x62

0x0300

0x49

0x02F8

0x72

0x02FF

0x5A

0x02F7

0xA0

0x02FE

0x43

0x02F6

0xC0

Page 4 of 7

EE2323

Assignment #1

(b). If memory is Big endian


Address

Memory Data

Address

Memory Data

0x0305

0x02FD

0x43

0x0304

0x88

0x02FC

0x7F

0x0303

0x99

0x02FB

0x72

0x0302

0xAA

0x02FA

0x62

0x0301

0xBB

0x02F9

0x52

0x0300

0x49

0x02F8

0x42

0x02FF

0x5A

0x02F7

0xC0

0x02FE

0x21

0x02F6

0xA0

(c ). Which of the data in part (a) & (b) is stored at aligned addresses and which data is
stored at mis-aligned addresses
0xA0C0 , 0x42526272 , 0x7F , 0x4321 , 0x5A , 0x49 , 0xBBAA9988
Data

Address

Aligned/Misaligned

0xA0C0

0x02F6

Aligned

0x42526272

0x02F8

Aligned

0x7F

0x02FC

Aligned

0x4321

0x02FD

Misaligned

0x5A

0x02FF

Aligned

0x49

0x0300

Aligned

0xBBAA9988

0x0301

Misaligned

(20-Points)

Q # 4.

(a). Compute value of 20-bit Physical address for following Base and Offset pairs:

Page 5 of 7

EE2323

Assignment #1

0x1050 : 0x1236

Physical Address = (Seg. Base << 4) + Offset


Physical Address = 0x10500 + 0x1236 = 0x11736

0xA125 : 0x4075

Physical Address = (Seg. Base << 4) + Offset


Physical Address = 0xA1250 + 0x4075 = 0xA52C5

0x0A68 : 0x70B6

Physical Address = (Seg. Base << 4) + Offset


Physical Address = 0x0A680 + 0x70B6 = 0x11736

0xB1AB : 0x802A

Physical Address = (Seg. Base << 4) + Offset


Physical Address = 0xB1AB0 + 0x802A = 0xB9ADA
Which of the physical addresses are alias of each other ?
Address pairs (0x1050 : 0x1236) and (0x0A68 : 0x70B6) are alias of each other because
they map to the same physical address in memory
(b). Compute the unknowns in following physical address calculations:

0x850A : 0x1245 = PA ?

Physical Address = (Seg. Base << 4) + Offset


Physical Address = 0x850A0 + 0x1245 = 0x862E5

0xD765 :

= 0xDABC0

Physical Address = (Seg. Base << 4) + Offset


0xDABC0 = 0xD7650 + Offset
Offset

= 0xDABC0 0xD7650

Page 6 of 7

EE2323

Assignment #1

= 0x3570

? :

0xCD21 = 0x32D21

Physical Address = (Seg. Base << 4) + Offset


0x32D21 = (Seg. Base <<4) + 0xCD21
Seg. Base << 4 = 0x32D21 0xCD21 = 0x26000
Seg. Base

= 0x2600

Page 7 of 7