introduction to digital logic designyu.ac.kr/~shkwon/lectures/dc/dc_ch1.pdf · ge a ge 0 9...

78
Introduction to Digital Logic Design by Soon H. Kwon http://yu.ac.kr/~shkwon Phone: 053-810-3514 E mail: shkwon@yu ac kr E-mail: shkwon@yu.ac.kr Office: EE Hall 214, Yeungnam Univ.

Upload: others

Post on 02-Feb-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to Digital Logic Design

by Soon H. Kwon

http://yu.ac.kr/~shkwonPhone: 053-810-3514

E mail: shkwon@yu ac krE-mail: [email protected]: EE Hall 214, Yeungnam Univ.

Chapter 1

Digital Systems and Information

Chapter 1 Digital Systems and Information

1.1 Systems: Digital and Analog1 2 Information Representation: Number Systems1.2 Information Representation: Number Systems

1.2.1 Binary and Other Number Systems1.2.2 Base Conversions1 2 3 Arithmetic Operations1.2.3 Arithmetic Operations1.2.4 Complements: Two’s and One’s1.2.5 Binary Coded Decimal (BCD)1.2.6 Unit-Distance Codes: Gray Codesy1.2.7 Seven Segment Codes1.2.8 Alphanumeric Codes1.2.9 Error-Detection1.2.10 Error-Correction

1.3 The Design Process for Combinational Systems1.4 Don’t Care Conditions1.5 The Development of Truth Tables

Problems

1.1 Systems: Digital and Analog

★ Information representation

Korean:

* 기본: ㄱ, ㄴ, …, ㅎ, ㅏ, ㅑ, …, ㅡ, ㅣ

* 조합: 디지털 논리 회로, 영남대학교

English:

* 기본: a, b, c, …, z

조합 di i l l i i i Y U i i* 조합: digital logic circuits, Yeungnam University

Arabic Numbers:

* 기본: 0 1 2 9* 기본: 0, 1, 2, …, 9

* 체계(진법):

- 2진법: {0, 1} 기본 정보 개수 2개로 단순화, 단 자릿수 증대!진법 { , } 기본 정 개수 개 단순화, 단 자릿수 증대

- 7진법: {0, 1, 2, …, 6} - 10진법: {0, 1, 2, …, 9}

조합: 2003 810 3514 3 14* 조합: 2003, 810, 3514, 3.14

1.1 Systems: Digital and Analog

* Design of Digital Systems

Digital Logic Design

* Digital: 정해진 구간 내에서 미리 정해진 유한개의 이산 값들만 사용하여 정보를 표현하는 방식

[예] - 학년(1, 2, 3, 4학년), 나이, 건물의 층수

* System: A mathematical model or abstraction of a physical process that relates inputs or external forces to the output or response of the system

- 스위치 On과 Off, 명제의 참과 거짓- {0, 1}로 표시되는 2진수

[예]p p y

* Logic: 올바른 사고의 형식 및 법칙을 연구하는 학문(Realm of human reasoning that tells you

[예]- 전동기 시스템: 입력인 전기에너지를

출력인 기계적 에너지로 변환

(Realm of human reasoning that tells you a certain proposition (declarative statement) is true if certain conditions are true)

[예] - The light is on only if the bulb is not

burned out and the switch is on.- AND NOT OR- AND, NOT, OR

1.1 Digital, Analog and Coding

* 연속(continuous) 방식- 구간내의 신호 값을 구간에 대응하는 모든 실수 값으로 표현하는 방식- 종속변수에 한하여 아날로그(analog) 방식 이라는 표현을 혼용종속변수에 한하여 아날로그(analog) 방식 이라는 표현을 혼용

* 이산(discrete) 방식- 구간내의 신호 값을 유한개의 값으로만 표현하는 방식

* 부호화(coding)신호의 표현방식을 바꾸어 나타내는 것- 신호의 표현방식을 바꾸어 나타내는 것

- 디지털→ 디지털, 디지털→ 아날로그, 아날로그→ 디지털, 아날로그→ 아날로그* 표본화(sampling)

- 연속신호를 이산적인 시간에 대응하는 불연속적인 값의 집합으로 표시하는 것

+V +V

연속신 를 이산적인 시간에 대응하는 불연속적인 값의 집합 시하는 것* 양자화(quantization)

- 표본화된 신호의 크기들을 이산적으로 단계화 하는 과정

2 ππ

+V

age

+V

age

0 9 10 11 12 13 14 15 16

t im e

2 π

Volt

a

t im eVolt

a0 1 2 3 4 5 6 7 8

0 9 10 11 12 13 14 15 16

-V -V

(a) 아날로그 신호 (b) 디지털 신호

1.1 Digital, Analog and Coding

(a) 아날로그 신호 (b) 표본화된 아날로그 신호

(c) 양자화된 디지털 신호

1.1 Systems: Digital and Analog

신 호 특 성Continuous time /continuous amplitude

* also known as an analog signal

f ti f th i d d t ti i bl ti/continuous amplitude * a function of the independent, continuous variable time

* range of the amplitude of the function is continuous

Continuous time /discrete amplitude

* a function of the independent, continuous variable time

* while the range of values for the amplitude is discreteg p

* generated by a digital-to-analog (D/A) converter prior to lowpass filtering

Discrete time /continuous amplitude

* also known as a sampled signal

* a function of the independent, quantized variable time

* the range of the amplitude is continuous* the range of the amplitude is continuous

* It is common for the intervals between the quantized time samples to be uniformly

spaced, but this is not necessary.

* The output of a sample-and-hold device is an example of type of signal.

Discrete time

/discrete amplitude

* A function for which both the independent variable time and the range of the amplitude

of the function are quantized.

* Often the quantization in time is at uniform intervals.

* If the quantization in amplitude is also uniform, then the function is often called a digital

signal because such signals are generated by an analog-to-digital (A/D) converter.

* The output of a code, a coding device used in communications, is also a digital signal.

Discrete time sequence * Sequence of numbers defined for uniform intervals of an independent variable time, t;

that is t=nT where T is the time interval between successive values in the sequencethat is, t nT, where T is the time interval between successive values in the sequence

and n is an integer greater than or equal to zero.

* We denote the values of the numbers in the sequence by x(nT) or more simply by x(n) or

by xn.

1.1 Systems: Digital and Analog

Continuous time and continuous amplitude

-

Fig. 1.0 Examples of four types of signals

1.1 Systems: Digital and Analog

☆ 논리(Logic )

* 올바른 사고의 형식 및 법칙을 연구하는 학문

(Realm of human reasoning that tells you a certain proposition (declarative statement) is true if certain conditions are true)(declarative statement) is true if certain conditions are true)

