• 검색 결과가 없습니다.

1.4 Representation of Negative Numbers

N/A
N/A
Protected

Academic year: 2022

Share "1.4 Representation of Negative Numbers"

Copied!
41
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

2차시. Ch1. Number Systems and Conversion Systems and Conversion

1.3 Binary Arithmetic

1.4 Representation of Negative Numbers

1.5 Binary Codes

(2)

1.3 Binary Arithmetic

• Addition

0 0

0 + =

(?) 0

1 1

1 0

1

1 1

0

0 0

0

= +

= +

= +

=

+

(3)

1.3 Binary Arithmetic

• Addition

1111

carries

10 10

10

24 11000

1011

11

101 1

13

=

=

=

(4)

1.3 Binary Arithmetic

• Subtraction

0 0

0 − =

0 1

1

1 0

1

(?) 1

1 0

0 0

0

=

=

=

=

(5)

1.3 Binary Arithmetic

• Subtraction with Decimal

209 10000

119008

190 − 19

9901 99

109990 9018

(6)

1.3 Binary Arithmetic

• Subtraction with Decimal

205

187 18

(7)

1.3 Binary Arithmetic

] 10 )

5 10 ( 10

) 1 0 ( 10

2 [

] 10 8

10 1

[

] 10 5

10 0

10 2

[ 18 205

0 1

2

0 1

0 1

2

× +

+

×

− +

×

=

× +

×

× +

× +

×

=

187 18

205

187 ]

10 7

10

8

10 1

[

] 10 8

10

1)

[

] 10 15

10 )

1 0 10 ( 10

) 1 2 [(

] 10 8

10

1

[

] 10 )

