Presentation is loading. Please wait.

Presentation is loading. Please wait.

VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.

Similar presentations


Presentation on theme: "VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth."— Presentation transcript:

1 VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth Edition, Prentice Hall of India Pvt. Ltd., Chapter – Chapter -1

2 VIT UNIVERSITY2 Number systems and codes  Representation of numbers  Decimal - Octal - Hexadecimal number systems  Representation of negative numbers  Complement of a number  Binary arithmetic  Binary codes for decimal numbers  Error detecting and correcting codes

3 VIT UNIVERSITY3 Representation of numbers  A number in base-r has coefficients multiplied by powers of r and is of the form Range of a j is from 0 to r-1  r is also called radix of the number system  If r = 2, binary number system  If r = 8, octal number system  If r = 16, hexadecimal number system

4 VIT UNIVERSITY4 Number base conversions  To convert a number in base r to decimal is done by expanding the number in a power series and adding all the terms  If the number includes a radix point, it is necessary to separate the number k into an integer part and a fraction part.  Decimal number is converted to number in base r by dividing the number and all successive quotients by r and accumulating the remainders.

5 VIT UNIVERSITY5 Number base conversions  Example 1: Convert decimal 153 to octal  Example 2: Convert (0.6875) 10 to binary

6 VIT UNIVERSITY6 Complement of a number Used for  Simplifying subtraction  Logical manipulation Two types  Radix complement  Diminished radix complement

7 VIT UNIVERSITY7 Complement of a number Diminished Radix complement  Given a number N in base r having n digits, its diminished radix complement is Radix complement  Given a number N in base r having n digits, its diminished radix complement

8 VIT UNIVERSITY8 Representation of negative numbers Two ways of representation  Sign magnitude form  Sign complement form signed 1’s complement form signed 2’s complement form

9 VIT UNIVERSITY9 Sign magnitude form  The number consists of magnitude bits and a sign bit  Used in ordinary arithmetic  It is simple Drawbacks:  Hardware limitations  Two representations of zero

10 VIT UNIVERSITY10 Signed complement form  A negative number is represented by its complement  positive numbers always start with 0 in the leftmost position.  The complement will always start with a 1, indicating a negative number.

11 VIT UNIVERSITY11 Representation of negative numbers Eg: Represent -9 using 8 bits in both Sign magnitude form and sign complement form

12 VIT UNIVERSITY12 Binary arithmetic  Addition  Subtraction  Multiplication Addition Similar to normal decimal addition Rules of addition: 1 + 1 = 0 CY = 1 1 + 0 = 0 + 1 = 1

13 VIT UNIVERSITY13 Binary subtraction The subtraction of two n-digit unsigned numbers M - N in base r can be done as follows: 1. Add the minuend M to the r's complement of the subtrahend N. Mathematically, M + (r n - N) = M - N + r n 2. If M >= N. the sum will produce an end carry r n which can be discarded. what is left is the result M - N. 3. If M < N. the sum does not produce an end carry and is equal to r n - (N - M) which is r's complement of (N - M). 4. To obtain the answer, take the r's complement of the sum and place a negative sign in front.

14 VIT UNIVERSITY14 Binary subtraction Eg: Perform the subtraction a) X – Y and b) Y – X if X = 1010100 and Y = 1000011 using two’s complement form. There is no end carry so the answer is – (two’s complement of 1101111)

15 VIT UNIVERSITY15 Binary multiplication  Just like normal decimal multiplication Eg: Find (1 0 1) 2 × (1 1 0) 2

16 VIT UNIVERSITY16 Binary codes for decimal numbers  A binary number of n digits gives 2 n distinct combinations which can be used to represent distinct group of quantities  Different binary codes available are weighted codes, un-weighted codes, self- complementing codes, reflecting codes  Weighted codes: Each bit position is assigned a weighing factor and each digit is evaluated by adding the weights of all the ones in the coded combination Eg: BCD code, 2-4-2-1 code, (8, 4,-2,-1) code, etc

17 VIT UNIVERSITY17 Binary codes for decimal numbers  Un-weighted codes: Weight is not assigned to the bit positions Eg: Excess-3 code  Self complementing code: 9’s complement of the decimal number is obtained by changing 1’s to 0’s and viceversa. Eg: 2-4-2-1 code, Excess-3 code

18 VIT UNIVERSITY18 BCD code  Decimal numbers 0 – 9 can be represented using 4 bits.  There are 6 unused combinations in this coding scheme.

