65
1 EC-214 DIGITAL LOGIC DESIGN J.RAVINDRANADH Sr.Associate Professor. E-mail : [email protected] EC214 Digital Logic Design J Ravindranadh Sr.Associ.Prof.

Number System

Embed Size (px)

DESCRIPTION

ece department

Citation preview

Page 1: Number System

1

EC-214 DIGITAL LOGIC DESIGN

J.RAVINDRANADHSr.Associate Professor.

E-mail : [email protected]

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof.

Page 2: Number System

2

Text book & Reference book Textbook

M Morris Mano, Digital Logic and Computer Design, PHI/Pearson Education, 2003. RP Jain, Modern Digital Electronics, 3rd Edition, TMH, 2003

Reference book1. Zvi Kohavi, Switching and Finite Automata Theory, 2nd Edition, TMH, 1978.2. Fundamentals of Logic Design, ch. Roth,Jr

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof.

Page 3: Number System

3

SYLLABUS Unit -I

NUMBER SYSTEMS AND CODES: Decimal, Binary, Octal, Hexadecimal Number systems and their conversions, Arithmetic additions, subtraction using the method of complements, Multiplication and division. Codes: BCD, Excess 3, Gray, Alphanumeric and Error detection codes.

BOOLEAN ALGEBRA: Boolean expressions and theorems, Logic gates, Universal gates, Canonical and standard forms, Boolean functions, simplification of Boolean functions using K maps (up to five variables), Minimal functions and their properties, Tabulation method, NAND implementations two level and Multilevel

Unit -II COMBINATIONAL LOGIC CIRCUITS: EX-OR, EX-NOR Circuits, General

design procedure for Combinational logic circuits ,Design and applications of Binary Adders and Subtractors, Comparators, Encoders, Decoders, Multiplexers and Demultiplexers, Design of BCD to 7 Segment Decoder, Parity Generator and Checker, Error Detection and Correction using Hamming Code, BCD Adder / Subtractor, Carry look ahead adders.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof.

Page 4: Number System

4

SYLLABUS Cont., Unit-III

SEQUENTIAL LOGIC CIRCUITS: Latches, Characteristic Table, Characteristic Equation, Excitation table, State table and State diagrams for SR, JK, Master Slave JK, D and T Flip-flops, Conversion from one type of Flip-flop to another, Shift Registers, Analysis and Synthesis of Sequential Circuits-Sequence Generator, Sequence Detector, Parity Generator.

COUNTERS USING FLIP- FLOPS: Design of Ripple counters, Synchronous counters, Up/Down counters using Flip-flops.

Unit-IV IC LOGIC FAMILIES: RTL, DTL, TTL, ECL, MOS, CMOS and IIL families and their comparison. MSI and LSI: Programmable Logic Arrays, Programmable Array Logic.

EC214 Digital Logic Design J Ravindranadh Sr.Associ.Prof.

Page 5: Number System

5

Number system

Decimal Binary Octal Hexadecimal

Decimal System :

1. The decimal system is composed of 10 numerals . These 10 symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

2. The decimal system is called the base-10 system or Radix-10 because it has 10 digits.

3. The decimal system is clearly most familiar to us because it is a tool that you used every day. Example: Ranks, Roll Numbers etc.,

EC214 Digital Logic Design

J Ravindranadh Sr.Associ.Prof.

Page 6: Number System

Binary System

The binary system is simple because it consists of only two digits , i.e. 0 and 1. The binary system is called the base-2 system or Radix-2 because it has 2 digits. Use of binary number system in the digital systems.

Octal System

The Octal system is composed of 8 numerals. These 8 symbols are 0, 1, 2, 3, 4, 5, 6, 7.

The Octal system is called the base-8 system or Radix-8 because it has 8 digits. Octal system is used in COBOL language

Hexadecimal system

The Hexadecimal number system uses 16 symbols. These 16 symbols are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F.

The Hexadecimal system is called the base-16 system or Radix-16 because it has 16 symbols.

Hexadecimal system is used in Micro Processor and used in specifying web colors.

6

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof.