5 10 ( 10

) 1 0 ( 10

2 [

0 1

2

0 1

0 1

2

0 1

=

× +

× +

×

=

× +

×

× +

×

− + +

×

=

× +

×

× +

+

×

− +

×

=

(8)

1.3 Binary Arithmetic

• Subtraction

1

1 1 11 1 11

1010 0011 1

11101

1101 1 1

10000

101110 011 1

111001

(9)

1.3 Binary Arithmetic

• Multiplication

0 0

0 × =

1 1

1

0 0

1

0 1

0

0 0

0

=

×

=

×

=

×

=

×

(10)

1.3 Binary Arithmetic

• Multiplication

1111

1101

1111

multiplicand multiplier

first partial product

11000011 1111

) 1001011 (

1111

) 01111 (

0000

1111

second partial product

sum of first two partial products third partial product

sum after adding third partial product fourth partial product

final product (sum after adding fourth partial prodoct)

(11)

1.3 Binary Arithmetic

• Multiplication

1011

1101

143

10

10001111 1101

0000

1101

1101

1011

=

(12)

1.3 Binary Arithmetic

• Division

10010001

1011

1101

10

1011

1101

1011

1110

1011

10010001

1011

(13)

1.4 Representation of Negative Numbers

bn

1

b

1 b

0

Magnitude MSB

(a) Unsigned number (a) Unsigned number bn

1

b

1 b

0

Magnitude Sign

(b) Signed number bn

2

0 denotes 1 denotes

+

MSB

(14)

1.4 Representation of Negative Numbers

1111 -

1 000 -0

0000 +0

1’s complement 2’s complement

N*

Sign and magnitude

Negative integers

-N Positive

integers (all systems)

+N N

1111 1110 1101 1100 1011 1010 1001 1000

- -

1111 1110 1101 1100 1011 1010 1001 1000 1 000

1 001 1 010 1 011 1 100 1 101 1 110 1 111

- -0

-1 -2 -3 -4 -5 -6 -7 -8 0000

0001 0010 0011 0100 0101 0110 0111 +0

+1 +2 +3 +4 +5 +6 +7

(15)

1.4 Representation of Negative Numbers

• 2’s complement representation for Negative Numbers

N

N * = 2 n

(16)

1.4 Representation of Negative Numbers

• 1’s complement representation for Negative Numbers

N

N = ( 2 n − 1 ) −

(17)

1.4 Representation of Negative Numbers

2

* = − N

N n

• Relationship between 1’s and 2’s complement

1

1 )

1 2

( 2

*

+

=

+

=

=

N

N N

N

n

n

(18)

1.4 Representation of Negative Numbers

1111 -

1 000 -0

0000 +0

1’s complement 2’s complement

N*

Sign and magnitude

Negative integers

-N Positive

integers (all systems)

+N N

1111 1110 1101 1100 1011 1010 1001 1000

- -

1111 1110 1101 1100 1011 1010 1001 1000 1 000

1 001 1 010 1 011 1 100 1 101 1 110 1 111

- -0

-1 -2 -3 -4 -5 -6 -7 -8 0000

0001 0010 0011 0100 0101 0110 0111 +0

+1 +2 +3 +4 +5 +6 +7

(19)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

+ 3 0011 7

4 +

+

0111 0100

correct

(20)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

+ 5 0101 11

+ 6

1011 0110

wrong

(21)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

+ 5 0101 1

6

1111 1010

correct

(22)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

− 5 1011 1

6 +

+

0001 )

1 (

0110

correct

(23)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

− 3 1101 7

4

1001 )

1 (

1100

correct

(24)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

− 5 1011 11

6

0101 )

1 (

1010

wrong

(25)

1.4 Representation of Negative Numbers

• Addition of 1’s complement Numbers

+ 5 0101 1

6

1110 1001

correct

(26)

1.4 Representation of Negative Numbers

• Addition of 1’s complement Numbers

− 5 0110 1010 1

6 +

+

0001 1 0000 )

1 (

0110

correct

(27)

1.4 Representation of Negative Numbers

• Addition of 1’s complement Numbers

− 3 1100 1011 7

4

correct

1000 1 0111 )

1 (

1011

(28)

1.4 Representation of Negative Numbers

• Addition of 1’s complement Numbers

− 5 1010 1001 11

6

wrong

0100 1 0011 )

1 (

1001

(29)

1.4 Representation of Negative Numbers

• Addition of 2’s complement Numbers

– 캐리가 발생하면, 캐리 출력은 무시

– 캐리가 발생하지 않으면, 결과 값에서 2의 보 수를 취함

수를 취함

18 = 0001 0010 -7 = 1111 1001 --- 10000 1011

59 = 0011 1011 -96 = 1010 0000 --- 1101 1011 --- 0010 0101

(30)

1.4 Representation of Negative Numbers

• Addition of 1’s complement Numbers

– 캐리가 발생하면, 캐리를 결과값에 더함

– 캐리가 발생하지 않으면, 결과 값에서 1의 보 수를 취함

수를 취함

59 = 0011 1011 -96 = 1001 1111 --- 1101 1010 --- 0010 0101 18 = 0001 0010

-7 = 1111 1000 --- 10000 1010 1 --- 0000 1011

(31)

1.4 Representation of Negative Numbers

• 8bits: +7~-8

+ ++ ++ ++ + -- -- -- - -

(32)

1.5 Binary Codes

(33)

1.5 Binary Codes

Decimal Digit

8-4-2-1 Code (BCD)

6-3-1-1 Code

Excees-3 Code

2-out- of-5 Code

Gray Code 0

1

0000 0001

0000 0001

0011 0100

00011 00101

0000 0001 1

2 3 4 5 6 7 8 9

0001 0010 0011 0100 0101 0110 0111 1000 1001

0001 0011 0100 0101 0111 1000 1001 1011 1100

0100 0101 0110 0111 1000 1001 1010 1011 1100

00101 00110 01001 01010 01100 10001 10010 10100 11000

0001 0011 0010 0110 1110 1010 1011 1001 1000

(34)

1.5 Binary Codes

BCD

} } } } } 0101

0010

. 0111

0011

1001

5

2

.

7

3

9

(35)

1.5 Binary Codes

6-3-1-1 Code

0 0

1 1

2 2

3

3 a w a w a w a

w

N = + + +

8 1

1 1

1 0

3 1

6 ⋅ + ⋅ + ⋅ + ⋅ = N =

1011

(36)

1.5 Binary Codes