19 VIT UNIVERSITY19 Different binary codes for decimal numbers

20 VIT UNIVERSITY20 Gray Code  Reflection code  Advantage of Gray code over the straight binary number sequence is that only one bit in the code group changes in going from one number to the next.

21 VIT UNIVERSITY21 ASCII Character code  The “American Standard Code for Information Interchange“ ASCII was suggested in 1968  Represents alphanumeric character set.  Uses 7 bits to represent 128 characters  There are special symbols which can be represented by this code  The coding is given in next slide

22 VIT UNIVERSITY22

23 VIT UNIVERSITY23 Error detection and correction  Error detection and correction code  An error-correcting code generates multiple parity check bits that are stored with the data word in memory. Each check bit is a parity over a group of bits in the data word  When the word is read back from memory, the associated parity bits are also read back and compared with a new set of check bits generated from the data that have been read lf the check bits are correct, no error has occurred.  If the check bits do not match the stored parity, they generate a unique pattern, called a syndrome, that can be used to identify the bit that is in error.  A single error occurs when a bit changes in value from 1 to 0 or from 0 to 1 during the write or read operation.  If the specific bit in the error is misidentified, then the error can be corrected by complementing the erroneous bit.

24 VIT UNIVERSITY24 Parity  Simplest form of error detection is achieved by using parity bits.  A parity bit is an extra bit included with a message to make the total number of 1's either even or odd. Eg:

25 VIT UNIVERSITY25 Hamming code  k parity bits are added to an n-bit data word forming a new word of n + k bits.  The bit positions are numbered in sequence from 1 to n + k.  The relation between the number of message bits and parity bits is  Those positions numbered as a power of 2 are reserved for the parity bits  The remaining bits are the data bits

26 VIT UNIVERSITY26 Hamming code  Construction of hamming code for 11000100 Calculating parity bits

27 VIT UNIVERSITY27 Hamming code Message bit sequence Calculation of check bits Message sequences with no error, error in bit 1 and error in bit 5 Calculation of check bits for the above message sequences

28 VIT UNIVERSITY28 Assignments Problems…  1. Convert the following binary numbers in decimal: 101110; 1110101; and 110110100.  2. Convert the following decimal numbers to the bases indicated. a. 7562 to octal b. 1938 to hexadecimal c. 175 to binary  3. Show the value of all bits of a 12-bit register that hold the number equivalent to decimal 215 in (a) binary; (b) octal; (c) hexadecimal; (d) binary-coded decimal (BCD).  4. Show the following operations using 2s complement: a. 10000111 – 1011001 b. 1011001 – 10000111 c. 0.1001 – 0.0101 d. 0.0101 – 0.1001

29 VIT UNIVERSITY29 Assignments Problems…  5. Convert the following two decimal numbers to binary, octal, and hexadecimal numbers. i) 174.25 ii) 250.8  6. Convert the following two unsigned binary numbers to octal, hexadecimal, and decimal numbers. i) 10101.11 ii) 10110110.001  7. Show how a 16 ‐ bit computer using a two’s complement number system would perform the following computations. (i) (16850)10 + (2925)10 = (?)10 ii) (16850)10 ‐ (2925)10 = (?)10 iii) (2925)10 ‐ (16850)10 = (?)10 iv) ‐ (16850)10 ‐ (2925)10 = (?)10

30 VIT UNIVERSITY30 Assignments Problems…  8. Do the following non-textbook problems: a. Obtain the 1’s and 2’s complements of the following unsigned binary numbers: 10001000, 10011001, 10101100, 00000000, and 10000000. b. Perform the indicated subtraction with the following unsigned binary numbers by taking the 2’s complement of the subtrahend: a) 11011 – 10000 b) 10110 – 1011 c) 100 – 101000 d) 1011100 – 1011100 Note: You must choose a size for your 2’s complement numbers.

31 VIT UNIVERSITY31 Assignments Problems…  c. The following binary numbers are 6-bit 2’s complement numbers. Perform the indicated arithmetic operations and  verify the answers.  a) 101111 + 111011  b) 001011 + 100010  c) 110001 – 001110  d) 101010 – 110111

32 VIT UNIVERSITY32 Assignments Problems…  For more problems :  Refer : M. Morris Mano, "Digital Design", 3rd Edition, Prentice Hall of India Pvt. Ltd., Chapter - Pages()


Download ppt "VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth."

Similar presentations


Ads by Google