Page 7: Number System

Conversion Possibilities

Hexadecimal

Decimal Octal

Binary

7

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof.

Page 8: Number System

Decimal ‒to‒ Binary ConversionConverting a decimal number into a binary number is by dividing the decimal number by 2 progressively, until the quotient of zero is obtained. The binary number is obtained by taking the remainder after each division in the reverse order. This method is popularly known as the double-dabble method.

Example: Convert the decimal number 5310 into its binary equivalent.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 8

2 26 --- 1 LSB 2 13 --- 0 2 6 --- 1 2 3 --- 0

2 53

2 1 --- 1 0 --- 1 MSB

(53)10 = ( 110101)2

Page 9: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 9

Fractional Conversion: If the number is a fraction, its binary equivalent is obtained by multiplying the number continuously by 2, recording a carry in the integer position eachtime. The carries in the forward order give the required binary number.

Example: Convert the decimal number (0.625)10 into its binary equivalent.

Multiplication Generated Integer

0.625 x 2=1.25 1 0.25 x2 =0.5 00.5x2 =1.0 1

(0.625)10 =(0.101)2

Page 10: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 10

Example: Convert the decimal number (93.8125)10 into its binary equivalent.

2 93 2 46 ----- 1 2 23 ----- 0 2 11 ----- 1 2 5 -----1 2 2 ----- 1 2 1 ----- 0 2 0 ---- 1

Multiplication Generated Integer

0.8125x2 =1.625 10.625x2 = 1.25 10.25x2 = 0.5 00.5x2 =1.0 1

(93.8125)10 =(1011101.1101)2

Page 11: Number System

Convert Decimal ‒to‒ Binary Convert the decimal number (72.95)10 into its binary equivalent.

(1001000.1111001)2

Multiplication Generated Integer0.95x2 =1.9 10.9x2 = 1.8 10.8x2 = 1.6 10.6x2 =1.2 10.2x2=0.4 00.4x2=0.8 00.8x2=1.6 1

Convert the decimal number(432.354)10 into its binary equivalent. (110110000.010110…..)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 11

Page 12: Number System

Decimal ‒to‒ Octal Conversion

Example: Convert the decimal number (53.625)10 into its octal equivalent.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 12

8 53 8 6 --- 5 0 --- 6

Multiplication Generated Integer

0.625x8=5.000 5

(53.625)10 =(65.5)8

Convert the decimal number (375.3125)10 into its octal equivalent

Convert the decimal number(444.456)10 into its octal equivalent

(567.24)8

(674.35136 …)8

Page 13: Number System

Decimal ‒to‒ Hexadecimal Conversion Example: Convert the decimal number (115.5)10 into its Hexadecimal

equivalent.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 13

16 115 16 7 --- 316 0 --- 7

Multiplication Generated Integer

0.5x16=8.000 8

(115.5)10 =(73.8)16

Convert the decimal number (757.25)10 into its hexadecimal equivalent

Convert the decimal number (356.89)10 into its hexadecimal equivalent

(2F5.4)16

(164.E3D7)16

Page 14: Number System

Binary ‒to‒ Decimal Conversion

Example: Convert the binary number (10111.1011)2 into its decimal equivalent.

(10111.1011) 2 = 1 x 20 + 1 x 21 + 1 x 22 + 0 x 23 + 1 x 24 +

1 x 2-1 + 0 x 2-2 + 1 x 2-3 + 1 x 2-4

= 1 + 2 + 4 + 0 + 16 + 0.5 + 0.0 + 0.125 + 0.0625

=(23.6875)10

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 14

Convert the binary number (1001001.011)2 into its decimal equivalent.Convert the binary number (1101101.111)2 into its decimal equivalent

(73.375)10

(109.875)10

Page 15: Number System

Binary ‒to‒ Octal ConversionThe base of the octal numbers is 8 and the base for binary numbers is 2. Thus the base for octal number is the third power of the

base for binary number .i.e 23 =8.

Converting a binary number to an octal, starting from the least significant bit, each group of 3 bits is replaced by its decimal equivalents.