* 연산자: AND, NOT, OR

* [예] 명제 P: The light is on only if the bulb is not burned out and the switch is on.

- 명제 P1: The light is on

- 명제 P2: the bulb is burned out 명제

- 명제 P3: the switch is on

전체 명제 P: P1 only if NOT(P2) AND P3- 전체 명제 P: P1 only if NOT(P2) AND P3.

- 각각의 명제 P1, P2, P3의 진리값을 바탕으로 전체 명제 P의 진리값을 추론

1.1 Systems: Digital and Analog

★ 시스템의 신호* 입력(Inputs, causes):수(0, 1, …,9), 문자(한글, 영어), 기호(@, !)

* 출력(Outputs, effects): 수(0, 1, …,9), 문자(한글, 영어), 기호(@, !)

* 상태(States): 수(0, 1, …,9), 문자(한글, 영어), 기호(@, !)f f- a minimal set of variables chosen such that if their values are known at

time to and all inputs are known for times greater than to, one can calculate the outputs of the system for times greater than to.

t=tf 에서의 출력

t=to초기값, 입력

★ 시스템의 해석 및 설계 절차(1) 입력 변수, 상태변수 및 출력변수를 정함(2) 각 변수 사이의 관계를 H/W 혹은 S/W로 구현

1.1 Systems: Digital and Analog

★ 디지털 시스템(Digital systems)

* 모든 신호(입력, 출력, 상태)가 이산값(dsicrete values)으로 나타내지는 시스템* 컴퓨터, 계산기, 휴대전화기 등등* 2가지 값(0 와 1)만을 사용하는 two-valued signals

전압 볼트와 볼트- 전압: 0볼트와 5볼트- 자장: 어느 한쪽 방향과 그 반대 방향- 스위치: 위와 아래

조명: 과 ff- 조명: on과 off* 디지털 정보의 기본 단위: binary digit (bit)* 다치 신호(multivalued signals)

십진수: 0 9- 십진수: 0~9- 문자: ㄱ, ㄴ, …, ㅎ, ㅏ, ㅑ, …, ㅡ, ㅣ

★ 아날로그 시스템(Analog systems)★ 아날로그 시스템(Analog systems)* 모든 신호(입력, 출력, 상태)가 연속값(continuous values)으로 나타내지는 시스템

1.1 Systems: Digital and Analog

★ 디지털 시스템의 동작: 같은 디지털 시스템을 표현하는 아래 3가지 표현법 중 어느 것을 택해도 됨

① 입력신호와 출력 신호 사이의 관계를 나타내는 명제(Propositions)로 표시② 입력신호의 모든 가능한 조합에 해당하는 출력 신호를 표시하는 진리표(T h bl )로 표시② 입력신호의 모든 가능한 조합에 해당하는 출력 신호를 표시하는 진리표(Truth tables)로 표시③ 입력신호와 출력 신호 사이의 관계를 부울함수(Boolean functions)로 표시

* [CE1]① A system with three inputs, A, B, and C, and one output, Z, such that Z = 1 iff three of the inputs are 1.y p p p

② 진리표 ③ 부울 함수: Z = AB + AC + BC

★ 디지털 시스템의 종류* 조합회로(Combinational circuits): 출력이 그 순간에 입력되는 입력값 만에 의하여 결정되는 회로(덧셈기, Encoder 등)* 순차회로(Sequential circuits): 출력이 그 순간에 입력되는 입력값 뿐만 아니라 과거의 입력값 및 과거의 출력값에 의하여순차회 ( q ) 출력이 순간에 입력되는 입력값 뿐만 아니라 과거의 입력값 및 과거의 출력값에 의하여

결정되는 회로 (Flip/flop, Counter, register, 등)

1.1 Systems: Digital and Analog

√ Data types1) 디지털 데이터(Digital data)* Data in the form of digits* Data in the form of digits,

i.e. implying data expressed asdigits(정보의 기본 단위)

* Information contents: 배열(arrangements)

* [Ex.]: 이진신호(Binary signal)- 오직 2개의 상태만을 갖는 신호- High-Low, 1-0, On-Off

* bit: binary digit* bit: binary digit* Logic levels: 1, 0을 나타내는 전압* Positive logic

- High(1, On)-Low(0, Off)* Negative logicNegative logic

- High(0, Off)-Low(1, On)* Code: 특정한 체계를 갖는 0, 1의 조합

2) 아날로그 데이터(Analog data)* Data in the form of continuouslyvariable physical quantitiesvariable physical quantities

* Information contents: 값(values)

1.1 Systems: Digital and Analog

★ Continuing Examples (CE)

[CE2] A single light (that can be on or off) that can be controlled by any one of three it h O it h i th t / ff it h If it i ff th li ht ff Whswitches. One switch is the master on/off switch. If it is off, the lights are off. When

the master switch is on, a change in the position of one of the other switches (from up to down or from down to up) will cause the light to change state.

[CE3] A system to do 1 bit of binary addition. It has three inputs (the 2 bits to be added plus the carry from the next lower order bit) and produces two outputs, a sum bit and a carry to the next higher order position.

[CE4] A system that has as its input the code for a decimal digit, and produces as its output the signals to drive a seven-segment display, such as those on most digital watches and numeric displays (more later)digital watches and numeric displays (more later).

[CE5] A system with nine inputs, representing two 4-bit binary numbers and a carry input, and one 5-bit output, representing the sum. (Each input number can range f 0 t 15 th t t f 0 t 31 )from 0 to 15; the output can range from 0 to 31.)

1.1 Systems: Digital and Analog

