1 / 25

1. Binary System

1. Binary System. Binary Number. a 5 a 4 a 3 a 2 a 1 a 0 .a -1 a -2 a -3 = a n r n +a n-1 r n-1 +...+a 2 r 2 +a 1 r+a 0 +a -1 r -1 +a -2 r -2 +...+a -m r -m 7392 = 7 × 10 3 + 3 × 10 2 + 9 × 10 1 +2 × 10 0 (11010.11) 2 = 1×2 4 +1×2 3 +0×2 2 +1×2 1 +0×2 0 +1×2 -1 +1×2 -2

nell-henson
Download Presentation

1. Binary System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 1. Binary System

  2. Binary Number • a5a4a3a2a1a0.a-1a-2a-3 = anrn+an-1rn-1+...+a2r2+a1r+a0+a-1r-1+a-2r-2+...+a-mr-m 7392= 7 × 103 + 3 × 102 + 9 × 101 +2 × 100 (11010.11)2 =1×24+1×23+0×22+1×21+0×20+1×2-1+1×2-2 = (26.75)10 210 220 230 = 1Kilo = 1Mega = 1Giga

  3. Binary Number

  4. Number Base Conversions • Ex 1-1) Convert decimal 41 to binary. answer : (41)10 = (a5a4a3a2a1a0)2 = (101001)2 Answer =101001

  5. Number Base Conversions • Ex 1-2) Convert decimal 153 to octal. • Ex 1-3) Convert (0.6875)10 to binary. Answer:(0.6875)10 = (0.a-1a-2a-3a-4)2 = (0.1011)2  Ex 1-4) 해보세요 .

  6. Octal and Hexadecimal Numbers ( 10110001101011 .111100000110 )2 = (26153.7460)8 2 6 1 5 3 7 4 0 6 ( 10110001101011 .11110010 )2 = (2C6B.F2)16 2 C 6 B F 2 * PC의 계산기 기능

  7. Complements –Diminished Radix Complement • (r-1)’s complements of an n-digit N is (rn-1)-N • r=10, r-1=9, 9’complements of N is (10n-1)-N Ex) the 9’s complements of 546700 is 999999-546700 = 453299 the 9’s complements of 012398 is 999999-012398 = 987601 • For binary number, r=2, r-1=1 1’complements of N is (2n-1)-N Ex) the 1’s complements of 1011000 is 0100111 the 1’s complements of 0101101 is 1010010

  8. Complements –Radix Complement • The r’s complements of an n-digit number N is rn-N, N≠0 0, N=0 • rn-N=[(rn-1)-N]+1 => The r’s complements is obtained by adding 1 to the (r-1)’s complements • Ex) The 10’s complements of 012398 is 987602 The 10’s complements of 246700 is 753300 The 2’s complements of 1101100 is 0010100 The 2’s complements of 0110111 is 1001001 • Ex) The 10’s complements and 9’s complements of 086632 ? The 2’s complements and 1’s complements of 0110101 ? • 1’s complement 와 2’s complement 중 어느쪽이 계산 편리? • CPU는 (-) 연산 기능 없슴  (+) 과 complement 기능으로 (-) 연산 수행

  9. Complements –Subtraction with Complements • Ex1-5) using 10’s complement, subtract 72532-3250. • 72532 + (100000-3250) : carry 발생 • Ex1-6) Using 10’s complement, subtract 3250-72532. • 3250 -72532+100000 = 3250 + (100000-72532) : no carry There is no end carry Therefore, the answer is –(10’s complement of 30718)=-69282

  10. Complements –Subtraction with Complements • Ex1-7) X=1010100, Y=1000011, (a) X-Y, (b) Y-X (a) X-Y (b) Y-X There is no carry. The answer is Y-X = -(2’s complement of 1101111)=-0010001

  11. Complements –Subtraction with Complements (a) X-Y = 1010100-1000011 • Ex1-8) Repeat Example 1-7 using 1’complement. (b) Y-X = 1000011-1010100 There is no carry. The answer is Y-X = -(1’s complement of 1101110)=-0010001

  12. Signed Binary Numbers • Ex) 8bit로서 나타낼 수 있는 숫자 : 0-255 (모두 양수인경우). 만약 반은 음수, 반은 양수로 나타내고 싶을 때의 방법은? (즉 -127 ~ +127(8) 로 나태 내고 싶을 때의 방법은?) • Ex) The number 9 represented in binary with eight bit +9 : 00001001 -9 : 10001001 (signed-magnitude representation) 11110110 (signed-1’s-complement representation) 11110111 (signed-2’s-complement representation) • Complement 의 complement 는 원래의 수가 됨 • 덧셈, 뺄셈의 결과가 모순이 없고, 편리하게 되는지의 여부

  13. Signed Binary Numbers

  14. Signed Binary Numbers • Arithmetic Addition - signed-magnitude system follows the rules of ordinary arithmetic. -같은 부호의 경우 : 덧셈후 해당 부호 부여 –예 : … -다른 부호의 경우 : 큰 수에서 작은 수를 뺀 후 큰 수의 부호를 부여-예:.. - signed-complement system requires only addition (no deed of subtraction) – 2’s complement의 경우(carry 는 discard). • Arithmetic Subtraction (±A)-(+B) = (±A)+(-B) (±A)-(-B) = (±A)+(+B) • Overflow 문제 : paper에서는 자리수를 증가하여 해결가능하나, 컴퓨터 시스템에서는 제한된 bit 길이 고려하여야 함

  15. Arithmetic Addition의 예(2’s complement) 000 0 0 001 1 1 010 2 2 011 3 3 100 4 -4 101 5 -3 110 6 -2 111 7 -1 -4 ~ 3 안에서의 결과가 나오는 연산은 O.K.

  16. Binary Code-BCD code - the 4-bit code for one decimal (185)10 = (0001 1000 0101)BCD = (10111001)2 • BCD Addition - if the binary sum is greater or equal to 1010, we add 0110 to obtain the correct BCD

  17. Binary Code-Other Decimal Codes 2421 : 같은 숫자 2개의 코드 가능, ex) 4의 경우 0100, 1010 모두 가능 Excess-3 : BCD+3임, 9’complement를 구할 때는 bit의 1,0을 바꾸어주면 됨

  18. Binary Code-Other Decimal Codes 예 ) 0100을 다음의 형식대로 해석을 하면 얼마를 나타내는 수인가? - BCD 8421 : 0X8 + 1X4 + 0X2 + 0X1 =4 - 2421 : 0X2 + 1X4 + 0X2 + 0X1 = 4 - Excess-3 : 4-3 = 1 - 8 4 -2 -1 : 0X8 + 1X4 + 0X(-2) + 0X(-1) = 4 예 ) 1001을 BCD 8421, Excess-3, (8 4 -2 -1)의 형식으로 해석하면 각각 얼마를 나타내는 수인가? 예 ) 2421 코드에서 7을 나타낼 수 있는 코드 2개를 찾으시오.

  19. Binary Code-Gray Code 연속적인 값에 1bit 만이 변함,아날로그 값 입력시의 오류나 애매함을 방지. 즉 연속적인 값 입력시에 2bit 이상이 차이가 나면 오류임예 ) 3 bit의 gray code를 design 하시오.

  20. Binary Code-Gray Code 예 ) 3 bit의 gray code를 design 하시오. 000 0 001 1 011 2 010 3 110 4 111 5 101 6 100 7

  21. Binary Code- ASCII Character Code A : 100 0001 = 0x41a : 110 0001 = 0x61DEL : 111 1111 = 0x7FSP : 010 0000 = 0x20

  22. Binary Code • Error-Detecting Code

  23. Binary Storage and Registers • Registers – A register with n cells can store any discrete quantity of information that contains n bits. • Register Transfer

  24. Binary Logic • Definition of Binary Logic • Logic Gates

  25. Binary Logic

More Related