Example: Convert the binary number (10011101111.10111)2 into its octal equivalent. (10011101111.10111)2 = ( 2357.56)8

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 15

Convert the binary number (1100111110011.011101001)2 into its octal equivalent.

Convert the binary number (111101011001101.000111)2 into its octal equivalent.

(14763.351)8

(75315.07)8

Page 16: Number System

Binary ‒to‒ Hexadecimal Conversion

The base of the hexadecimal numbers is 16 and the base for binary numbers is 2. Thus the base for hexadecimal number is the fourth power of the base for binary number .i.e 24 =16.

Converting a binary number to hexadecimal, starting from the least significant bit, each group of 4 bits is replaced by its Hexadecimal equivalents.

Example: Convert the binary number 10011101111.10111)2 into its hexadecimal equivalent.

(10011101111.10111)2 = ( 4EF.B8)16

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 16

Ex: Convert the binary number(1100111110011.011101001)2 into its hexadecimal equivalent.

Ex: Convert the binary number(110101011101100.00011)2 into its hexadecimal equivalent.

(19F3.748)16

(6AEC.18)16

Page 17: Number System

Octal ‒to‒ Decimal Conversion

Example: Convert the octal number (475.25)8 into its decimal equivalent.

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

= 5 + 56 + 256 + 0.25 + 0.078125

=(317.32825)10

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 17

Convert the octal number (432.763)8 into its decimal equivalent

Convert the octal number (567.24)8 into its decimal equivalent

(282.9738)10

(375.3125)10

Page 18: Number System

Octal ‒to‒ Binary ConversionObtaining the binary equivalent of an octal number, each significant digit in the given number is replaced by its 3 bit binary

equivalent.

Example: Convert the octal number (35601.124)8 into its binary equivalent.

(35601.124)8 = ( 011101110000001.0010101)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 18

(100101011001.01000010011)2

(111101011010.0010101)2

Convert the octal number (7532.124)8 into its binary equivalent

Convert the octal number(4531.2046)8 into its binary equivalent.

Page 19: Number System

Octal –to- Hexadecimal Conversion To convert an octal number to Hexadecimal the steps are as follows

Convert the given octal number to its binary equivalent. Form groups of 4 bits, staring from the LSB. Write the equivalent hexadecimal number for each group of 4 bits.

Example: Convert the octal number (475.25)8 into its Hexadecimal equivalent.

(475.25)8 = (100111101.010101)2

= (13D. 54)16 Convert the octal number ( 3457.216)8 into its Hexadecimal equivalent. ( 11100101111.01000111 )2 = ( 72F. 47 )16

Convert the octal number ( 7654.321)8 into its Hexadecimal equivalent ( 111110101100.011010001 )2 = ( FAC.688 )16

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 19

Page 20: Number System

Hexadecimal ‒to‒ Decimal Conversion

Example: Convert the hexadecimal number (9B2.1A)16 into its decimal equivalent.

(9B2.1A)16 = 2 x 160 + 11 x 161 + 9 x 162 + 1 x 16-1 + 10 x 16-2

= 2 + 176 + 2304 + 0.0625 + 0.039

=(2482.101)10

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 20

Convert the hexadecimal number (2F5.4) 16 into its decimal equivalent.

Convert the hexadecimal number(E1.398)16 into its decimal equivalent.

= (757.25)10

= (225.225)10

Page 21: Number System

Hexadecimal ‒to‒ Binary Conversion Binary equivalent of a hexadecimal number, each significant digit in the given

number is replaced by its 4 bit binary equivalent.

Example: Convert the hexadecimal number (F9E2.1A)16 into its binary equivalent.

(F9E2.1A)16 = ( 1111100111100010.00011010)2

Convert the hexadecimal number ( 68B5.C9D)16 into its binary equivalent. ( 0110100010110101.110010011101)2

Convert the hexadecimal number ( 79DF2.A38C )16 into its binary equivalent.

( 1111001110111110010.1010001110001100)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 21

Page 22: Number System

Hexadecimal to octal Conversion To convert an Hexadecimal number to octal the steps are as follows

