You are on page 1of 29

CHAPTER 1

Introduction Number Systems and Conversion

This chapter in the book includes:


Objectives
Study Guide
1.1 Digital Systems and Switching Circuits
1.2 Number Systems and Conversion
1.3 Binary Arithmetic
1.4 Representation of Negative Numbers
1.5 Binary Codes
Problems

인하대 전자과 디지털논리회로 ECE2245 1/29


재택수업강의 제작 관련 저작권 안내

부탁사항 : 불법 공개 / 공유 / 수업목적외 사용 금지

인하대 전자과 디지털논리회로 ECE2245 2/29


Objectives

Topics introduced in this chapter:


• Difference between Analog and Digital System
• Difference between Combinational and Sequential Circuits
• Binary number and digital systems
• Number systems and Conversion
• Add, Subtract, Multiply, Divide Positive Binary Numbers
• 1’s Complement, 2’s Complement for Negative binary number

• BCD code, 6-3-1-1 code, excess-3 code

인하대 전자과 디지털논리회로 ECE2245 3/29


1.1 Digital Systems and Switching Circuits
Digital
Digital systems
systems
computation, data processing, control, communication, measurement
Reliable, Integration

Analog – Continuous
- Natural Phenomena
(Pressure, Temperature, Speed…)
- Difficulty in realizing, processing using electronics
Digital – Discrete
- Binary Digit  Signal Processing as Bit unit
- Easy in realizing, processing using electronics
- High performance due to Integrated Circuit Technology

인하대 전자과 디지털논리회로 ECE2245 4/29


Binary Digit?

Binary
Binary
•Two values(0, 1)
•Each digit is called as a “bit”

Good
Good things
things in
in Binary
Binary Number
Number
•Number representation with only two values (0,1)
•Can be implemented with simple electronics devices
(ex: Voltage High(1), Low(0) ; Switch On (1) Off(0)…)

인하대 전자과 디지털논리회로 ECE2245 5/29


Switching Circuit

•Combinational Circuit :
•outputs depend on only present inputs, not on past inputs
•Sequential Circuit:
•outputs depend on both present inputs and past inputs
•have “memory” elements

Figure 1-1: Switching circuit


인하대 전자과 디지털논리회로 ECE2245 6/29
1.2 Number Systems and Conversion

Decimal:
Decimal: 953.7810  9 10 2  5 101  3 100  7 10 1  8 102

Binary:
Binary: 1011.112  1 23  0  2 2  1 21  1 20  1 2 1  1 2 2
1 1 3
 8  0  2 1   11  11.7510
2 4 4

Radix(Base):
Radix(Base): N  (a4 a3a2 a1a0 .a1a 2 a3 ) R
 a4  R 4  a3  R 3  a2  R 2  a1  R1  a0  R 0
 a1  R 1  a 2  R  2  a3  R 3

3
Octal-Decimal:
Octal-Decimal: 147.38  1 82  4  81  7  80  3  81  64  32  7 
8
 103.37510
Hexa-Decimal:
Hexa-Decimal: A2 F16  10  16 2  2 161  15  16 0  2560  32  15  260710

인하대 전자과 디지털논리회로 ECE2245 7/29


1.2 Number Systems and Conversion

Conversion
Conversion of
of Decimal
Decimal to
to Base-R
Base-R

N  (an an 1    a2 a1a0 ) R  an R n  an 1 R n 1      a2 R 2  a1 R1  a0
N
 an R n 1  an 1 R n  2      a2 R1  a1  Q1 , remainder a0
R

Q1
 an R n 2  an 1 R n 3      a3 R1  a2  Q2 , remainder a1
R

Q2
 an R n 3  an 1 R n  4      a3  Q3 , remainder a2
R

인하대 전자과 디지털논리회로 ECE2245 8/29


1.2 Number Systems and Conversion

Example:
Example: Decimal
Decimal to
to Binary
Binary Conversion
Conversion

2 53

2 26 rem. = 1 = a0
2 13 rem. = 0 = a1

2 6 rem. = 1 = a2 5310  1101012

2 3 rem. = 0 = a3

2 1 rem. = 1 = a4

0 rem. = 1 = a5

인하대 전자과 디지털논리회로 ECE2245 9/29


1.2 Number Systems and Conversion
Conversion
Conversion of decimal fraction
of aa decimal fraction to
to Base-R
Base-R

