Download presentation

Presentation is loading. Please wait.

Published byJack Green Modified 11 months ago

1
CEC 220 Digital Circuit Design Binary Codes Mon, Aug 31 CEC 220 Digital Circuit Design Slide 1 of 14

2
Lecture Outline Mon, Aug 31 CEC 220 Digital Circuit Design Binary Arithmetic Review Extending Numeric Precision Binary coded decimal Slide 2 of 14

3
Binary Codes Binary Arithmetic Review Mon, Aug 31 CEC 220 Digital Circuit Design The following Binary pattern represents what signed number? Given that the representation is sign and magnitude? Given that the representation is 1’s complement? Given that the representation is 2’s complement? What is the difference between carry out and overflow? How do we convert to base 6 ? = = = - 10 Slide 3 of 14

4
Binary Codes Extending Precision Mon, Aug 31 CEC 220 Digital Circuit Design How do we increase the number of bits used to represent (in 2’s comp) a given number? We don’t want to change the numeric value!! Simply sign extend the number i.e. replicate the sign bit again & again … Example: 0011 1010 becomes = +3 (in four bits) = +3 (in eight bits) = -6 (in four bits) = -6 (in eight bits) becomes Slide 4 of 14

5
Binary Codes Increasing Precision Mon, Aug 31 CEC 220 Digital Circuit Design Range of Integers (2’s complement representation) An 8-bit unsigned integer? A 16-bit unsigned integer? A 32-bit unsigned integer? An 8-bit signed integer? A 16-bit signed integer? A 32-bit signed integer? 0 to (2 n -1) = 0 to to (2 n -1) = 0 to 65, (2 n-1 ) to (2 n-1 -1) = to (2 n-1 ) to (2 n-1 -1) = -32, to 32, to (2 n -1) = 0 to 4,294,967, (2 n-1 ) to (2 n-1 -1) = -2,147,483, to 2,147,483, Slide 5 of 14

6
Binary Codes Binary Coded Decimal (BCD) Mon, Aug 31 CEC 220 Digital Circuit Design Represent a decimal by encoding each individual digit in binary form How many bits do we need to represent each digit? o Ten possible choices for each digit (i.e. 0 to 9) An example of using the binary coded decimal representation (BCD) Not a very efficient use of “bits” !!! Slide 6 of 14

7
Binary Codes Weighted Codes Mon, Aug 31 CEC 220 Digital Circuit Design BCD is one example of a generalized “weighted” code: Weights: Binary digits: In the case of BCD the weights are: o E.g.: 0110 = 8x0+4x1+2x1+1x0 = 6 BCD is referred to as a weighted code o The codes 1010, 1011, 1100, 1101, 1110, and 1111 are unused Decimal Digit Code (BCD) Slide 7 of 14

8
Binary Codes Other Weighted Codes Mon, Aug 31 CEC 220 Digital Circuit Design Code Example: o Encode 4 via a code; – Hence, 4 = 0101 as a code – Also, 4 = 0110 as a code Decimal Digit Code The encoding is not unique !! Slide 8 of 14

9
Binary Codes Weighted Codes Mon, Aug 31 CEC 220 Digital Circuit Design Other Weighted Codes Excess-3 Code: BDC + 3 Decimal Digit Code (BCD) Excess-3 Code = Slide 9 of 14

10
Binary Codes Weighted Codes Mon, Aug 31 CEC 220 Digital Circuit Design Other Weighted Codes Grey Code o Codes for successive decimal digits differ by exactly one bit Decimal Digit Gray Code Slide 10 of 14

11
Binary Codes Various Codes Mon, Aug 31 CEC 220 Digital Circuit Design Decimal Digit Code (BCD) Code Excess-3 Code Gray Code Slide 11 of 14

12
Binary Codes ASCII Codes Mon, Aug 31 CEC 220 Digital Circuit Design Slide 12 of 14

13
Binary Codes Binary Codes: Examples Mon, Aug 31 CEC 220 Digital Circuit Design What does represent in a weighted code? What does represent in a BCD (i.e ) weighted code? Express 4 9 in excess-3 code = =4 ANS: = = 01119= =1100 ANS: = =6 ANS: 8 6 Slide 13 of 14

14
Next Lecture Mon, Aug 31 CEC 220 Digital Circuit Design Introduction to Boolean Algebra Slide 14 of 14

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google