Convert the given hexadecimal number to its binary equivalent. Form groups of 3 bits, staring from the LSB. Write the equivalent octal number for each group of 3 bits.

Example: Convert the Hexadecimal number (A48.345)16 into its octal equivalent.

(A48.345)16 = (101001001000.001101000101)2

= (5110.1505)8 Convert the Hexadecimal number ( 72F. 47 )16 into its octal equivalent. ( 3457.216)8

Convert the Hexadecimal number ( FAC.688 )16 into its octal equivalent. ( 7654.321)8

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 22

Page 23: Number System

Arithmetic Operation Binary Arithmetic

Arithmetic operation in digital systems are usually done in binary because design of logic circuits to perform binary arithmetic is much easier than for decimal.

Arithmetic rules for addition

0+0=0 0+1=1 1+0=1 1+1=10

Example: Add (1010)2 and (1111)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 23

11 1010 1111

(11001)2

Page 24: Number System

Binary addition Add ( 1111.01)2 and (0111.10)2

Add (1011.011)2 and (110.1)2 (10001.111)2

Add (101.11)2 (1101.01)2 and (10000.001)2 (100011.001)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 24

111 1111.01 0111.10

(10110.11)2

Page 25: Number System

Binary Subtraction Arithmetic rules for Subtraction

0-0=01-0=11-1=00-1=1 Note: When 1 is subtracted from 0, a 1 is borrowed from the immediate higher significant bit.

Subtract (11001)2 – (01110)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 25

11001 01110

(01011)2

Page 26: Number System

Binary Subtraction Subtract ( 1110.01)2 From (10111.10)2

Subtract (110.1)2 from (1011.011)2 (100.111)2

Subtract (1101.01)2 from (10000.001)2 (10.111)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 26

10111.10 1110.01

(1001.01)2

Page 27: Number System

Binary Multiplication Multiply 10112 by 1012

1011 x101 1011 0000 1011 110111

Multiply 1111012 by 100012

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 27

100.110 x11.101 100110 000000 100110 100110 10011010001.001110

Multiply 100.1102 by 11.1012

100000011012

Page 28: Number System

Binary Division Divide the binary number 100100012 by 1012

