PFC Workshop01 2015
PFC Workshop01 2015
Workshop 01
Name: Đỗ Minh Hiếu
ID Student: SE162117
Class: SE1648
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.
Exercise 2(2 marks): Convert decimal numbers to binary and hexadecimal ones
1 1 <---- carry
3 2 4 5
+
2 4 7
35 14
1 <---- carry
3654
-
337
3315
62256
- 115
62141
101101111 b
+ 100111011 b
110110001 b
110001101 b
10111101000 b
68 150
+ 2AB + 1253
+ E5 + 345
3F8 1770
1110101111 | 11100
-11100 | ---------
--------- | 100001
10 |
101 |
1011 |
10111 |
101111 |
-11100
----------
10011
3ACh – 562q = 1000111010 b = 570 d
3AC h = 0011 1010 1100 b
562 q = 101 110 010 b
111 1 <---- carry
001110101100
-
101110010
1000111010
3FFA h / 327q =1001100b Remainder 100110b = 76d Remainder 38d
3FFA h = 0011 1111 1111 1010 b = 16378 d
327q = 011 010 111 = 215 d
11111111111010 | 11010111
-11010111 |-------------------
--------------- | 1001100
1010001
10100011
101000111
- 11010111
----------------
11100000
-11010111
--------------
10011
100110
Exercise 4 (2 marks)
1- Show binary formats of 1-byte unsigned numbers:
251d = 1111 1011b
163d = 1010 0011b
117d = 0111 0101b
2- Show binary formats of 2-byte unsigned numbers:
551d = 0000 0010 0010 0111b
160d = 0000 0000 1010 0000b
443d = 0000 0001 1011 1011b
3- Show binary formats of 1-byte signed numbers:
-51d = 11001101b
|51|d = 00110011b
Flip bit = 11001100
Add 1 = 1
-51 = 11001101b
-163d : Out of Range
-117d = 10001011b
|117|d = 01110101b
Flip bit= 10001010
Add 1 = 1
-117d = 10001011b
320d : Out of Range
4- Show the decimal values of 1-byte unsigned representations: :
01100011 b = 99d
10001111 b = 143d
11001010 b = 202d
01001100 b = 76d
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)