1
1
Number System
- M. Sachdev,
- Dept. of Electrical & Computer Engineering
University of Waterloo
ECE 223 Digital Circuits and Systems
2
Number System M. Sachdev, Dept. of Electrical & Computer - - PDF document
ECE 223 Digital Circuits and Systems Number System M. Sachdev, Dept. of Electrical & Computer Engineering University of Waterloo 1 General Radix Representation A decimal number such as 7392 represents 7392 = 7x10 3 + 3x10 2 + 9x10 1
1
2
3
12 11 10 09 08 07 06 05 04 03 02 01 00 r = 10 (Dec.) 1100 1011 1010 1001 1000 0111 0110 0101 0100 0011 0010 0001 0000 r = 2 (Binary) 14 13 12 11 10 07 06 05 04 03 02 01 00 r = 8 (Octal) C B A 9 8 L7 6 5 4 3 2 1 r = 16 (Hex)
4
15 14 13 r = 10 (Dec.) 1111 1110 1101 r = 2 (Binary) 17 16 15 r = 8 (Octal) F E D r = 16 (Hex)
5
Convert (77)10 to binary a5 1 a4 2 a2 1 9 a3 1 4 a1 19 38 77 Integer 1 1 Remainder a6 a0 Coefficient
6
a2 3 a1 3 3 24 173 Integer 5 Remainder a0 Coefficient
7
a-5 = 1 = 1.088 0.544 a-4 = 1 = 1.544 0.772x2 0.866x2 0.443x2 0.7215x2 = 1.772 = 0.866 = 1.443 a-3 =1 a-2 = 0 a-1 = 1
8
Nice simple ways to convert between these three number
Binary to Octal simply requires grouping bits into groups of
Binary to Hex simply requires grouping bits into groups of
Going the other direction (Octal to Binary or Hex to Binary)
Example (100111100101)2 = (4745)8 = (9E5)16
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Numbers are represented in a fixed # of bits
Left most bit (Most Significant Bit) represents the sign
Sign & magnitude Signed 1’s complement Signed 2’s complement
26
27
28
29
30
Decimal numbers are coded using binary bit patterns 9 8 7 6 5 4 3 2 1 Decimal 1001 1000 0111 0110 0101 0100 0011 0010 0001 0000 BCD (8421) 1111 1000 0111 0110 0101 0100 0011 0010 0001 0000 2421 1100 1011 1010 1001 1000 0111 0110 1001 0100 0011 Excess-3 1101 1100 0100 0101 0111 0110 0010 0011 0001 0000 Gray
31
32