You are on page 1of 4

Subject: PRF192- PFC

Workshop 01
Objectives:
(1) Reviewing for number systems
(2) Exploring memory of a C program

Recommendations
Part 1: Students do exercises using notebooks
Part 2: Students develop programs, run them, write down their memory structure to
notebooks.

Part 1: Number systems

Exercise 1 (2 marks): Convert decimal numbers to binary ones

Decimal 4-bit Decimal 8-bit Decimal 16-bit Binary


Binary Binary

9 1001 7 0000 0111 255 0000 0000 1111 1111


7 0111 34 00100010 192 0000000011000000
2 0010 125 01111101 188 0000000010111100
15 1111 157 - 312 0000000100111000
12 1100 162 - 517 0000001000000101
11 1011 37 00100101 264 0000000100001000
6 0110 66 01000010 543 0000001000011111
5 0101 77 01001101 819 0000001100110011
8 1000 88 01011000 1027 0000010000000011
13 1101 99 01100011 2055 0000100000000111
14 1110 109 01101101 63 0000000000111111

Exercise 2(2 marks): Convert decimal numbers to binary and hexadecimal ones

Decimal Binary Hexa. Decimal 16-bit Binary Hexadecim


al

9 1001 9 255 0000 0000 1111 1111 00FF


127 0111 1111 9F 192 0000000011000000 00C0
125 000000000 007D 188 0000000010111100 00BC
1111101
157 000000001 009D 312 0000000100111000 0138
0011101
162 000000001 00A2 517 0000001000000101 0205
0100010
37 000000000 0025 264 0000000100001000 0108
0100101
66 000000000 0042 543 0000001000011111 021F
1000010
77 000000000 004D 819 0000001100110011 0333
1001101
88 000000000 0058 1027 0000010000000011 0403
1011000
99 000000000 0063 2055 0000100000000111 0807
1100011
109 000000000 006D 63 0000000000111111 003F
1101101

Exercise 3(2 marks): Compute


(b: binary, q: octal, h: hexadecimal)

3245q + 247q = 3514 q = 111 0100 1100 b


1A7Bh + 26FE7h = 28A62 h = 10 1000 1010 0110 0010 b
1101101101b - 10110111b = 10 1011 0110 b
3654q – 337q = 3315 q = 110 1100 1101 b
3AB7h – 1FAh = 3881 h = 11 1000 1000 0001 b
36Ah – 576q = 1EF h = 1 1110 1111b
64AEh – 1001101b= 62141 q

101101111 b
+ 100111011 b
110110001 b
110001101b
101 1110 1000 b
1011010 b* 1011b = 1 1110 1111 b
1101000b + 2AB h + 345 q = 3F8 h = 1170 q
3AFh / 1Ch = 10 0001 b = 33 d
3ACh – 562q = 10 0011 1101 b = 573 d
3FFA h / 327q = 100 1100 b = 76 d

Exercise 4 (2 marks)
1- Show binary formats of 1-byte unsigned numbers: 251 , 163, 117
2- Show binary formats of 2-byte unsigned numbers: 551 , 160, 443
3- Show binary formats of 1-byte signed numbers: -51 , -163, -117, 320
4- Show the decimal values of 1-byte unsigned representations: :
01100011 b , 10001111 b , 11001010 b , 01001100 b

Part 2: Explore memory structure of programs

Sample

c:22936 ‘A’
23
i:22936 1
16
l:2293 1000
612
f:22936 0.5
08
d:22936 12.809
00

Complete the code of following program then draw it’s memory structure
(2 marks)

You might also like