Tải bản đầy đủ (.pdf) (10 trang)

kiến trúc máy tính dạng thanh tin figs a binary numbers sinhvienzone com

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (30.59 KB, 10 trang )

A
BINARY NUMBERS

1

CuuDuongThanCong.com

/>

dn

100's
place

10's
place

1's
place

d2

d1

d0



.

.1's


place

.01's
place

.001's
place

d–1

d–2

d–3



n

Number =

Σ

di × 10i

i = –k

Figure A-1. The general form of a decimal number.

CuuDuongThanCong.com


/>
d–k


1

Binary

1

Octal

1

1

1


1024

+1×
+ 512

+1×
+ 256

+1×
+ 128


3

7

2

1

210

29

28

27

+1×
+ 64

0
26

+0×
+0

1
25

+1×
+ 16


0
24

+0×
+0

0
23

+0×
+0

0
22

+0×
+0

1
21

+ 1 × 20
+1

3 × 8 + 7 × 8 + 2 × 8 + 1 × 80
1536 + 448 + 16 + 1
3

Decimal


2

2

0

1

0

1

2 × 103 + 0 × 102 + 0 × 101 + 1 × 100
+0
+1
2000 + 0
Hexadecimal

7

D

1

.

7 × 162 + 13 × 161 + 1 × 160
1792 + 208
+1


Figure A-2. The number 2001 in binary, octal, and hexadecimal.

CuuDuongThanCong.com

/>

Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
20
30
40
50
60

70
80
90
100
1000
2989

Binary
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
10000
10100
11110
101000
110010
111100

1000110
1010000
1011010
11001000
1111101000
101110101101

Octal
0
1
2
3
3
5
6
7
10
11
12
13
14
15
16
17
20
24
36
50
62
74

106
120
132
144
1750
5655

Hex
0
1
2
3
3
5
6
7
8
9
A
B
C
D
E
F
10
14
1E
28
32
3C

46
50
5A
64
3E8
BA

Figure A-3. Decimal numbers and their binary, octal, and hexadecimal equivalents.

CuuDuongThanCong.com

/>

Example 1
Hexadecimal
Binary
Octal

. B
6
0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0. 1 0 1 1 0 1 1 0 0
5
0 . 5
1
4
1
5
4
1


9

4

8

Example 2
Hexadecimal
Binary
Octal

C
4
. B
0 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1. 1 0 1 1 1 1 0 0 0 1 0 0
7
5
3 . 5
7
0
4
6
4
7

B

A

3


Figure A-4. Examples of octal-to-binary and hexadecimal-tobinary conversion.

CuuDuongThanCong.com

/>

Quotients

Remainders

1492
746

0

373

0

186

1

93

0

46


1

23

0

11

1

5

1

2

1

1

0

0

1

1 0 1 1 1 0 1 0 1 0 0 = 149210

Figure A-5. Conversion of the decimal number 1492 to binary
by successive halving, starting at the top and working downward. For example, 93 divided by 2 yields a quotient of 46 and

a remainder of 1, written on the line below it.

CuuDuongThanCong.com

/>

1

0

1

1

1

0

1

1

0

1

1

1
1 + 2 × 1499 = 2999


Result

1 + 2 × 749 = 1499
1 + 2 × 374 = 749
0 + 2 × 187 = 374
1 + 2 × 93 = 187
1 + 2 × 46 = 93
0 + 2 × 23 = 46
1 + 2 × 11 = 23
1 + 2 × 5 = 11
1+2×2=5
0+2×1=2
1+2×0=1

Start here

Figure A-6. Conversion of the binary number 101110110111
to decimal by successive doubling, starting at the bottom. Each
line is formed by doubling the one below it and adding the
corresponding bit. For example, 749 is twice 374 plus the 1 bit
on the same line as 749.

CuuDuongThanCong.com

/>

N
decimal
1

2
3
4
5
6
7
8
9
10
20
30
40
50
60
70
80
90
100
127
128

N
binary
00000001
00000010
00000011
00000100
00000101
00000110
00000111

00001000
00001001
00001010
00010100
00011110
00101000
00110010
00111100
01000110
01010000
01011010
01100100
01111111
Nonexistent

−N
signed mag.
10000001
10000010
10000011
10000100
10000101
10000110
10000111
10001000
10001001
10001010
10010100
10011110
10101000

10110010
10111100
11000110
11010000
11011010
11011010
11111111
Nonexistent

−N
1’s compl.
11111110
11111101
11111100
11111011
11111010
11111001
11111000
11110111
11110110
11110101
11101011
11100001
11010111
11001101
11000011
10111001
10101111
10100101
10011011

10000000
Nonexistent

−N
2’s compl.
11111111
11111110
11111101
11111100
11111011
11111010
11111001
11111000
11110111
11110110
11101100
11100010
11011000
11001110
11000100
10111010
10110000
10100110
10011100
10000001
10000000

Figure A-7. Negative 8-bit numbers in four systems.

CuuDuongThanCong.com


/>
−N
excess 128
01111111
01111110
01111101
01111100
01111011
01111010
01111001
01111000
01110111
01110110
01101100
01100010
01011000
01001110
01000100
00111010
00110000
00100110
00011100
00000001
00000000


Addend
Augend
Sum

Carry

0
+0
0
0

0
+1
1
0

1
+0
1
0

1
+1
0
1

Figure A-8. The addition table in binary.

CuuDuongThanCong.com

/>

Decimal


1's complement

2's complement

10
+ (−3)

00001010
11111100

00001010
11111101

+7

1 00000110

1 00000111

carry 1

discarded

00000111
Figure A-9. Addition in one’s complement and two’s complement.

CuuDuongThanCong.com

/>



×