★ 디지털 기술의 특징

특징요소 아날로그 디지털특징요소 아날로그 디지털

잡음(전기,온도) 약 강속도 강 약저장 약 강집적 약 강융통성 약 강정확도 약 강정확도 약 강프로그램화 약 강

★ The Digital Advantage

* Data Processing Data Processing* Data Transmission* Data Storage

1.1 Systems: Digital and Analog

★ 디지털기술 발전역사

1642 Blaise Pascal 기계적 덧셈기1671 Gottfried 곱셈기 나눗셈기 고안1833 Charles Babbage 자동계산기계 고안1854 George Boole 부울대수학1854 George Boole 부울대수학1938 Claude E. Shannon 스윗칭 대수학1943 Digital computing machine Harvard Mark 11946 ECKERT,MAUCHLY 진공관 컴퓨터 18,000 Tubes

ENIAC, Penn.Univ. 1947 BRATTAIN,

BARDEEN,SHOCKLEY 트랜지스터1951 The first commercially produced computer1951 The first commercially produced computer

UNIVAC (UNIVersal Automatic Computer)1958 트랜지스터와 진공관 사용한 컴퓨터1960 트랜지스터만 사용한 컴퓨터1960년대 중반 제3세대 컴퓨터: IBM System 3601970년대 중반 INTEL 마이크로프로세서

1.1 Systems: Digital and Analog

★ IC 기술 발전사

세대 구분 Intel Microprocessor71년 4004 23001세대: 40년대 진공관

2세대: 50년대 트랜지스터3세대: 60년대 집적회로4세대: 70년대 LSI

71년: 4004 230074 8080 450076 8085 650078 8086 290004세대: 70년대 LSI 78 8086 2900080 8028686 8038688 8048693 P ti 3 100 000 66M93 Pentium 3,100,000 66M

1.1 Systems: Digital and Analog

★ Basic Logic Operations and Symbols

* NOT: changes one logic level to the opposite logic level

* AND: produces a HIGH output only if all the inputs are HIGH

* OR: produces a HIGH output when any of the inputs is HIGH OR produces a HIGH output when any of the inputs is HIGH

1.1 Systems: Digital and Analog

* Tablet-counting and bottling control system

1.2 Information Representation: Number Systems

★ 정보의 표현(Information representation):

* 수(Numbers), 음성(Voice), 영상(Images), 언어(Languages)- 형식언어(Formal languages): Assembly language C Fortran Java형식언어(Formal languages): Assembly language, C, Fortran, Java- 자연언어(Natural languages): Korean, English, Chinese, Japanese

★ 수의 체계(Number Systems)

* The radix representation from the Hindus via Arabia* The position of a symbol within a number indicates the multiplication by any

relevant power of the base* A special symbol is used to represent nothing (zero: ‘0’)

★ r진수의 숫자 N의 표현:

∑−

−=

−=++++++++=

12

2

1

1

0

0

1

1

2

2

1

1 )()(n

mi

i

i

m

m

n

n

n

nr rcrcrcrcrcrcrcrcN: the most significant digits (MSD): the least significant digits (LSD)

[Ex] 10진수: 10 digits (0 1 2 3 4 5 6 7 8 9)을 써서 표현

cn 1−c m−

[Ex] 10진수: 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)을 써서 표현* 724.5 = 7 x 102 + 2 x 101 + 4 x 100 + 5 x 10-1

7 : MSD5 : LSD

1.2.1 Binary and Other Number Systems

진수와 문자표 1.3표 1.2

16진 문자의 해당 십진수

진수(기수) r 문자들 16진수 10진수

16진 문자의 해당 십진수

2 (2진)3

(0, 1)(0, 1, 2)

AB

1011

45

8 (8진)

( , , )(0, 1, 2, 3)(0, 1, 2, 3, 4)

(0 1 2 3 4 5 6 7)

CDEF

121314158 (8진)

10 (10진)

(0, 1, 2, 3, 4, 5, 6, 7)

(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

F 15

16 (16진) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)

1.2.1 Binary and Other Number Systems

1.2.1 Binary and Other Number Systems

[Ex] 2진수: 2 digits (0, 1)을 써서 표현* (110101.11)2= 1 x 25 + 1 x 24 + 0 x 23 + 1 x 22 + 0 x 21 + 1 x 20 + 1 x 2-1 + 1 x 2-2

= (32 + 16 + 0 + 4 + 0 + 1 + 0.5 + 0.25)10= (53.75)10

[Ex] 5진수: 5 digits (0, 1, 2, 3, 4)을 써서 표현

(312 4) = 3 x 52 + 1 x 51 + 2 x 50 + 4 x 5-1(312.4)5= 3 x 52 + 1 x 51 + 2 x 50 + 4 x 5-1

= (75 + 5 + 2 + 0.8)10= (82.8)10

[Ex] 8진수(Octal): 8 digits (0 1 2 3 4 5 6 7)을 써서 표현[Ex] 8진수(Octal): 8 digits (0, 1, 2, 3, 4, 5, 6, 7)을 써서 표현

(127.4)8= 1 x 82 + 2 x 81 + 7 x 80 + 4 x 8-1

= (64 + 16 + 7 + 0.5)10= (87 5)= (87.5)10

[Ex] 16진수(Hexadecimal): 16 digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)을 써서 표현

(B65F) = 11 x 163 + 6 x 162 + 5 x 161 + 15 x 160(B65F)16= 11 x 163 + 6 x 162 + 5 x 161 + 15 x 160

= (46687)10

1.2.2 Base Conversions

* x 진수의 y 진수로의 변환방법: x 진수 ⇒ 10 진수 ⇒ y 진수-정수 부분: 기저(r)로 반복하여 나눈 후 나타나는 나머지를 차례대로 나열하여 변환-소수 부분: 기저(r)를 반복하여 곱한 후 나타나는 몫을 차례대로 나열하여 변환

* [예제] 233.210 을 4진수로 변환하는 문제

정수 부분 소수점 부분정수 부분 소수점 부분몫 나머지 곱의 값 올림

233 / 4 = 58 - 1 (LSD) 4 * (.2) = 0.8 - 0 (MSD)