F  (.a1a 2 a3    a m ) R  a1 R 1  a2 R 2  a3 R 3      a m R  m


FR  a1  a2 R 1  a3 R 2      a m R  m1  a1  F1
F1 R  a2  a3 R 1      a m R  m  2  a 2  F2
F2 R  a3      a m R  m 3  a3  F3

Example:
Example:
F  .625 F1  .250 F2  .500
 2  2  2 .62510  .1012
1.250 0.500 1.000
(a1  1) (a 2  0) (a3  1)

인하대 전자과 디지털논리회로 ECE2245 10/29


1.2 Number Systems and Conversion

Example:
Example: Convert
Convert 0.7
0.7 to
to binary
binary
.7
2
(1).4
2
(0).8
2
(1).6
2
(1).2
2
(0).4 Process starts repeating here because .4 was previously
2 obtained
(0).8 0.710  0.1 0110 0110 0110   2

인하대 전자과 디지털논리회로 ECE2245 11/29


1.2 Number Systems and Conversion
3
Example:
Example: Convert
Convert 231.3
231.344 to
to base-7
base-7 231.34  2 16  3  4  1   45.7510
4

7 45 .75
7 6 rem.3 7
(5).25 45.7510  63.5151   7
0 rem.6
7
(1).75
7
(5).25
7
(1).75
Conversion
Conversion of
of Binary
Binary to
to Hexa
Hexa
1001101 .010111 2  0100
 1101
 0101
 1100
  4 D.5C16
4 D 5 C

인하대 전자과 디지털논리회로 ECE2245 12/29


1.2 Number Systems and Conversion

Conversion
Conversion of
of Binary
Binary to
to Octal,
Octal, Hexa-decimal
Hexa-decimal

 (101011010111 )2
= ( 5 3 2 7 )8, octal

 (10111011)2
= ( 2 7 3 )8, octal

 (1010111100100101)2
= ( A F 2 5 )16, Hexadecimal

 (1101101000)2
= ( 3 6 8 )16, Hexadecimal

인하대 전자과 디지털논리회로 ECE2245 13/29


1.3 Binary Arithmetic

Addition
00 0
0 1  1
1 0 1
1 1  0
and carry 1 to the next column

Example:
Example: 1111 carries
1310  1101
1110  1011
11000  2410

인하대 전자과 디지털논리회로 ECE2245 14/29


1.3 Binary Arithmetic

Subtraction
00  0
0 1  1 and borrow 1 from the next column
1 0 1
1 1  0

Example:
Example:
1 (indicates 1111 borrows 111 borrows
a borrow
11101 10000 111001
From the
 10011 3rd column)  11  1011
1010 1101 101110

인하대 전자과 디지털논리회로 ECE2245 15/29


1.3 Binary Arithmetic
Subtraction
Subtraction Example
Example with
with Decimal
Decimal column 2 column 1

205
 18
205  18  [2  102  0  101  5  100 ] 187
[ 1 101  8  100 ]
note borrow from column 1
 [2  102  (0  1)  101  (10  5)  100 ]
[ 1 101  8  100 ]
note borrow from column 2
 [(2  1)  102  (10  0  1)  101  15  100 ]
[ 1)  101  8  100 ]
 [1 102  8  101  7  100 ]  187

인하대 전자과 디지털논리회로 ECE2245 16/29


1.3 Binary Arithmetic

Multiplication 0 0  0 Multiply:
Multiply: 13
13 x11
x11(10)
(10)
1101
1011
0 1  0 1101
1 0  0 1101
1 1  1 0000
1101
1111 multiplicand 10001111  14310
1101 multiplier
1111 first partial product
0000 second partial product
(01111 ) sum of first two partial products
1111 third partial product
(1001011) sum after adding third partial product
1111 fourth partial product
11000011 final product (sum after adding fourth partial prodoct)

인하대 전자과 디지털논리회로 ECE2245 17/29


1.3 Binary Arithmetic

Division
1101
1011 10010001
1011
1110
1011
1101 The quotient is 1101 with a
remainder
1011
of 10.
10

인하대 전자과 디지털논리회로 ECE2245 18/29


1.4 Representation of Negative Numbers
bn – 1 b1 b0

Magnitude
MSB
(a) Unsigned number