ASCII Code

(37)

ASCII Code

1.5 Binary Codes

1010011 1110100 1100001 1110010 1110100

S t a r t

(38)

1.5 Binary Codes

ASCII Code

(39)

Review- objectives

• Difference between Analog and Digital System

• Difference between Combinational and Sequential Circuits

• Binary Number and Digital Systems

• Number Systems and Conversion

• 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

(40)

용어 해설

• 영문숫자(Alphanumeric): 숫자와 심볼뿐만 아니라 알파벳을 포함하는 문자

• 아날로그(Analog): 전압, 온도, 압력, 속도와 같이 연속적으로 변하는 물리 적 양을 다루는 시스템. 자연에 존재하는 대부분의 양은 아날로그로 발생 하며, 무수히 많은 서로 다른 값을 만든다.

• 디지털(Digital): 서로 다른 두 가지의 양을 다루는 시스템. 디지털 전자공학 은 1과 0 또는 ON과 OFF를 다룬다. ASCII와 같은 디지털 코드는 출력 표시 장치를 위한 의미 있는 숫자, 문자, 심볼들로 1과 0을 변환하기 위해 사용된 다.

• 2진수(Binary): 기수가 2인 수 체계. 2진수는 1과0으로 구성되며, 각 자리는 2의 지수(2³,2²,2¹,2°등) 과 같다.

• 비트(Bit): 단일 2진자리. 2진수 1101은 4비트 수이다.

• 8진수(OCTAL): 기수가 8인 수 체계. 8진수 한 자리에는 0, 1, 2, 3, 4, 5, 6, 7이 올수 있다. 각 8진수 자리는 8의 지수(8³,8²,8¹,8°등)을 표현한다.

• 10진수(Decimal):기수가 10인수 체계 10진수 한 자리에 등장할 수 있는 수 는 0,1,2,3,4,5,6,7,8,9이다 10진수의 각 자리는 10의 지수(10³,10²,10¹,10°

등)이다.

40

(41)

용어 해설

• 16진수(Hexadecimal): 기수가 16인 수 체계 16진수 한 자리에는 0, 1, 2, 3, 4, 5, 6, 7, 8 ,9, A, B, C, D, E, F,가 올 수 있다. 16진수의 각 자리는 16의 지수(16³,16²,16¹,16°등) 를 표현한다.

• ASCII코드(ASCII Code): 정보 교환을 위한 미 표준 코드(American

Standard Code for information Interchange). ASCII는 디지털 시스템이 외 부와 입출력하는 모든 문자, 심볼, 숫자들을 표현하기 위해 사용하는 7비트 코드이다.

코드이다.

• BCD: 2진 코드화된 10진수 (Binary-Coded Decimal). 0에서 9까지의 10진 수를 표현하기 위해 사용하는 4비트

• 최하위 비트(Least Significant Bit, LSB): 2진 비트 열에서 가장 낮은 자리의 비트. LSB는 2진수 안에서 가장 작은 2의 지수의 자리이다.

• 최상위 비트(Most Significant Bit, MSB): 2진 비트 열에서 가장 높은 자리의 비트. MSB는 2진수 안에서 가장 높은 2의 지수의 자리이다.

41

참조

관련 문서

• 연속적으로 변화하는 analog 신호를 이산적(discrete) 디지털 부호로 변환.. 표본화(sampling) : 신호에서 표본값 추출(PAM: Pulse Amplitude

Modern parallel to naturalism is found in film documentaries

- 우리 주위에 있는 대부분의 물리, 화학, 전자, 기계, 생체 시스템이 온도에 의해서 영향을 받기 때문에 온도는 가장 자주 측정되는

*단어 사이의 공통성과

현재 기독교 신학계를 지배하고 있는 신학 의 역사적 배경 및 그 사상적, 철학적 계보 및 배경, 신학적 의미를 연구 분석 비평을 통하여 정확한

– 대부분의 기업들은 정보자원을 정보시스템시스템 부서에 의해 관리 – 정보시스템 부서는 시스템 개발, 시스템 운영, 기술지원의

[r]

[r]