101] 10010001 [ 11101

101 1000 101

110 101 101 101 0

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 28

Page 29: Number System

Binary Division Cont., Divide the binary number 110111110012 by 11112

(1110111)2

Divide the binary number 10001.001102 by 11.0012

11001] 1000100110 [ 101.10

11001 100101 11001

11001 11001 0 Divide the binary number (10001.001110)2 by (111.01)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof.29

11101 ] 10001001110 [ 100110 11101 101011 11101 11101 11101 0

Page 30: Number System

Octal addition Add ( 46)8 and (26)8 Add ( 456)8 and (123)8

Add (13255)8 and (7031)8 (22306)8

Add (123.456)8 (4635.01)8 and (37.25)8 (5017.736)8

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 30

1 46 26

(74)8

11 456 123

(601)8

Page 31: Number System

Octal Subtraction Subtract ( 124)8 - (63)8

Subtract (34.35)8 from (56.23)8 (21.66)8

Subtract (5234.17)8 from (7102.36)8 (1646.17)8

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 31

124 -63 (41)8

Page 32: Number System

Octal Multiplication Multiply 128 by 178

12 x17 Multiply 4138 by 158

66178

Multiply 23.128 by 4.178

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 32

23.12 x 4.17 20606 2312 11450 11 121.0726

60121

622

Page 33: Number System

Octal Division Divide the octal number 278 by 58

5] 27 [ 4 -24 3 Divide the octal number 66178 by 158

(413)8

Divide the octal number 2268 by 128

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 33

178

Page 34: Number System

Hexadecimal addition Add ( 76)16 and (59)16 Add ( E498)16 and (473)16

Add (A895)16 and (7031)16 (118C6)16

Add (123.456)16 (4695.01)16 and (97.25)16 (484F.6B6)16

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 34

76 59

(CF)16

1 E498 473

(E90B)16

Page 35: Number System

Hexadecimal Subtraction Subtract ( 124)16 - (65)16

Subtract (34.35)16 from (B6.23)16 (81.EE)16

Subtract (5234.17)16 from (8102.36)16 (2ECE.1F)16

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 35

124 -65 (BF)16

Page 36: Number System

Hexadecimal Multiplication Multiply (15)16 by (16)16

15 x16 Multiply (64)16 by (19)16

(9C4)16

Multiply (23.45)16 by (4.17)16

(90.3F33)16

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 36

64 x 19 384 64 9C4

E751

EC1

Page 37: Number System

Hexadecimal Division Divide the hexadecimal number (1CE)16 by (15)16

15] 1CE [ 16 -15 7E -7E 0

Divide the Hexadecimal number (9C4)16 by (19)16

Divide the hexadecimal number 26AC16 by 1216

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 37

=22616

19 ] 9C4 [ 64 -96 64 -64 0=6416

Page 38: Number System

Complements Complements are used in digital computer for simplifying the subtraction operation and for logical manipulations There are two types of complements for each base r- system (1) the r’s complement and (2) the (r-1) complements 1’s complement: The 1’s complement of a binary number can be obtained by Subtracting each bit from 1. . (OR) The 1’s complement

of a binary number can be obtained by changing all 1s to 0s and all 0s to 1s

Example: Find the 1’s complement of (10101110)2

01010001 Find the 1’s complement of (111001.10101)2

(000110.01010)

.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 38

Page 39: Number System

Complement Cont., 2’s Complement: The 2’s complement of a binary number can

be obtained by adding 1 to its 1’s complement.

Example: Find the 2’s complement of (1100011)2

1’s complement 0011100 add 1 2’s complement 0011101

Find the 2’s complement of (10101000)2

2’s complement (01011000)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 39

Page 40: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 40

Example: Find the 9’s complement of (5412)10

(4587)

EX: Find the 9’s complement of (6291)10

(3708)

(625.31)

EX: Find the 9’s complement of (374.68)10

EX: Find the 9’s complement of (25.639)10

(74.360)

or (104 -1-5412)

9’s Complement : The 9’s complement of a decimal number can be obtained by Subtracting each digit from 9.

Page 41: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 41

Example: Find the 10’s complement of (237806)10

The 9’s complement 762193 add 1 762194

Ex: Find the 10’s complement of (25.639)10

0r (106 -237806)

Ex: Find the 10’s complement of (0.3267)10

The 9’s complement 0.6732 add 1 0.6733

0r (100 - 0.3267)

The 9’s complement 74.360 add 1 74.361

0r (102 - 25.639)

10’s Complement: The 10’s complement of a decimal number can be Obtained by adding 1 to its 9’s complement

Page 42: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 42

Example: Find the 7’s complement of (5412)8

(2365)

EX: Find the 7’s complement of (62037)8

(15740)

(403.652)

EX: Find the 7’s complement of (374.125)8

EX: Find the 7’s complement of (251036.1427)8

(526741.6350)

7’s Complement : The 7's complement of an octal number is obtained by subtracting each digit from 7.

Page 43: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 43

Example: Find the 8’s complement of (237106)8

The 7’s complement 540671 add 1 8’s complement 540672

Ex: Find the 8’s complement of (25.634)8

Ex: Find the 7’s complement of (0.3267)8

The 7’s complement 0.4510 add 1 8’s complement 0.4511

8’s Complement: The 8’s complement of a octal number can be Obtained by adding 1 to its 7’s complement

The 7’s complement 52.143 add 1 8’s complement 52.144

Page 44: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 44

Example: Find the 15’s complement of (5412)16

(ABED)

EX: Find the 15’s complement of (62037)16

(9DFC8)

(C8B.EDA)

EX: Find the 15’s complement of (374.125)16

15’s Complement : The 15's complement of an Hexadecimal number is obtained by subtracting each digit from 15.

Page 45: Number System

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 45

Example: Find the 16’s complement of (237106)16

The 15’s complement DC8EF9 add 1 16’s complement DC8EFA

Ex: Find the 16’s complement of (25.639)16

Ex: Find the 15’s complement of (0.3267)16

The 15’s complement 0.CD98 add 1 16’s complement 0.CD99

The 15 ’s complement DA.9C6 add 1 DA.9C7

16’s Complement: The 16’s complement of a hexadecimal number can be Obtained by adding 1 to its 15’s complement

Page 46: Number System

Subtraction using 1’s Complement Subtract ( 110010)2 - (100100)2 using 1’s Complement method 1 1 1 1 0 0 1 0 1’s Complement (100100)2 +0 1 1 0 1 1 1 0 0 1 1 0 1 add carry + 1 0 0 1 1 1 0

Subtract ( 100001)2 - (110)2 using 1’s Complement method 1 0 0 0 0 1 1’s Complement (110)2 + 1 1 1 0 0 1 1 0 1 1 0 1 0 add carry + 1 0 1 1 0 1 1

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 46

Carry

Carry

Page 47: Number System

Subtraction using 1’s Complement Subtract ( 1010.10)2 - (101.01)2 using 1’s Complement method 1 1 1 0 1 0 . 1 0 1’s Complement (101.01)2 +1 0 1 0 . 1 0 1 0 1 0 1 . 0 0 add carry + 1 1 0 1 . 0 1

Subtract ( 10101.10)2 - (111.11)2 using 1’s Complement method 1 0 1 0 1 . 1 0 1’s Complement (111.11)2 + 1 1 0 0 0 . 0 0 1 0 1 1 0 1 . 1 0 add carry + 1 0 1 1 0 1 . 1 1

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 47

Carry

Carry

Page 48: Number System

Subtraction using 1’s Complement Subtract ( 1010.10)2 - (1101.11)2 using 1’s Complement method 1 0 1 0 . 1 0 1’s Complement (1101.11)2 +0 0 1 0 . 0 0 1 1 0 0 . 1 0 no carry 1’s Complement (1100.11)2 - 1 1 . 0 1

Subtract ( 10101.10)2 - (11111.11)2 using 1’s Complement method 1 0 1 0 1 . 1 0 1’s Complement (11111.11)2 + 0 0 0 0 0 . 0 0 1 0 1 0 1 . 1 0 no carry 1’s Complement (10101.10)2 ( - 1 0 1 0.0 1)2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 48

Page 49: Number System

Subtraction using 2’s Complement Subtract ( 110010)2 - (100100)2 using 2’s Complement method 1 1 1 0 0 1 0 2’s Complement (100100)2 +0 1 1 1 0 0 1 0 0 1 1 1 0

Subtract ( 100001)2 - (110)2 using 2’s Complement method 1 0 0 0 0 1 2’s Complement (110)2 + 1 1 1 0 1 0 1 0 1 1 0 1 1

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 49

Discard Carry

Discard Carry

Page 50: Number System

Subtraction using 2’s Complement Subtract ( 1010.10)2 - (101.01)2 using 2’s Complement method 1 1 1 0 1 0 . 1 0 2’s Complement (101.01)2 + 1 0 1 0 . 1 1 1 0 1 0 1 . 0 1

Subtract ( 10101.10)2 - (111.11)2 using 2’s Complement method 1 0 1 0 1 . 1 0 2’s Complement (111.11)2 1 1 0 0 0 . 0 1 1 0 1 1 0 1 . 1 1

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 50

Discard Carry

Discard Carry

Page 51: Number System

Subtraction using 2’s Complement Subtract ( 101110.111)2 - (111011.101)2 using 2’s Complement method 1 0 1 1 1 0 . 1 1 1 2’s Complement (111011.101)2 + 0 0 0 1 0 0 . 0 1 1 1 1 0 0 1 1 . 0 1 0 2’s Complement (1 1 0 0 1 1 . 0 1 0 )2 = - 1 1 0 0 . 1 1 0

Subtract ( 10101.101)2 - (11000.11)2 using 2’s Complement method 1 0 1 0 1 . 1 0 1 2’s Complement (11000.11)2 + 0 0 1 1 1 . 0 1 0 1 1 1 0 0 . 1 1 1 2’s Complement (11100.111)2 = -1 1 . 0 0 1

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 51

Page 52: Number System

Comparison between 1’s and 2’s complements

The 1’s complement can be easily obtained using an inverter. The 2’s complement can obtained by adding 1 to its 1’s complement.

The advantage in the 2’s complement system is that only one arithmetic

operation is required; the 1’s complement requires two operations.

While the 1’s complement is often used in logical manipulations for inversion operation, the 2’s complement is used only for arithmetic applications.

the range of the numbers that are represented in 1’s and 2’s complemnents of a given number N is -(2N-1-1) to +(2N-1-1) and -(2N-

1) to +(2N-1-1)EC214 Digital Logic Design

J Ravindranadh Sr.Associ.Prof. 52

Page 53: Number System

Subtraction using 9’s Complement Subtract ( 83)10 - (25)10 using 9’s Complement method 8 3 9’s complement (25) +7 4 1 5 7 add carry + 1 5 8 Subtract ( 5250)10 - (321)10 using 9’s Complement method 5 2 5 0 9’s complement (321) +9 6 7 8 1 4 9 2 8 add carry + 1 4 9 2 9

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 53

Carry

Carry

Page 54: Number System

Subtraction using 9’s Complement Subtract ( 20)10 - (1000)10 using 9’s Complement method 0 0 2 0 9’s complement(1000) +8 9 9 9 9 0 1 9 no carry 9’ complement (9 0 1 9) = - 0 9 8 0 Subtract ( 124 )10 - (456)10 using 9’s Complement method 1 2 4 9’s complement (456) 5 4 3 6 6 7 9’ complement of (6 6 7) = - 3 3 2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 54

Page 55: Number System

Subtraction using 10’s Complement Subtract ( 3570)10 - (2100)10 using 10’s Complement method 3 5 7 0 10’ s Complement (2100)10 + 7 9 0 0 1 1 4 7 0

Subtract ( 72532)10 - (3250)10 using 10’s Complement method 7 2 5 3 2 10’ s Complement (3250)10 + 9 6 7 5 0 1 6 9 2 8 2

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 55

Discard Carry

Discard Carry

Page 56: Number System

Subtraction using 10’s Complement

Subtract ( 753)10 - (864)10 using 10’s Complement method 7 5 3 10’s Complement (864)2 + 1 3 6 8 8 9 no carry 10’s complement = - 1 1 1 Subtract ( 345)10 - (864)10 using 10’s Complement method

3 4 5 10’s Complement (864) + 1 3 6 4 8 1 no carry 10’s Complement = - 5 1 9

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 56

Page 57: Number System

CODES

Binary Coded Decimal (BCD) (or )8421

Excess-3 Code (or )Ex-3 code Gray Code (or) Reflected Code (or)

unit distance Code (or) cyclic code

Alphanumerical Code Error Detection Code

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 57

Page 58: Number System

Binary Coded Decimal BCD uses the binary number system to specify the decimal numbers

0 to 9.

BCD represent each digit in 4 bit form. It is also called 8 4 2 1 code.

The weights of the first positions is 1, the second position 2, third position is 4 and fourth position is 8 reading from left to right, hence it is also called as weighted code.

There are six illegal combinations in BCD code they are 1010, 1011, 1100, 1101,1110 and 1111.

Example: (31)10 = 0011 0001 BCD = 11111 Binary

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 58

Page 59: Number System

Binary Coded Decimal

The advantage of a BCD code is that it is easy for conversion BCD to decimal and vice-versa.

The disadvantage is less efficient than the pure binary and its requires more bits. Another disadvantage is that, arithmetic operations are more complex than they are in pure binary.

BCD code is used in pocket calculators, electronic counters, digital voltmeters , digital cocks etc.,

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 59

Page 60: Number System

Excess-3 code The Ex-3 code can be obtained add 3 to the each decimal digit before converting it

into equivalent binary. Example: (90)10 = 9 0 +3 +3 1100 0011 EX-3 code The ex-3 code has six invalid states 0000, 0001, 0010, 1101, 1110, 1111 Excess-3 code is also called unweighted code. Ex-3 code is called self complementary code . “ 9’s complement of code word i.e 9

–N equal to the 1’ complement of the code word “ .

Example : (4)10 9’s complement = 9 – 4 = 5 code word 5+3= 1000 code word = 4 +3 = 0111, 1’ complement codeword=1000

only four positively weighted self complement codes namely (2 4 2 1) (3 3 2 1) ( 4 3 1 1) ( 5 2 1 1).there exist 13 self complementing codes with positive and negative weight

60

Page 61: Number System

Gray (or) Reflected (or) cyclic code Binary to gray conversion :

MSB of gray code is same as MSB of the binary number Add MSB of the binary to the next bit in binary write the sum

and ignoring the carry. Add the 2nd bit to the 3rd bit of the binary and so on, write the successive sums.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 61

Decimal

Binary

Gray

0 0 0 0 0 0 0 0 01 0 0 0 1 0 0 0 12 0 0 1 0 0 0 1 13 0 0 1 1 0 0 1 04 0 1 0 0 0 1 1 05 0 1 0 1 0 1 1 16 0 1 1 0 0 1 0 1

Decimal Binary Gray7 0 1 1 1 0 1 0 08 1 0 0 0 1 1 0 09 1 0 0 1 1 1 0 110 1 0 1 0 1 1 1 111 1 0 1 1 1 1 1 012 1 1 0 0 1 0 1 013 1 1 0 1 1 0 1 1

Page 62: Number System

Gray code In gray code any two adjacent code groups differ only in one bit

position.

Gray code also called reflected code because the two least significant bits for decimal 4 through 7 are the mirror images of those for 0 through 3. Similarly the three least significant bits from 8 to 15 are the mirror image of those for 0 through 7.

Gray codes are used in instrumentation and data acquisition system where linear or angular displacement is measured.

They are also used in shaft encoders, I/O devices, A/D converters and other peripheral equipment.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 62

Page 63: Number System

Gray code Convert the following binary number into gray code (a) 1 1 0 1 1 0 (b) 1 1 0 0 1 0 1 0 ( c ) 1 0 1 1 1 0 1 1

Gray to Binary conversion : Convert ( 1 0 1 0 1 1 1 )Gray to binary 1 0 1 0 1 1 1 + + + + + + 1 1 0 0 1 0 1 Convert the following gray number into binary code (a) 1 1 0 1 0 1 (b) 1 0 1 0 1 1 ( c ) 1 0 1 0 1 1 1 1

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 63

1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 0

1 0 0 1 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 0

Page 64: Number System

Alphanumeric code The most popular modern alphanumeric codes are (1) ASCII (2) EBCDIC code

ASCII code: American Standard Code for Information Interchange code. This is basically a 7-bit code. The number of different bit patterns that can be

crated with 7 bit is 27 = 128. The ASCII can be used to encode both the lowercase and uppercase characters

of the alphabet and some special symbols in addition to 10 decimal digits. EBCDIC : Extended Binary Coded Decimal Interchange Code. This is 8 bit code The number of different bit patterns can be crated with 8 bit is 28 = 256. It encodes many other symbols in addition to ASCCI. The use of Alphanumeric code for transmitting data between computers and

its I/O devices such as printers, key boards and video display terminals.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 64

Page 65: Number System

Error Detection Code An error – detection code can be used to detect errors during

transmission adding the extra bit known as the parity bit. There are two types of parity (1) odd parity and (2) even parity

ODD PARITY: the parity bit set to 0 or 1 at the transmitter such that the total number of 1’s in the word including the parity bit is an odd number.

EVEN PARITY: the parity bit set to 0 or 1 at the transmitter such that the total number of 1’s in the word including the parity bit is an even number.

EC214 Digital Logic Design J Ravindranadh

Sr.Associ.Prof. 65

Message

odd even

1 0 1 0 1

0 1

1 1 1 1 0

1 0

1 1 1 1 1

0 1

1 0 1 1 1

1 0

1 0 0 1 1

0 1