bn – 1 bn – 2 b1 b0

Magnitude
Sign
0 denotes + MSB
1 denotes –
(b) Signed number

인하대 전자과 디지털논리회로 ECE2245 19/29


1.4 Representation of Negative Numbers
2’s
2’s complement
complement of
of aa positive integer NN
positive integer

N *  2n  N

Table 1-1: Signed Binary Integers (word length n = 4)

인하대 전자과 디지털논리회로 ECE2245 20/29


1.4 Representation of Negative Numbers

1’s
1’s complement
complement of
of aa positive integer NN
positive integer N  (2 n  1)  N

Example:
Example: 2 n  1  111111
N  010101
N  101010

2 의 보수와 1 의 보수 관계 N *  2 n  N  ( 2 n  1  N )  1  N  1
== 2’s complement: 1’s complement + ‘1’

N  2 n  N * and N  (2 n  1)  N

인하대 전자과 디지털논리회로 ECE2245 21/29


1.4 Representation of Negative Number
Addition of 2’s complement Numbers

3 0011
Case
Case 11
4 0100
7 0111 (correct answer)
Case
Case 22 5 0101
6 0110
1011 wrong answer because of overflow (+11 requires
5 bits including sign)
Case
Case 33 5 0101
6 1010
1111 (correct answer)
Case
Case 44 5 1011
6 0110
(1)0001 correct answer when the carry from the sign bit
is ignored (this is not an overflow)
인하대 전자과 디지털논리회로 ECE2245 22/29
1.4 Representation of Negative Numbers
Addition of 2’s complement Numbers

Case
Case 55 3 1101
4 1100
7 (1)1001 correct answer when the last carry is ignored
(this is not an overflow)

Case
Case 66 5 1011
6 1010
(1)0101 wrong answer because of overflow
(-11 requires 5 bits including sign)

인하대 전자과 디지털논리회로 ECE2245 23/29


1.4 Representation of Negative Numbers
Addition of 1’s complement Numbers

Case 5 0101
Case 33
6 1001
1 1110 (correct answer)

Case
Case 44 5 1010
6 0110
(1) 0000
1 (end-around carry)
0001 (correct answer, no overflow)

인하대 전자과 디지털논리회로 ECE2245 24/29


1.4 Representation of Negative Numbers
Addition of 1’s complement Numbers

Case
Case 55 3 1100
4 1011
(1) 0111
1 (end-around carry)
1000 (correct answer, no overflow)

Case
Case 66 5 1010
6 1001
(1) 0011
1 (end-around carry)
0100 (wrong answer because of overflow)

인하대 전자과 디지털논리회로 ECE2245 25/29


1.4 Representation of Negative Numbers

Addition of 1’s complement Numbers


11110100 ( 11)
11101011  ( 20)
(1) 11011111
1 (end-around carry)
11100000  31

Addition of 2’s complement Numbers

11111000 (8)
00010011  19
(1)00001011  11

(discard last carry)

인하대 전자과 디지털논리회로 ECE2245 26/29


1.5 Binary Codes
9 3 7.2 5
    
1001 0011 0111 . 0010 0101

8-4-2-1
Decimal 6-3-1-1 Excess-3 2-out-of-5 Gray
Code
Digit Code Code Code Code
(BCD)
0 0000 0000 0011 00011 0000
1 0001 0001 0100 00101 0001
2 0010 0011 0101 00110 0011
3 0011 0100 0110 01001 0010
4 0100 0101 0111 01010 0110
5 0101 0111 1000 01100 1110
6 0110 1000 1001 10001 1010
7 0111 1001 1010 10010 1011
8 1000 1011 1011 10100 1001
9 1001 1100 1100 11000 1000
인하대 전자과 디지털논리회로 ECE2245 27/29
1.5 Binary Codes

6-3-1-1
6-3-1-1 Code:
Code:

N  w3a3  w2 a2  w1a1  w0 a0

N  6 1  3  0  1 1  1  1  8

ASCII
ASCII Code
Code

1010011 1110100 1100001 1110010 1110100


S t a r t

인하대 전자과 디지털논리회로 ECE2245 28/29


1.5 Binary Codes

Table 1-3
ASCII code
(incomplete)

인하대 전자과 디지털논리회로 ECE2245 29/29

You might also like