58 / 4 = 14 - 2 4 * (.8) = 3.2 - 3

14 / 4 = 3 - 2 4 * ( 2) = 0 8 - 014 / 4 3 2 4 * (.2) 0.8 0

3 / 4 = 0 - 3 (MSD) 4 * (.8) = 3.2 - 3 (LSD)

233 3 2 2 1 0 2 030323310 = 3 2 2 1 4 0.2`10 = .03034 …

∴ 233.210=3221.03034…

1.2.2 Base Conversions

S ta r t 정수 부분의 진수변환 플로우차트

Inpu tN and rN and r

/N/r = Q , RS ave R a s LS D

R = M S Din Rad ix r

Q /r = Q , RS ave R

O utputRad ix rNum ber

NO Y ESQ = 0?

S to p

Q = 0?

1.2.2 Base Conversions

S ta r t소수 부분의 진수변환 플로우차트

Inpu tNf a nd r

(r ) (Nf) = Ip^Fp I = LS Df p p

Ip = M S DIp = LS D

O utpu tRad ix rNum ber(r ) (Fp) = Ip^Fp

S ave Ip

Nf f ti l b t b t d

NO Y ESFp = 0?

S to p

Nf fractional number to be converted.P product, where IpFp and ^means tied together.Ip integer part of P.Fp fractional part of P.r radix of new number.p

1.2.2 Base Conversions: x 진수 ⇒ y 진수 로 직접 변환

*[Ex] 2 to 8 변환: 소수점을 기준으로 좌우로 3자리씩 묶어 1자리수로 처리

2진수 3자리씩 묶어 → 8진수 1자리수로 변환2진수 3자리씩 묶어 8진수 1자리수로 변환

(010 110 001 101 011. 111 100 000 110)2 = (26153.7406)8

[ ] 변환 소수점을 기준으로 좌우로*[Ex] 8 to 2 변환: 소수점을 기준으로 좌우로

8진수 1자리수를 → 2진수 3자리수로 변환

(673.12)8 = (110 111 011. 001 010)28 2

*[Ex] 2 to 16 변환 : 소수점을 기준으로 좌우로

2진수 4자리씩 묶어 → 16진수 1자리 수로 변환2진수 4자리씩 묶어 → 16진수 1자리 수로 변환

(0010 1100 0110 1011. 1111 0000 0110)2 = (2C6B.F06)16

*[Ex] 16 to 2 변환: 소수점을 기준으로 좌우로

16진수 1자리를 → 2진수 4자리 수로 변환

(3A6 C)16 = (0011 1010 0110 1100)2= (11 1010 0110 11)2(3A6.C)16 (0011 1010 0110. 1100)2 (11 1010 0110. 11)2

1.2.2 Base Conversions

10진수, 2진수, 8진수, 16진수

* [예제] 10진수 2진수 8진수 16진수

01

00000001

0001

01

* [예제]

010011110111.1101010102 의 16진수변환

0100, 1111, 0111.1101, 0101, 00002

1234

0001001000110100

01020304

1234

4 F 7 . D 5 0 (16)

=4F7.D5016

5678

0101011001111000

05060710

5678

* [예제]

F37A.B216 의 2진수 변환89

1011

1000100110101011

10111213

89AB

F 3 7 A . B 2 (16)

1111 0101 0111 1010 . 1011 0010 (2)

12131415

1100110111101111

14151617

CDEF

= 1111010101111010.101100102

15 1111 17 F

1.2.3 Arithmetic Operations (사칙연산: +, -, *, /)

a b a+b

0 0 0

입력 출력

표 2진 가산 (+)0 0 0

0 1 1

1 0 1

가수 피가수 자리올림 합 자리올림

1 1 0(1)*

*(1): carry

000

001

010

011

000

*[예제] 2진 가산

자리올림 1 11111 10111

1001

1010

0100

1011

가수 01110.102 = 14.5010

피가수 11011.112 = 27.5010

합 1 01010.012 42.5010

11

11

01

01

11

1.2.3 Arithmetic Operations

*[예제] 2진수 감산

입력 출력

표 2진 감산피감수 1 0 1 1 0 1 02 = 9010

감수 0 1 0 1 1 1 02 = 4610

차 0 1 0 1 1 0 02 = 4410

열 7 6 5 4 3 2 1 입력 출력

피감수 감수 빌림 수 차 빌림 수

열 7 6 5 4 3 2 1

피감수 감수 림 차 림

000

001

010

011

011

a b a b 0111

1001

1010

0100

1000

a b a-b

0 0 0

0 1 1(1)* 11

11

01

01

01

0 1 1(1)*

1 0 1

1 1 0

*(1): borrow

1.2.3 Arithmetic Operations

*[예제] 2진수의 곱셈 구하기

10110 1 = 22 5

*[예제] 2진수의 나눗셈 구하기

00101 1010110.1 = 22.501001.1 = 9.510110 1

101101

00101.10101 11011.10

101111

000000000000

101101000000

10110 110 1

0000000011010101.11 = 213.7510

0

* Use the same procedure as decimal division

a b a*b

0 0 0

0 1 0

a b a/b

0 0 X

0 1 00 1 0

1 0 0

1 1 1

0 1 0

1 0 X

1 1 11 1 1 1 1 1

X: undefined

1.2.4 Complements: Two’s and One’s

★ 부호 있는 수(Signed numbers)

* (symbol) N : +N (positive number) -N (negative number)(symbol) N : +N (positive number), N (negative number)

* 부호 비트(Sign bit) 사용 – 0: 양수, 1: 음수

# (sign bit) (magnitude bit)

( ) ( )# 0sN (positive number), 1sN (negative number)

# 00011001 (+25), 10011001 (-25)

★ Graphical interpretation of signed numbersp p g

1.2.4 Complements: Two’s and One’s

★ 보수(complement)의 개념* an (unsigned) number N1 representing a measurement relative to the true origin

( i d) b N ti t l ti t th ff t i i* an (unsigned) number N2 representing a measurement relative to the offset origin

* N1 and N2 can denote the same quantity without ambiguity as long as the referencefor the measurement is known

t id th f d ti i d titi* to provide another means for denoting signed quantities

★ Graphical interpretation of complements

1.2.4 Complements: Two types of complements for each base-r system

* A positive number N in base r with an integer part of n digits and a fraction part ofm digits

cccccccrcrcrcrcrcrcrc)N(

m21.012n1n

mm

22

11

00

11

2n2n

1n1nr )(

−−−−−

−−

−−

−−

−−

−−

++=

++++++++=

* r's complement of a positive number N in base r with an integer part of n digits anda fraction part of m digits, the r's complement of N is defined as

⎪⎧ ≠ 0NNrnrN

여기서 rn : (n+1) 자리로 만들 수 있는 최소의 수

⎪⎩

⎪⎨⎧

=≠−=

0N,00N,NrNr

여기서, r : (n+1) 자리로 만들 수 있는 최소의 수

* (r-1)'s complement of a positive number N in base r with an integer part of n digitsand a fraction part of m digits, the (r-1)'s complement of N is defined as1rN −

여기서, : 소수점 위의 n 자리 및 소수점 아래의 m자리로

1r

NrrN mn1r −−= −−

mn rr −−만들 수 있는 가장 큰 수

1.2.4 Complements: Two types of complements for each base-r system

* r-보수 및 (r-1)-보수와의 관계:

mmnmn1 rNrNrNrrN −−− −=−−=−−=

* 정수로만 구성된 r진수 N의 경우: r-보수 = (r-1)-보수 + 1

r1r rNrNrNrrN − ===

* Finding 1’s complement- Change all the 1s to 0s and all the 0s to 1s

- Binary number 0001100100101- 1’s complement 1110011011010

* Finding 2’s complement- 2’s complement = 1’s complement +1

- Binary number 111000101010001- 1’s complement 000111010101110- Add 1

2’ l t 000111010101111- 2’s complement 000111010101111

1.2.4 Complements: Two’s and One’s★ Representation of signed numbers

[예제]* sign-magnitude form : 00011001 (+25), 10011001 (-25)* 1’s complement form : 00011001 (+25), 11100110 (-25)p ,* 2’s complement form : 00011001 (+25), 11100111 (-25)

1.2.4 Complements: Two’s and One’s

*[예제] r's complement

⎪⎧ n

( ) ' ( ) ( 3)

⎪⎩

⎪⎨⎧

=≠−=

0N,00N,NrN

nr

(a) 10's complement of (314) 10 = (103) 10 - 314 = 686

(b) 10's complement of (3.14) 10 = (101) 10 - 3.14 = 6.86

(c) 2's complement of (101100)2 = (26) 10 - (101100) 2p 2 10 2

= (1000000 - 101100) 2

= (010100) 2

(d) 2's complement of (0 0110) = (20 0 0110) = (0 1010)(d) 2 s complement of (0.0110) 2 = (20 - 0.0110) 2 = (0.1010) 2

*[예제]-1810의 2의 보수를 구하기1810의 2의 보수를 구하기

+1810=0^10010

1^011011^01101+ 0^00001

1^01110

1.2.4 Complements: Two’s and One’s

[Ex] (r-1)'s complement

( ) ' ( ) ( 5 0) ( )

NrrN mn1r −−= −−

(a) 9's complement of (25639) 10 = (105 - 100) 10 - (25639) 10

= 99999 - 25639

= 74360

(b) 9's complement of (25.639) 10 = (102 - 10-3) 10 - (25.639) 10

= 99.999 - 25.639

= 74 360= 74.360

(c) 1's complement of (101100)2 = (26 - 20) 10 - (101100) 2

= (111111 - 101100) 2

= (010011) 2

(d) 1's complement of (0.0110) 2 = (20 - 2-4) 10 - (0.0110) 2

= (0 1111 - 0 0110) 2(0.1111 0.0110) 2

= (0.1010) 2

1.2.4 Complements: Two’s and One’s

★ Subtraction with r's complements

1) 뺄셈을 위한 보수의 자리수 선택 방법:1) 뺄셈을 위한 보수의 자리수 선택 방법:

* 정수부분 자리수 n의 선택:

→ minuend M 및 subtrand S의 정수부분 중에서 최대 자리수

* 소수부분 자리수 m의 선택:* 소수부분 자리수 m의 선택:

→ minuend M 및 subtrand S의 소수부분 중에서 최대 자리수

* [Ex]

M 12 3456 S 987 6 3 4- M = 12.3456, S = 987.6 ⇒ n = 3, m = 4

- M = 123.456, S = 12.34 ⇒ n = 3, m = 3

- M = 12345.6, S = 0.9876 ⇒ n = 5, m = 4

2) Algorithm: M - S, both of base r

(step 1) Add the minuend M to the r's complement of the subtrand S.

(step 2) Inspect the result obtained in step 1 for an end carry:(step 2) Inspect the result obtained in step 1 for an end carry:

(a) If an end carry occurs, discard it.

(b) If an end carry does not occur, take the r's complement of the

number obtained in step 1 and place a negative sign in front.

1.2.4 Complements: Two’s and One’s

★ Subtraction with (r-1)'s complements

* Algorithm: M - S, both of base r

(step 1) Add the minuend M to the (r-1)'s complement of the subtrand S.

(step 2) Inspect the result obtained in step 1 for an end carry:(a) If an end carry occurs, add 1 to the least significant digit

( d d )(end-around carry).

(b) If an end carry does not occur, take the (r-1)'s complement of the

number obtained in step 1 and place a negative sign in front.

* [Ex]* [Ex]

(a) (72532 - 3250)10 = 72532 + (105 - 100 - 3250) 10 +{- (105 - 100) 10 }

= 72532 + 96749 +{- (105 - 100) 10 }

= 169281 +{- (105 - 100) 10 }169281 +{ (10 10 ) 10 }

= 69282

(b) (3250 - 72532) 10 = 3250 + (105 - 100 - 72532) 10 +{- (105 - 100) 10 }

= 3250 + 27467 +{- (105 - 100) 10 }{ ( ) 10 }

= 30717 +{- (105 - 100) 10 }

= - 69282

* 1's complement의 단점

- 두개의 덧셈 연산

- 두개의 0, 즉, +0 과 -0

1.2.4 Complements: Two’s and One’s

*[예제] X=-810 Y=-1010이고 2의 보수일 때 X+Y 구하기X=-810,Y=-1010이고 2의 보수일 때 X+Y 구하기

1^1000+ 1^0110(1)0^1110

-810 + -(1010)= -1810이고 0^1110은 –1810이 아님. 오버플로우 발생!

*[예제]X= +1210=0^1100이고 Y=+810=0^1000 일 때 X에서 Y를 감하기

0^1100- 0^10000 1000

0^0100

(+1210)-(+810)= +410

1.2.4 Complements: Two’s and One’s

<참고> BCD addition

* 더한 결과가 (1001)2보다 클 때는 결과에 (0110)2= 6을 더해야만 올바른 결과를 얻음.

* [예제]

448 8+9+0= 1000+1001=(1)0001--->(1)+0001+0110=(1)+0111

489 4 8 1 0100 1000 0001 1101 >1101 0110 (1) 0011489 4+8+1= 0100+1000+0001=1101--->1101+0110=(1)+0011

----- 4+4+1=0100+0100+0001=1001

937

1.2.5 Codes and Code Conversion

★ 코드 (Codes):

* 어떠한 의미를 갖는 기호들의 그룹* List of patterns to represent letters as well as numbers and special

symbols

k1k 2n2 ≤<−

여기서 n: 표현하고자 하는 개념의 개수k: 필요한 최소의 비트 수

* 2진 부호화 10진수 (Binary Coded Decimal): 표시 출력장치 구동* 2진 가중코드 (Weighted Codes): 연산, 전송에 적합* 단위거리코드 (Unit-Distance Code): 아날로그-디지털 변환에 유용* 단위거리코드 (Unit Distance Code): 아날로그 디지털 변환에 유용* 영숫자 코드 (Alphanumeric Codes): 문자 부호화, 입출력 장치에 사용

1.2.5 Codes and Code Conversion

★ Binary Coded Decimal* All the numbering systems addressed so far

i h d di i h l d i i

10진수 BCD

10진수의 BCD표현

were weighted, a digit has a value due it its placement in the number.

* BCD or Binary Code Decimal is a code and is t i ht d th th b i t

01

00000001

not weighted as the other numbering systems are.

* BCD is used in many applications in digital circuits 1

234

0001001000110100

circuits.

[예제] 9275.610 을 BCD 코드로 변환하기.

5678

0101011001111000

9 2 7 5 . 61001 0010 0111 0101 0110

89

100010019275.610 = 1001,0010,0111,0101.0110

1.2.5 Codes and Code Conversion

★ Weighted Codes

* The corresponding decimal digits determined by adding the weightsp g g y g gassociated with the1’s in the code group

* Weights given by the code name

* 4 bits of a code group: b3 b2 b1b0

* Weights for the corresponding bits: w3w2w1w0

* Then the decimal digit N:Then the decimal digit N:

* [Ex]

00112233 wbwbwbwbN ×+×+×+×=* [Ex]

- 8421 code:

- Excess-3 code (XS-3 code): 8421 code + 3

84 2 1 code: code with negative weights- 84-2-1 code: code with negative weights

- Biquinary code: For each decimal digit, two 1’s appear in the code group-one of these among the first 2 bits of the code group and the other among the remaining 5 bits of the code groupother among the remaining 5 bits of the code group

1.2.5 Codes and Code Conversion

Weighted Codes

10진수8421코드

Ex-3코드

5311코드

84-2-1*

코드5421코드

Biquinary5043210

012

000000010010

001101000101

000000010011

000001110110

000000010010

010000101000100100100

3456

0011010001010110

0110011110001001

0100010110001001

0101010010111010

0011010010001001

01010000110000100000110000106

789

0110011110001001

1001101010111100

1001101111001101

1010100110001111

1001101010111100

1000010100010010010001010000

표 BCD 가중치 코드의 예

1.2.5 Codes and Code Conversion

★ 자 보수 코드(self-complement code):

10진수 Ex-3 631-1 2421

표 자기 보수형 BCD 코드* 2421 코드 혹은 excess-3코드와같이 4와 5를 기준으로 서로

0 0011 0011 0000

보수 관계에 있는 코드

★ Excess-3 code (3초과 코드):

1234

0100010101100111

0010010101110110

0001001000110100

* 8421 code + 3으로 형성된 코드

4567

0111100010011010

0110100110001010

0100101111001101

89

10111100

11011100

11101111

1.2.5 Codes and Code Conversion

표 Nonweighted decimal code★ 2 ut f 5 d

10진수 Ex-3

표 Nonweighted decimal code★ 2-out-of 5 code * Exactly 2 of the 5 digits in each code group are 1’s, the remaining 3 bits being 0’s

2-out-of-5 code

0 0011 11000

3 bits being 0 s * Advantage: Error-detecting properties

1234

0100010101100111

000110010100110010014

567

0111100010011010

01001010100110010001

89

10111100

1001010100

1.2.5 Codes and Code Conversion

* U.S. Postal Service bar code corresponding to the ZIP code 14263-1045:

Application of the 2-out-of 5 code

1.2.6 Unit-Distance Codes: Gray Codes

★ Unit-Distance Codes: * code that only one bit can change between successive values

용 아날 신 를 디지털 신 변환* 용도: 아날로그 신호를 디지털 신호로 변환. 회전각, 거리 등 물리적인 양을 취급하는 데 사용

D1

0

1 1

0 0

1 1

De la y De lay

tt t tt

D0

0 0 0

Erro r ca n o curr i f d a taa re read here

t2t 1 t 3 t 4t 0

그림 동시에 두 개의 비트가 변화할 경우 발생 가능한 오류의 타이밍도

1.2.6 Unit-Distance Codes: Gray Codes

표 3비트와 4비트의 그레이 코드

y

★ Gray code: The most common unit distance code

10진수 3비트그레이 4비트그레이

M S B

0123

000001011010

0000000100110010

LS B

M S B

0

3456

010110111101

00100110011101016

789

10

0100

01010100110011011111

그림 그레이 코드 축 위치 인코더

10111213

11111110101010113

1415

010011000

1.2.6 Unit-Distance Codes: Gray Codes

* Angular position encoders.

y

(a) Conventional binary encoder.

(b) Gray code encoder.

* Angular position encoders with* Angular position encoders with

misaligned photosensing devices.

(a) Conventional binary encoder.

(b) Gray code encoder.

1.2.7 Seven Segment Codesg

★ A 7-bits code to display one of the decimal digits in 7-segment displays

1.2.8 Alphanumeric Codes

★ 영숫자 코드 (Alphanumeric Codes ):

* Codes that are used to represent characters* [Ex] (1) 7-bit American Standard Code for Information Interchange, ASCII code(2) The Unicode Standard

- 16-bit character coding system- Inclusion of English characters, those of the Middle East and Asia- Inclusion of punctuation marks, mathematical symbols, technical

symbols, geometric shapes, and dingbats

1.2.8 Alphanumeric Codes

문자 ASCII 코드 EBCDIC 문자 ASCII 코드 EBCDIC

표 16진수로 표기한 7비트 ASCII 코드와 8비트 EBCDIC 코드의 일부분

ABCD

41424344

C1C2C3C4

0123

30313233

F0F1F2F3D

EFGHI

444546474849

C4C5C6C7C8C9

345678

333435363738

F3F4F5F6F7F8

JKLMNO

4A4B4C4D4E4F

D1D2D3D4D5D6

9blank

!"#

392021222324

F9405A7F7B5BO

PQRST

4F5051525354

D6D7D8D9E2E3

%&‘()

242526272829

5B6C50704D5D

UVWXYZ

55565758595A

E4E5E6E7E8E9

*+‘

-./

2A2B2C2D2E2F

5C4E6B604B61Z 5A E9 / 2F 61

Complement Codes

보수코드 (Complement Codes)* 음의 숫자를 나타낸다* 수의 연산에 사용된다

표 부호 크기 코드와 코드 보수

* 수의 연산에 사용된다

문자 부호크기 2의 보수 1의 보수

+15 01111 01111 01111

문자 부호크기 2의 보수 1의 보수

-0 10000 00000 11111

표 부호 크기 코드와 코드 보수

+15+14+13+12+11+10

011110111001101011000101101010

011110111001101011000101101010

011110111001101011000101101010

0-1-2-3-4

5

1000010001100101001110100

0000011111111101110111100

1111111110111011110011011

+10+9+8+7+6

0101001001010000011100110

0101001001010000011100110

0101001001010000011100110

-5-6-7-8-9

1010110110101111100011001

1101111010110011100010111

1101011001110001011110110

+5+4+3+2+1

0010100100000110001000001

0010100100000110001000001

0010100100000110001000001

-10-11-12-13-14

1101011011111001110111110

1011010101101001001110010

1011010101101001001110010100011

+00000100000

0000100000

0000100000

14-15-16

1111011111

100101000110000

1000110000

1.2.9 Error-Detection

★ Error-detecting codes:

* Codes to detect the occurrence of the error Codes to detect the occurrence of the error

*[Ex] 2-out-of 5 code

- Transmitted code: 00110 → Received code: 01110

T 1 th 1- Two 1’s → three 1’s

★ 패리티 비트 (Parity bit) 방식: n bits 정보+1 Parity bit → (n+1) bits 정보y y

1) 홀수 패리티 방식(Odd parity)

* (정보+1 Parity bit) 패킷 속에 포함된 ‘1’의 개수가 홀수 (Odd)가 되도록* (정보+1 Parity bit) 패킷 속에 포함된 1’의 개수가 홀수 (Odd)가 되도록

패리티 비트의 값을 지정하는 방식

* [Ex] BCD 8421 코드

0000 → 00001

0001 → 00010

0010 → 001000010 00100

1.2.9 Error-Detection

2) 짝수 패리티 방식(Even parity)

* (정보+1 Parity bit) 패킷속에 포함된 ‘1’의 개수가 짝수 (Even)가 되도록(정보+1 Parity bit) 패킷속에 포함된 1 의 개수가 짝수 (Even)가 되도록

패리티 비트의 값을 지정하는 방식

* [Ex] BCD 8421 코드

0000 → 00000

0001 → 00011

0010 → 00101

★ By the parity-bit scheme

* It is possible to detect any odd number of errors* It is possible to detect any odd number of errors

* It is not possible to detect even number of errors

1.2.9 Error-Detection

Error-detecting capability

★ The error-detecting capability of a coding scheme:* Defined as 1 less than the minimum number of errors it can not always detect

[E ] Th it bit h : i l d t ti h

g p y

* [Ex] The parity-bit scheme: single-error detecting scheme

★ Distance between the code groups:* The number of bits that must be changed in the first code group so that the secondThe number of bits that must be changed in the first code group so that the second

code group results* [Ex]: 2-out-of-5 code

- 00101 → 01010 : 4

★ Minimum distance of a code:* The smallest distance any two valid code groups appearing in the coding scheme* [Ex]: 2-out-of-5 code : 2

★ Maximum number of bits in error that is always detectable:* D = M – 1

where D: the error-detecting capability of the codewhere D: the error detecting capability of the codeM: its minimum distance

* [Ex]: 2-out-of-5 code- D= 2 – 1 = 1→ Single-error-detecting scheme

1.2.10 Error-Correction

★ Error correcting code:

* A code with the property that the correct code word can always be deducedA code with the property that the correct code word can always be deduced from the erroneous word

* [Ex] An error-correcting code: M=3

- Transmitted word: 00011 (message M4)

- Received erroneous words: single-error

10011, 01011, 00111, 00001, 00010 → M=2 → Error! →Reconstruction

1.2.10 Error-Correction

★ Relationship between the minimum distance of a code and its error-detecting and error-correcting capabilities:g g p

C + D = M – 1

where C D

C: the number of erroneous bits that always can beC: the number of erroneous bits that always can be

corrected

D: the error-detecting capability of the code

M: its minimum distance

1.2.10 Error-Correction

* Single-error detection and correction method by using even parityschemescheme

* k 개의 패리티 비트 및 패리티 비트의 위치 정보를 이용

메시지의 비트 수 과 패리티 비트 수 k 사이의 관계* 메시지의 비트 수 m과 패리티 비트 수 k 사이의 관계:

1k2m k −−≤

1.2.10 Error-Correction

* Hamming code에서 각 패리티 비트가 검증하는 비트 위치

* Binary check number: If the recalculation of parity bit pi is thesame as the pi bit in the received Hamming code group, then ci

*

i t l t 0is set equal to 0.

*1

*2

*k ccc 12k ccc

1.2.10 Error-Correction

* [Ex] (0110)의 Hamming code

- Bit positions:Bit positions:

- Hamming code group:

1.2.10 Error-Correction

* [Ex] Hamming code

1.2.10 Error-Correction

* [Ex] (1100)의 해밍 코드

- 패리티 비트의 수 결정: 3k1k24 k =⇒−−≤패리티 비트의 수 결정:

- 7-비트 해밍 코드의 비트 위치

3⇒

1 2 3 4 5 6 7

P1 P2 M1 P3 M2 M3 M4

1 0 0 0 1 0 0; 받은 데이터 열

- P1 + M1 + M2 + M4 ⇒ c1 = E(P1) = E(1010)=1; even parity

P + M + M + M ⇒ c = E(P ) = E(0000)= 1P2 + M1 + M3 + M4 ⇒ c2 = E(P2) = E(0000)= 1

P3 + M2 + M3 + M4 ⇒ c3 = E(P3) = E(0100)= 0

⇒ (c3 c2 c1) = (011) 2 =3 ⇒ 3 번째 자리에 오류

⇒ 수신 자료 (1000100) 를 (1010100)로 수정

1.2.10 Error-Correction

★Check Sum Digits for Error Correction

* the U.S. Postal Service bar code

* Additional single digit is appended to the encoded ZIP code for single-error correctionerror correction

* (ZIP digit sum + check sum digit)mod 10 = 0

* [Ex]

- (1+4+2++6+e+1+0+4+5+4 ) d 10 = (27+e ) d 10 = 0(1+4+2++6+e+1+0+4+5+4 )mod 10 (27+e )mod 10 0

⇒ e=3

* Single-error correction plus double-error detection by appending an overall parity bit and assigning a value such that the complete codeoverall parity bit and assigning a value such that the complete code group, including its overall parity bit, contains an even number of 1’s.

1.3 The Design Process for Combinational Systems

설계 절차:

Step 1: Represent each of the inputs and output in binaryStep 1: Represent each of the inputs and output in binary.

Step 2: Formalize the design specification either in the form of a truth table or of an algebraic expression.

Step 1.5: If necessary, break the problem into smaller subproblems.

Step 3: Simplify the description.

Step 4: Implement the system with the available components, subject to the design objectives and constraints.

1.4 Don’t Care Conditions

★ Don’t care

* 시스템의 출력이 일부 입력에 대하여는 지정이 되지만 다른 일부의 입력에 대하여는 시스템의 출력이 일부 입력에 대하여는 지정이 되지만, 다른 일부의 입력에 대하여는지정이 되지 않아 출력 값으로 0과 1중 어느 값을 가져도 되는 경우

* 일반적으로 ‘X’로 표시

1.5 The Development of Truth Tables

문제기술을 진리표로 바꾸는 과정

1. 입력변수와 출력변수를 정의 한다.

2. 각 변수들에 대해 기호, 문자 또는 숫자 기호를 지정한다.

3 진리표의 크기를 결정한다3. 진리표의 크기를 결정한다.

( n: 입력변수들의 수, y: 조합들의 수 )y2n =

4. 입력변수 조합에 대한 모든 경우를 포함하는 진리표를 작성한다.

5 문제 기술을 세심하게 조사하여 출력이 참이 되도록 입력조합을 결정한다5. 문제 기술을 세심하게 조사하여 출력이 참이 되도록 입력조합을 결정한다.

1.5 The Development of Truth Tables

* [예제](1) CE1: A system with four inputs, A, B, C, and D, and one output, Z, such that

Z = 1 iff three of the inputs are 1.ee o e pu s a e(2) CE2: A single light (that can be on or off) that can be controlled by any one of

three switches. One switch is the master on/off switch. If it is off, the lights are off. When the master switch is on, a change in the position of

f th th it h (f t d f d t ) illone of the other switches (from up to down or from down to up) will cause the light to change state.

1.5 The Development of Truth Tables

1.5 The Development of Truth Tables

명제 진리표

K-map

부울식회로 부울식회로

Chapter 1 Digital Systems and Information

Problems

p g y

1.1 What is system?

1.2 What is model?

1.3 Explain the difference between digital data and analog data.

1.4 Describe the number systems.

1 5 Convert the following binary numbers to decimal:1.5 Convert the following binary numbers to decimal:

1) 1101.0101

2) 0101.1010

1.6 Convert the following decimal numbers to binary, octal, and hexadecimal:

1) 3.14

2) 60 042) 60.04

1.7 Find the following binary sums.

1) 1010 + 10011) 1010 1001

2) 110 + 1100

Chapter 1 Digital Systems and Information

Problems

p g y

1.8 Find the following binary differences.

1) 1010 - 1001

)2) 1100 – 110

1.9 Find the following binary products.

1) 1010 x 10011) 1010 x 1001

2) 110 x 1100

1.10 Divide the following binary numbers:

1) 10111101 / 101

2) 11000001 / 11

1 11 Fi d h f ll i bi diff i h 2 l h d1.11 Find the following binary differences using the 2’s complement method.

1) 10010 - 1001

2) 0100 – 11012) 0100 1101

Chapter 1 Digital Systems and Information

Problems

p g y

1.12 Explain the difference between continuous signal and discrete signal.

1.13 다음 수 1 0 0 1 1 0이 다음과 같은 체계로 표현되었다고 하였을 때의 값을

구하라.

(1) 부호 있는 절대치

(2) 부호 있는 1-보수

(3) 부호 있는 2-보수