Top Banner
Vignana Bharathi Institute of Technology UNIT 1 STLD potharajuvidyasagar.wordpress.com P VIDYA SAGAR STLD UNIT – I Number System and Boolean algebra And Switching Functions: Review of number systems, Complements of Numbers, Codes- Binary Codes, Binary Coded Decimal Code and its Properties, Unit Distance Codes, Error Detecting and Correcting Codes. Boolean Algebra: Basic Theorems and Properties, Switching Functions, Canonical and Standard Form, Algebraic Simplification of Digital Logic Gates, Properties of XOR Gates, Universal Gates, Multilevel NAND/NOR realizations. VIDYA SAGAR P
34

STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Mar 17, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

STLD

UNIT – I

Number System and Boolean algebra And

Switching Functions: Review of number

systems, Complements of Numbers, Codes-

Binary Codes, Binary Coded Decimal Code

and its Properties, Unit Distance Codes, Error

Detecting and Correcting Codes.

Boolean Algebra: Basic Theorems and

Properties, Switching Functions, Canonical

and Standard Form, Algebraic Simplification

of Digital Logic Gates, Properties of XOR

Gates, Universal Gates, Multilevel

NAND/NOR realizations.

VIDYA SAGAR P

Page 2: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

ANALOG AND DIGITAL SYSTEMS

There are two types of electronic circuits and systems; analog and digital. Analog systems are those

in which physical quantities are represented over a continuous range of values. They can take

infinite values within the specified range. For example, the amplitude of the output signal to the

speaker in a radio receiver can have any value between zero and its maximum limit. On the other

hand, digital systems are those in which physical quantities are represented in digital form; that is,

the quantities can take on only discrete values. Any quantity in the physical world, such as

temperature, pressure, or voltage, can be symbolized in a digital circuit by a group of logic levels

that, taken together, represent a binary number. Logic levels are usually specified as 0 or 1; at times,

it may be more convenient to use low/high, false/true, or off/on.

Advantages of Digital Systems :

Following are some of the advantages of digital systems over analog systems: Digital systems are

easier to design since all the modern digital circuits use only two voltage levels, HIGH and LOW,

hence they are easier to design. The exact numerical values of voltages are not important because

they have only logical significance; only the range in which they fall is important. In analog systems,

signals have numerical significance; so, their design is more complex.

Storage of information is easy: The storage of digital information is easy because there are many

types of semiconductor and magnetic memories of large capacity which can store digital data for

periods as long as necessary.

Greater accuracy and precision: Digital systems are much more accurate and precise than analog

systems, because digital systems can be expanded to handle more digits simply by adding more

switching circuits. Analog systems are quite complex and costly for the same accuracy and

precision.

Digital systems are less affected by noise: Unwanted electrical signals are called noise. Since in

analog systems the exact values of voltages are important and in digital systems only the range of

values is important, the effect of noise is more critical in analog systems. In digital systems, noise is

not critical as long as it is so large that we cannot distinguishing a HIGH from a LOW.

Operation can be controlled by a program: It is quite easy to design digital systems whose

operation is controlled by a set of stored instructions called a program. If we want to change the

system operation, we can do it easily by modifying the program. The analog systems can also be

programmed, but the variety of the available operations are limited.

Digital System are more reliable: Digital systems are more reliable than analog systems.

Limitations of Digital Systems

In real world, most physical quantities are analog in nature. These quantities are used as input

signals of system and monitored for controlling the system. In digital system these analog quantities

are used through following steps: 1. Convert the analog inputs to digital form by a using analog to

digital converted, ADC. 2. Process the digital information.3. Convert the digital outputs back to

analog form by digital to analog converter, DAC. Because of these conversions, the processing time

increases and the system becomes more complex. In most cases, these disadvantages are

outweighed by numerous advantages of digital techniques.

Page 3: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

NUMBER SYSTEMS :

The knowledge of number systems is important to understand how data are represented before they

can be processed by any digital system including a digital computer.

A number system is nothing more than a code that uses symbols to represent a number. In general, in

any number system, there is an ordered set of symbols known as digits.

The most widely used number system is positional number system. In positional number system, a

number is represented by a string of digits and each digit position has an associated weight. A

number is made up of a collection of digits and it has two parts ; integer and fraction, both are

separated by a radix point (.). The number is represented as, point

Where, r = radix or base of the number system

n = number of digits in the integer part

m = number of digits in fractional part

dn-1 = most significant digit (MSD)

d-m = least significant digit (LSD)

Radix or Base (r): The number of independent digits or symbols used in a number system, is known

as radix or base of the number system.

A number system is a representation method for numbers, A number system is identified by its base

,The base is a decimal unsigned integer with a minimum value of 2,The is no limit on the maximum

value for the base, however, the largest known base is 16,Commonly used number systems are also

identified by their name

There are 4 commonly used number systems:

Decimal : Base 10 with digit range is 0 – 9;

Hexadecimal : Hex is base 16 with a digit range of 0 – 9, A – F;

Octal : Octal is base 8 with a digit range of 0 – 7;

Binary : base 2 with a digit range of 0 – 1;

NUMBER SYSTEM CONVERSION:

We know that computer systems process binary data, but the information given by the user may be in

the form of decimal number, hexadecimal number, or octal number. So it is required to study the

conversion of the numbers from one number system to another.

Decimal to any base conversion:

Method : Division by the base

Calculations is done using a tabular form of the following headings (New Base, From base

number, Remainder)

Divide until the from base number reaches zero

The remainder column is the conversion result

A remainder digit should never be greater than new base - 1

Copy the remainder digits from bottom to top

Page 4: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Examples 1.1: Convert 612410 to base 5

New Base From Base Number Remainder

5 6124 4 least significant digit

5 1224 4

5 244 4

5 48 3

5 9 4

5 1 1 most significant digit

0

= 1434445

Examples 1.2: Convert 815110 to hexadecimal

New Base From Base Number Remainder

16 8151 7 least significant digit

16 509 13

16 31 15

16 1 1 most significant digit

0

= 1FD716

Decimal to Binary conversion:

Two methods: There are reverse processes of the two methods used to convert a binary no. to a

decimal no.

I method: is for small no’s the values of various powers of 2 need to be remembered. For conversion

of larger no’s have a table of powers of 2 known as the sum of weights method. The set of binary

weight values whose sum is equal to the decimal no. is determined.

To convert a given decimal integer no. to binary,

(1). Obtain largest decimal no. which is power of 2 not exceeding the remainder & record it

(2). Subtract this no. from the given no & obtain the remainder

(3). Once again obtain largest decimal no. which is power of 2 not exceeding this remainder &

record it.

(4). Subtract through no. from the remainder to obtain the next remainder.

(5). Repeat till you get a “0” remainder The sum of these powers of 2 expressed in binary is the

binary equivalent of the original decimal no. similarly to convert fractions to binary.

II method: It converts decimal integer no. to binary integer no by successive division by 2 & the

decimal fraction is converted to binary fraction by double –dabble method

Example 1.3: 163.87510 binary (I method)

Given decimal no. is mixed no. So convert its integer & fraction parts separately.

Integer part is 16310

The largest no. which is a power of 2, not exceeding 163 is 128. 128=27 =100000002 remainder is 163-

128=35 the largest no., a power of 2, not exceeding 35 is 32.

32=25=1000002. Remainder is 35-32=3, the largest no., a power of 2, not exceeding 35 is 2.

2=21 =102 Remainder is 3-2=1; 1=20= 12

Page 5: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

16310= 100000002+1000002+102+12= 101000112.

The fraction part is 0.87510

1. The largest fraction, which is a power of 2, not exceeding 0.875 is 0.5 =2-1=0.1002

Remainder is 0.875-0.5=0.3752.

2. 0.375 is 0.25 0.25 =2-2=0.012 Remainder is 0.375-.25=0.125.

3. 0.125 is 0.125 itself 0.125 =2-3 =0.0012 0.87510=0.1002+0.012+0.0012=0.1112

Final result is 163.87510 =10100011.1112.

Example 1.4: convert5210 to binary using double-dabble method

Divide the given decimal no successively by 2 &read the remainders upwards to get the equivalent

binary no. Successive division remainder.

Successive division remainder

2 | 52

2 | 26 --- 0

2 | 13 --- 0

2 | 6 --- 1

2 | 3 --- 0

2 | 1 --- 1

2 | 0 --- 1

= 1101002

Example 1.5 : (0.625)10

Integer Fraction Coefficient

0.625 * 2 = 1 . 25 a-1 = 1

0.25 * 2 = 0 . 50 a-2 = 0

0.50 * 2 = 1 . 00 a-3 = 1

Answer: (0.625)10 = (0.a-1 a-2 a-3)2 = (0.101)2 MSB LSB

Now, let's try a nontrivial example. Let's express a decimal number 1341 in binary notation. Note that

the desired base is 2, so we repeatedly divide the given decimal number by 2.

Example 1.6 :

Page 6: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Example 1.7 : Let's express the same decimal number 1341 in octal notation.

Example 1.8 : Let's express the same decimal number 1341 in hexadecimal notation.

Convert From Any Base to Decimal:

Let's think more carefully what a decimal number means. For example, 1234 means that there are

four boxes (digits); and there are 4 one's in the right-most box (least significant digit), 3 ten's in the

next box, 2 hundred's in the next box, and finally 1 thousand's in the left-most box (most significant

digit). The total is 1234:

Example 1.9 :

Thus, each digit has a value: 100=1 for the least significant digit, increasing to 101=10, 102=100,

103=1000, and so forth.

Likewise, the least significant digit in a hexadecimal number has a value of 160=1 for the least

significant digit, increasing to 161=16 for the next digit, 162=256 for the next, 163=4096 for the next,

and so forth. Thus, 1234 means that there are four boxes (digits); and there are 4 one's in the right-

most box (least significant digit), 3 sixteen's in the next box, 2 256's in the next, and 1 4096's in the

left-most box (most significant digit). The total is:

1*4096 + 2*256 + 3*16 + 4*1 = 4660

In summary, the conversion from any base to base 10 can be obtained from the formulae

Where b is the base, di is the digit at position i, m the number of digit after the decimal point, n the

number of digits of the integer part and X10 is the obtained number in decimal. This form the basic

of the polynomial method of converting numbers from any base to decimal

Example 1.10: Convert 234.14 expressed in an octal notation to decimal.

2*82 + 3*81 + 4*80+1*8-1 + 4*8-2 = 2*64 +3*8 +4*1 +1/8 +4/64 =156.1875

Page 7: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Example 1.11: Convert the hexadecimal number 4B3 to decimal notation. What about the decimal

equivalent of the hexadecimal number 4B3.3?

Solution:

Example 1.12: Convert 234.14 expressed in an octal notation to decimal.

Solution:

Other Base System to Non-Decimal System:

Step 1 − Convert the original number to a decimal number (base 10).

Step 2 − Convert the decimal number so obtained to the new base number.

Example 1.13: Octal Number − 258

Calculating Binary Equivalent −

Step 1 − Convert to Decimal

Step Octal Number Decimal Number

Step 1 258 ((2 × 81) + (5 × 80))10

Step 2 258 (16 + 5 )10

Step 3 258 2110

Octal Number − 258 = Decimal Number − 2110

Step 2 − Convert Decimal to Binary

Step Operation Result Remainder

Step 1 21 / 2 10 1

Step 2 10 / 2 5 0

Step 3 5 / 2 2 1

Step 4 2 / 2 1 0

Step 5 1 / 2 0 1

Decimal Number − 2110 = Binary Number − 101012

Octal Number − 258 = Binary Number − 101012

Binary to Octal conversion:

Starting from the binary pt. make groups of 3 bits each, on either side of the binary pt, & replace

each 3 bit binary group by the equivalent octal digit.

Convert 110101.1010102 to octal Group of 3

110 101. 101 010 6 5 . 5 2 Hexadecimal to binary:

Replace each hex digit by its 4-bit binary group.

Ex: 4BAC10 to binary

=01001011101011002 4 B A C 0100 1011 1010 1100

=65.528

Page 8: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Shortcut method - Binary to Octal

Step 1 − Divide the binary digits into groups of three (starting from the right).

Step 2 − Convert each group of three binary digits to one octal digit.

Example 1.14: Binary Number − 101012

Calculating Octal Equivalent −

Step Binary Number Octal Number

Step 1 101012 010 101

Step 2 101012 28 58

Step 3 101012 258

Binary Number − 101012 = Octal Number − 258

Shortcut method - Octal to Binary

Step 1 − Convert each octal digit to a 3 digit binary number (the octal digits may be treated as

decimal for this conversion).

Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single binary

number.

Example 1.15 : Octal Number − 258

Calculating Binary Equivalent −

Step Octal Number Binary Number

Step 1 258 210 510

Step 2 258 0102 1012

Step 3 258 0101012

Octal Number − 258 = Binary Number − 101012

Shortcut method - Binary to Hexadecimal

Step 1 − Divide the binary digits into groups of four (starting from the right).

Step 2 − Convert each group of four binary digits to one hexadecimal symbol.

Example 1.16 :Binary Number − 101012

Calculating hexadecimal Equivalent −

Step Binary Number Hexadecimal Number

Step 1 101012 0001 0101

Step 2 101012 110 510

Step 3 101012 1516

Binary Number − 101012 = Hexadecimal Number − 1516

Shortcut method - Hexadecimal to Binary

Step 1 − Convert each hexadecimal digit to a 4 digit binary number (the hexadecimal digits

may be treated as decimal for this conversion).

Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single binary

number.

Example 1.17 :Hexadecimal Number − 1516

Calculating Binary Equivalent −

Step Hexadecimal Number Binary Number

Step 1 1516 110 510

Step 2 1516 00012 01012

Step 3 1516 000101012

Hexadecimal Number − 1516 = Binary Number − 101012

Page 9: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Binary arithmetic:

The binary number system is widely used in digital systems. The basic arithmetic operations are

summarized in the below Table, where the sum and carry, difference and borrow, and product are

computed for every combination of binary digits (abbreviated bits) 0 and 1. For a more

comprehensive discussion of computer arithmetic, the reader may consult.

Binary addition: Binary addition is performed in a manner similar to that of decimal addition.

Corresponding bits are added and if a carry 1 is produced then it is added to the binary digits at the

left.

Elementary binary operations: 0 + 0 = 0

1 + 0 = 1

0 + 1 = 1

1 + 1 = 0 and a carry 1 (i.e. 10 in binary)

1 + 1 + 1 = 1 and carry 1 (i.e. 11 in binary)

The addition of two binary numbers is performed column wise exactly in the same manner as the

addition of decimal numbers. When the binary numbers are more than one bit, the addition takes

place bit by bit, which starts from left side. If the sum in one column is a two-bit number, the least

significant bit is written as part of the total sum and the most significant bit is carried to the next

left column as carry. An example of binary addition is given below.

EXAMPLE 1.18

Add the binary numbers 1101.101 and 111.011.

SOLUTION: We perform column by column addition as explained below:

In the 2-3’s column: 1 + 1 = 0, with a carry of 1 to the 2-2 column

In the 2-2’s column: 0 + 1 + 1 = 0, with a carry of 1 to the 2-1 column

In the 2-1’s column: 1 + 0 + 1 = 0, with a carry of 1 to the 1’s column

In the 1’s column: 1 + 1 + 1 = 1, with a carry of 1 to the 2’s column

In the 2’s column: 0 + 1 + 1 = 0, with a carry of 1 to the 4’s column

In the 4’s column: 1 + 1 + 1 = 1, with a carry of 1 to the 8’s column

In the 8’s column: 1 + 1 = 0, with a carry of 1 to the 16’s column

Binary Subtraction:

The rules for binary subtraction are as following: 0 - 0 = 0

1 - 0 = 1

1 - 1 = 0

0 - 1 = 1 with a borrow of 1

The subtraction of two binary numbers is also performed column wise exactly in the same manner

as the subtraction of decimal numbers. When the binary numbers are more than one bit, the

subtraction takes place bit by bit, starting from left side (LSB). When 1 is subtracted from 0, we

Page 10: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

borrow a 1 from the next higher significant bit. The following examples illustrate the subtraction of

two binary number.

EXAMPLE 1.19

Subtract 111.111 from 1010.01.

SOLUTION: We perform the column by column subtraction as explained below:

Therefore, in the 2-3 column, 10 - 1 = 1

In the 2-2’s column 10 - 1 = 1

In the 2-1’s column 1 - 1 = 0

In the 1’s column 1 - 1 = 0

In the 2’s column 10 - 1 = 1

In the 4’s column 1 - 1 = 0

In the 8’s column 0 - 0 = 0

Hence, the result is 0010.0112

Explanation:

In the 2-3 column, a 1 cannot be subtracted from a 0. So, borrow a 1 from the 2-2 column making the

2-2 column 0. The 1 borrowed from the 2-2 column becomes 10 in the 2-3 column. . In the 2-2 column,

a 1 cannot be subtracted from a 0. So, borrow a 1 from the 2-1 column, but it is also a 0. So, borrow a 1

from the 1’s column. That is also a 0, so borrow a 1 from the 2’s column making the 2’s column 0.

This 1 borrowed from the 2’s column becomes 10 in the 1’s column. Keep one 1 in the 1’s column,

bring the other 1 to the 2-1 column, which becomes 10 in this column. Keep one 1 in the 2-1 column

and bring the other 1 to the 2-2 column, which becomes 10 in this column. Therefore, Now, in the 2’s

column, a 1 cannot be subtracted from a 0; So, borrow a 1 from the 4’s column, but it is also a 0. So,

borrow a 1 from the 8’s column. Keep one 1 in the 4’s column, bring the other 1 to the 2’s column,

which becomes 10 in 2’s column. In the 4’s column 1 - 1 = 0,In the 8’s column 0 - 0 = 0.Hence, the

result is 0010.0112

Binary multiplication:

Just as with decimal numbers, the multiplication of binary numbers is performed by successive

addition while division is performed by successive subtraction.

Example 1.20: Multiply the binary numbers below:

11001.1 = (25.5)10

× 110.1 = (6.5)10

110011

000000×

110011××

110011×××

10100101.11 = (165.75)10

Page 11: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Binary Division:

Example 1.21 :Divide the binary number 1000100110 by 11001.

SIGNED BINARY NUMBERS: Representation of signed no’s binary arithmetic

Two ways of rep signed no’s

1. Sign Magnitude form

2. Complemented form

1. Sign Magnitude form: In sign magnitude form, an additional bit called the sign bit is placed in

front of the no. If the sign bit is 0, the no. is +ve, If it is a 1, the no is -ve.

Ex :

=+41 magnitude

Sign bit

= -41

Note: manipulation is necessary to add a +ve no to a –ve no

2. Complemented form: Complements are used in digital systems to simplify the subtraction

operation. For each base−r system there are two useful types of complements, the r ’s−complement,

and the (r-1)’s complement. These are also referred to as the radix complement and the diminished

radix complement respectively. Accordingly, for the base−10(decimal) system we have the 10’s -

complements and the 9’s-complements, for the base−2(binary) system we have the

2’s−complements and 1’s-complements, for the base−8(octal) system we have the 8’s−complements

and 7’s−complements, and for the base−16 we have the 16’s−complements and the

15’s−complements.

Diminished Radix Complement or (r – 1)’s Complement:

Consider a number N in base-r system having n digits, then the (r – 1)’s complement of N is defined as

(rn – 1) – N.

For decimal number, r = 10 and r - 1 = 9, so the 9’s complement of N is (10n – 1) - N . In this case, 10n

represents a number that consists of single 1 followed by n 0’s. 10n - 1 is a number represented by n

9’s. For example, if n = 4, we have 104 = 10,000 and 104- 1 = 9999. Hence, it follows that the 9’s

complement of a decimal number is obtained by subtracting each digit from 9.

For example; the 9’s complement of 645800 is 999999 - 645800 = 354199.

Page 12: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

For binary numbers, r = 2 and r - 1 = 1, so the 1’s complement of N is (2n – 1)- N . Again, 2n is

represented by a binary number that consists of a 1 followed by n 0’s.2n - 1 is a binary number

represented by n 1’s. For example, if n = 4, we have 24=100002 and 24-1 = 1111.

Thus, the 1’s complement of a binary number is obtained by subtracting each digit from 1. However,

when subtracting binary digits from 1, we can have either 1 - 0 = 1 or 1 - 1 = 0, which causes the bit to

change from 0 to 1 from 1 to 0, respectively. Therefore, the 1’s complement of a binary number is

formed by changing 1’s to 0’s and 0’s to 1’s. Similarly we can obtain simplified results of finding 1’s,

7’s and 15’s complements also.

Radix Complement or r’s Complement:

The r’s complement of an n-digit number N in base-r is defined as rn - N for N # 0 and as 0 for N = 0.

Comparing with the (r – 1)’s complement, we note that the r’s complement is obtained by adding 1

to the (r – 1)’s complement, since rn - N = [(rn – 1) - N]+ 1. Thus, the 10’s complement of decimal 8932

is 1067 + 1 = 1068 and is obtained by adding 1 to the 9’s complement.

1’s and 2’s Complements:

The 1’s complement of a binary number is obtained by complementing all its bits, that is, by

replacing all 0’s by 1’s and all 1’s by 0’s. For example, 1’s complement of 100101102 is 011010012. The 2’s

complement of a binary number is obtained by adding ‘1’ to its 1’s complement. The 2’s complement

of 100101102 is 011010102.

9’s and 10’s Complement:

Corresponding to the 1’s and 2’s complement in the binary system, in the decimal number system,

we have the 9’s complement and 10’s complement. The 9’s complement of a given decimal number

is obtained by subtracting each digit from 9. For example, the 9’s complement of 256810 would be

743110. On the other hand, the 10’s complement is obtained by adding ‘1’ to 9’s complement. For

example, the 10’s complement of 256810 is 743210.

7’s and 8’s Complement:

In the octal number system, we have the 7’s and 8’s complement. The 7’s complement of a given

octal number is obtained by subtracting each octal digit from 7. For example, the 7’s complement of

6538 would be 1248. The 8’s complement is obtained by adding ‘1’ to the 7’s complement. For

example, the 8’s complement of 6538 would be 1258.

15’s and 16’s Complement:

The 15’s complement and 16’s complement are defined with respect to the hexadecimal number

system. The 15’s complement is obtained by subtracting each hex digit from 15. For example, the 15’s

complement of (3BF)16 would be (C40)16. The 16’s complement is obtained by adding ‘1’ to the 15’s

complement. For example, the 16’s complement of (2AE) 16 would be (D52)16.

EXAMPLE 1.22: Find the 1’s complement of the following binary numbers.

(a) 1101100(b) 0.1011(c) 1101100.1011

SOLUTION: (a) Replacing all ones with zeros and all zeros with ones we find that the 1’s

complement of 1101100 is 0010011.

(b) Replacing all ones with zeros and all zeros with ones we find that the 1’s complement of 0.1011 is

0.0100.

(c) Replacing all ones with zeros and all zeros with ones we find that the 1’s complement of

1101100.1011 is 0010011.0100.

Page 13: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

EXAMPLE 1.23 : Find the 2’s complement of the following binary numbers.

(a) 1101100 (b) 0.1011 (c) 1101100.1011

SOLUTION: First we find 1’s complement of given number and then add 1 to the 1’s complement to

obtain 2’s complement.

(a) 1101100 (b) 0.1011

(c) Given number: 1101100.1011

1’s complement: 0010011.0100

2’s complement: 0010011.0100+1 = 0010011.0101

EXAMPLE 1.24: Find the 9’s complement & 10’s complement of the following numbers.

(a) 0.8642 (b) 1056.074

EXAMPLE 1.25: Find the 7’s complement & 8’s complement of the following octal numbers.

(a) 407.2708 (b) 0156.00378

SOLUTION: We subtract every digit of given number from 7 and we find 7’s complement

For 8’s complement : First we find 7’s complement of given number and then add 1 to the 7’s

complements to obtain the 8’s complement.

(a) 370.507+1 = 370.508 (b) 7621.7740+1 = 7821.7741

EXAMPLE 1.26: Find the 15’s complement & 16’s complement of the following hexadecimal

numbers. (a) A B 916 (b) 83D.9F16

SOLUTION: 15’s complement, we subtract every digit of the given number from 15

For 16’s complement: find 15’s complement of the given number and then add 1 to the 15’s

complement to obtain the 16’s complement.

(a) 564+1 = 565 (b) 7C2.60+1 = 7C2.61

Page 14: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Subtraction with Complements :

The direct method of subtraction taught in elementary schools uses the borrow concept. In this

method, we borrow a 1 from a higher significant position when the minuend digit is smaller than the

subtrahend digit. The method works well when people perform subtraction with paper and pencil.

However, when subtraction is implemented with digital hardware, the method is less efficient than

the method that uses complements.

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 + (rn - N) = M - N + rn.

2. If M≥ N, the sum will produce an end carry rn, 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 rn - (N - M), which is the r’s

complement of (N - M). To obtain the answer in a familiar form, take the r’s complement of the sum

and place a negative sign in front.

EXAMPLE 1.27: Using 10’s complement, subtract 72532 - 3250.

M = 72532

10’s complement of N = + 96750

Sum = 169282

Discard end carry 105 = - 100000

Answer = 69282

The occurrence of the end carry signifies that M ≥ N and that the result is therefore positive.

EXAMPLE 1.28: Using 10’s complement, subtract 3250 - 72532.

M = 03250

10’s complement of N = + 27468

Sum = 30718

There is no end carry. Therefore, the answer is - (10’s complement of 30718) = -69282.Note that since

3250 < 72532, the result is negative.

EXAMPLE 1.29:

Given the two binary numbers X = 1010100 and Y = 1000011, perform the subtraction

(a) X - Y and (b) Y - X by using 2’s complements.

(a) X = 1010100

2’s complement of Y = + 0111101

Sum= 10010001

Discard end carry 27 = - 10000000

Answer: X - Y = 0010001

(b) Y = 1000011

2’s complement of X = + 0101100

Sum= 1101111

There is no end carry. Therefore, the answer is

Y - X = -(2’s complement of 1101111) = -0010001

.

Page 15: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

EXAMPLE 1.30 : Repeat Example 1.29, but this time using 1’s complement.

(a) X - Y = 1010100 - 1000011

X = 1010100

1’s complement of Y = + 0111100

Sum = 10010000

End around carry = + 1

Answer: X - Y = 0010001

(b) Y - X = 1000011 - 1010100

Y = 1000011

1’s complement of X = + 0101011

Sum = 1101110

There is no end carry. Therefore, the answer is Y - X = - (1’s complement of 1101110) = -0010001.

Note that the negative result is obtained by taking the 1’s complement of the sum.

FLOATING POINT NUMBERS: In the decimal number system many bits are required to represent

very large integer numbers. There is also a problem when numbers with both integer and fractional

parts, such as 35.2582, need to be represented. Floating-point notation can be used conveniently to

represent both large as well as small fractional or mixed numbers. Also arithmetic operations on

these numbers becomes much easier if The number is positive, hence the sign bit is 0, and the single

precision floating point representation of the given number is :

Double Precision Floating Point Binary Numbers: In double precision, the word size of the

floating point number is 64-bits. The format of single precision floating point number is shown in

Figure 1.14.2. Out of these 64-bits, the left most bit is used for sign(S), the next 11 bits are used for

bias exponent and LSB 52-bits are used for mantissa.

To illustrate, let us consider the example of a decimal number 144.125. Its binary representation is

144.125 10 = 10010000.001 = 1.0010000001 x 27

The mantissa is converted to 52-bits significant value by putting zeros to the left side of number as

Significant = 1001000000100000000000000000000000000000000000000000.

BINARY CODES:

In the coding, when numbers, letters or words are represented by a specific group of symbols, it is

said that the number, letter or word is being encoded. The group of symbols is called as a code. The

digital data is represented, stored and transmitted as group of binary bits. This group is also called

as binary code. The binary code is represented by the number as well as alphanumeric letter.

Page 16: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Classification of binary codes:

The codes are broadly categorized into following four categories.

Weighted Codes

Non-Weighted Codes

Binary Coded Decimal Code

Alphanumeric Codes

Error Detecting Codes

Error Correcting Codes

Weighted Codes

Weighted binary codes are those binary codes which obey the positional weight principle. Each

position of the number represents a specific weight. Several systems of the codes are used to express

the decimal digits 0 through 9. In these codes each decimal digit is represented by a group of four

bits.

Non-Weighted Codes

In this type of binary codes, the positional weights are not assigned. The examples of non-weighted

codes are Excess-3 code and Gray code.

Excess-3 code

The Excess-3 code is also called as XS-3 code. It is non-weighted code used to express decimal

numbers. The Excess-3 code words are derived from the 8421 BCD code words adding (0011)2 or

(3)10 to each code word in 8421. The excess-3 codes are obtained as follows −

Example

Page 17: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Gray Code :

It is the non-weighted code and it is not arithmetic codes. That means there are no specific weights

assigned to the bit position. It has a very special feature that, only one bit will change each time the

decimal number is incremented as shown in fig. As only one bit changes at a time, the gray code is

called as a unit distance code. The gray code is a cyclic code. Gray code cannot be used for

arithmetic operation.

Application of Gray code

Gray code is popularly used in the shaft position encoders.

A shaft position encoder produces a code word which represents the angular position of the

shaft.

Binary Coded Decimal (BCD) code :

In this code each decimal digit is represented by a 4-bit binary number. BCD is a way to express

each of the decimal digits with a binary code. In the BCD, with four bits we can represent sixteen

numbers (0000 to 1111). But in BCD code only first ten of these are used (0000 to 1001). The

remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.

Page 18: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Advantages of BCD Codes

It is very similar to decimal system.

We need to remember binary equivalent of decimal numbers 0 to 9 only.

Disadvantages of BCD Codes

The addition and subtraction of BCD have different rules.

The BCD arithmetic is little more complicated.

BCD needs more number of bits than binary to represent the decimal number. So BCD is

less efficient than binary.

Alphanumeric codes:

A binary digit or bit can represent only two symbols as it has only two states '0' or '1'. But this is not

enough for communication between two computers because there we need many more symbols for

communication. These symbols are required to represent 26 alphabets with capital and small letters,

numbers from 0 to 9, punctuation marks and other symbols.

The alphanumeric codes are the codes that represent numbers and alphabetic characters. Mostly

such codes also represent other characters such as symbol and various instructions necessary for

conveying information. An alphanumeric code should at least represent 10 digits and 26 letters of

alphabet i.e. total 36 items. The following three alphanumeric codes are very commonly used for the

data representation.

American Standard Code for Information Interchange (ASCII).

Extended Binary Coded Decimal Interchange Code (EBCDIC).

Five bit Bardot Code. ASCII code is a 7-bit code whereas EBCDIC is an 8-bit code. ASCII code is more commonly used

worldwide while EBCDIC is used primarily in large IBM computers.

ERROR DETECTING & CORRECTING CODES: There are binary code techniques available to

detect and correct data during data transmission.

ERROR DETECTING CODES:

When binary data is transmitted & processed, it is susceptible to noise that can alter or distort its

contents. The 1‘s may get changed to 0‘s & 1‘s .because digital systems must be accurate to the digit,

error can pose a problem. Several schemes have been devised to detect the occurrence of a single bit

error in a binary word, so that whenever such an error occurs the concerned binary word can be

corrected & retransmitted.

Parity: The simplest techniques for detecting errors is that of adding an extra bit known as parity

bit to each word being transmitted. Two types of parity: Odd parity, even parity for odd parity, the

parity bit is set to a ‗0‘or a ‗1‘at the transmitter such that the total no. of 1 bit in the word including

the parity bit is an odd no.For even parity, the parity bit is set to a ‗0‘or a ‗1‘at the transmitter such

that the parity bit is an even no.

Page 19: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Decimal 8421 code Odd parity Even parity

0 0000 1 0

1 0001 0 1

2 0010 0 1

3 0011 1 0

4 0100 0 1

5 0100 1 0

6 0110 1 0

7 0111 0 1

8 1000 0 1

9 1001 1 0

When the digit data is received. a parity checking circuit generates an error signal if the total no of

1‘s is even in an odd parity system or odd in an even parity system. This parity check can always

detect a single bit error but cannot detect 2 or more errors with in the same word. Odd parity is

used more often than even parity does not detect the situation. Where all 0‘s are created by a short

ckt or some other fault condition.

Ex: Even parity scheme

(a) 10101010 (b) 11110110 (c) 10111001

Ans:

(a) No. of 1‘s in the word is even is 4 so there is no error

(b) No. of 1‘s in the word is even is 6 so there is no error

(c) No. of 1‘s in the word is odd is 5 so there is error

Ex: odd parity

(a)10110111 (b) 10011010 (c)11101010

Ans:

(a) No. of 1‘s in the word is even is 6 so word has error

(b) No. of 1‘s in the word is even is 4 so word has error

(c) No. of 1‘s in the word is odd is 5 so there is no error

Checksums:

Simple parity can‘t detect two errors within the same word. To overcome this, use a sort of 2

dimensional parity. As each word is transmitted, it is added to the sum of the previously transmitted

words, and the sum retained at the transmitter end. At the end of transmission, the sum called the

check sum. Up to that time sent to the receiver. The receiver can check its sum with the transmitted

sum. If the two sums are the same, then no errors were detected at the receiver end. If there is an

error, the receiving location can ask for retransmission of the entire data, used in teleprocessing

systems.

Block parity:

Block of data shown is create the row & column parity bits for the data using odd parity. The parity

bit 0 or 1 is added column wise & row wise such that the total no. of 1‘s in each column & row

including the data bits & parity bit is odd.

Page 20: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Error –Correcting Codes:

A code is said to be an error –correcting code, if the code word can always be deduced from an

erroneous word. For a code to be a single bit error correcting code, the minimum distance of that

code must be three. The minimum distance of that code is the smallest no. of bits by which any two

code words must differ. A code with minimum distance of 3 can‘t only correct single bit errors but

also detect (can‘t correct) two bit errors, The key to error correction is that it must be possible to

detect & locate erroneous that it must be possible to detect & locate erroneous digits. If the location

of an error has been determined. Then by complementing the erroneous digit, the message can be

corrected , error correcting , code is the

The basic principles in constructing a Hamming error-correcting code are as follows. To each group

of m information or message digits, k parity-checking digits, denoted p1, p2, . . . , pk, are added to

form an (m + k)-digit code. The location of each of the m + k digits within a code word is assigned a

decimal value; one starts by assigning a 1 to the most significant digit and m + k to the least

significant digit. Then k parity checks are performed on selected digits of each code word. The result

of each parity check is recorded as 1 or 0, depending, respectively, on whether an error has or has

not been detected. These parity checks make possible the development of a binary number, c1c2 · · ·

ck, whose value is equal to the decimal value assigned to the location of the erroneous digit when an

error occurs and is equal to zero if no error occurs. This number is called the position (or location)

number.

Position number

Error position c1 c2 c3

0 (no error) 0 0 0

1 0 0 1

2 0 1 0

3 0 1 1

4 1 0 0

5 1 0 1

6 1 1 0

7 1 1 1

Table 1.1 Position numbers c1, c2, c3

The number k of digits in the position number must be large enough to describe the location of any

of the m + k possible single errors, and must in addition take on the value zero to describe the “no

error” condition. Consequently, k must satisfy the inequality 2k ≥ m + k + 1. Thus, for example, if the

original message is in BCD where m = 4 then k = 3 and at least three parity checking digits must be

added to the BCD code. The resultant error-correcting code thus consists of seven digits.

In this case, if the position number is equal to 101, it means that an error has occurred in position 5.

If, however, the position number is equal to 000, the message is correct. In order to be able to

specify the checking digits by means of only message digits and independently of each other, they

are placed in positions 1, 2, 4. . . 2k−1. Thus, if m = 4 and k = 3 then the checking digits are placed in

positions 1, 2, and 4 while the remaining positions contain the original (BCD) message bits.

Page 21: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

7-bit Hamming code:

To transmit four data bits, 3 parity bits located at positions 20 21&22 from left are added to make a 7

bit code word which is then transmitted. The word format; D—Data bits; P-Parity bits;

P1 P2 D3 P4 D5 D6 D7

Ex: Encode the data bits 1101 into the 7 bit even parity Hamming Code

The bit pattern is

P1 P2 D3 P4 D5 D6 D7

1 1 0 1

Bits 1,3,5,7 (P1 111) must have even parity, so P1 =1

Bits 2, 3, 6, 7 (P2 101) must have even parity, so P2=0

Bits 4,5,6,7 (P4 101) must have even parity, so P4=0

The final code is 1010101

Hamming code is construction:

For example, in the code word 1100110, the checking digits (in boldface) are p1 = 1, p2 = 1, p3 = 0,

while the message digits are 0, 1, 1, 0, which correspond to decimal 6. We shall now show how the

Hamming code is constructed, by constructing the code for m = 4 and k = 3. As discussed above, the

parity-checking digits must be specified in such a way that, when an error occurs, the position

number will take on the value assigned to the location of the erroneous digit. Table 1.7 lists the

seven error positions and the corresponding values of the position number. It is evident that if an

error occurs in position 1, or 3, or 5, or 7, the least significant digit, i.e., c3, of the position number

must be equal to 1. If the code is constructed so that in every code word the digits in positions 1, 3, 5,

and 7 have even parity, then the occurrence of a single error in any of these positions will cause an

odd parity. In such a case, the least significant digit of the position number is recorded as 1. If no

error occurs among these digits, a parity check will show an even parity and the least significant

digit of the position number is recorded as 0.

From Table 1.1, we observe that an error in positions 2, 3, 6, or 7 should result in the recording of a 1

in the center of the position number. Hence, the code must be designed so that the digits in

positions 2, 3, 6, and 7 have even parity. Again, if the parity check of these digits shows an odd parity

then the corresponding position-number digit, i.e., c2, is set to 1; otherwise it is set to 0. Finally, if an

error occurs in positions 4, 5, 6, or 7 then the most significant digit of the position number, i.e., c1,

should be a 1. Therefore, if digits 4, 5, 6, and 7 are designed to have even parity, an error in any of

these digits will be recorded as a 1 in the most significant digit of the position number. To

summarize the situation regarding the checking digits.

pi : p1 is selected so as to establish even parity in positions 1, 3, 5, 7;

p2 is selected so as to establish even parity in positions 2, 3, 6, 7;

p3 is selected so as to establish even parity in positions 4, 5, 6, 7.

The code can now be constructed by adding the appropriate checking digits to the message digits.

Consider, for example, the message 0100 (i.e., decimal 4), as shown in the table below.

Table 1.2 Hamming code for BCD

Page 22: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Digit position and symbol

Decimal 1 2 3 4 5 6 7

digit p1 p2 m1 p3 m2 m3 m4

0 0 0 0 0 0 0 0

1 1 1 0 1 0 0 1

2 0 1 0 1 0 1 0

3 1 0 0 0 0 1 1

4 1 0 0 1 1 0 0

5 0 1 0 0 1 0 1

6 1 1 0 0 1 1 0

7 0 0 0 1 1 1 1

8 1 1 1 0 0 0 0

9 0 0 1 1 0 0 1

Digit position: 1 2 3 4 5 6 7

Digit symbol: p1 p2 m1 p3 m2 m3 m4

Original BCD message: 0 1 0 0

Parity check in positions 1, 3, 5, 7 requires p1 = 1: 1 0 1 0 0

Parity check in positions 2, 3, 6, 7 requires p2 = 0: 1 0 0 1 0 0

Parity check in positions 4, 5, 6, 7 requires p3 = 1: 1 0 0 1 1 0 0

Coded message: 1 0 0 1 1 0 0

Thus checking digit p1 is set equal to 1 so as to establish even parity in positions 1, 3, 5, and 7.

Similarly, it is evident that p2 must be 0 and p3 must be 1, so that even parity is established,

respectively, in positions 2, 3, 6, and 7 and 4, 5, 6, and 7. The Hamming code for the decimal digits

coded in BCD is shown in Table 1.2.

Error Position For 15 bit code

C4 C3 C2 C1

For 12 bit code

C4 C3 C2 C1

For 7 bit code

C3 C2 C1

0 0 0 0 0 0 0 0 0 0 0 0

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

2 0 0 1 0 0 0 1 0 0 1 0

3 0 0 1 1 0 0 1 1 0 1 1

4 0 1 0 0 0 1 0 0 1 0 0

5 0 1 0 1 0 1 0 1 1 0 1

6 0 1 1 0 0 1 1 0 1 1 0

7 0 1 1 1 0 1 1 1 1 1 1

8 1 0 0 0 1 0 0 0

9 1 0 0 1 1 0 0 1

10 1 0 1 0 1 0 1 0

11 1 0 1 1 1 0 1 1

12 1 1 0 0 1 1 0 0

13 1 1 0 1

14 1 1 1 0

15 1 1 1 1

Page 23: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

15-bit Hamming Code:

It transmit 11 data bits, 4 parity bits located 20 21 22 23

Word format is

P1 P2 D3 P4 D5 D6 D7 P8 D9 D10 D11 D12 D13 D14 D15 12-Bit Hamming

Code: It transmit 8 data bits, 4 parity bits located at position 20 21 22 23 Word format is

P1 P2 D3 P4 D5 D6 D7 P8 D9 D10 D11 D12 The following table shows a count in hexadecimal, decimal, octal, and binary

S.NO Hexadecimal Decimal Octal Binary

1 0 0 0 0

2 1 1 1 1

3 2 2 2 10

4 3 3 3 11

5 4 4 4 100

6 5 5 5 101

7 6 6 6 110

8 7 7 7 111

S.NO Hexadecimal Decimal Octal Binary

9 8 8 10 1000

10 9 9 11 1001

11 A 10 12 1010

12 B 11 13 1011

13 C 12 14 1100

14 D 13 15 1101

15 E 14 16 1110

16 F 15 17 1111

17 10 16 20 10000

Number conversion Without fractions Fractions

Decimal to binary

,octal,hexadecimal

Divide by 2 for binary, divide by 8

for octal and divide by 16 for

hexadecimal

Multiply fractional part by 2 in binary

.By 8 for octal and by 16 for

hexadecimal

Binary to decimal

Same applies for octal

and hexadecimal

Add the weighted value to the

decimal number ( base 2) where place

holder is 0 to n 2 2 , 2 1 ,2 0 Base 8 and

16 respectively

Add the weighted value to the

decimal number ( base 2) where

fractional placeholder is 2-1, 2-2………Base 8 and 16 respectively

Binary to octal Create a group of 3 bits ,add trailing

bits to the left with 0, and assign the

corresponding value

Create a group of 3 bits and add

trailing bits to the right with 0,assign

the corresponding value

Binary to hexadecimal Create a group of 4 bits ,add trailing

bits to the left with 0

Create a group of 4bits and add

trailing bits to the right with 0

Octal and

hexadecimal to binary

Write binary equivalent of each digit

towards left. (For octal form group

of 3bits and for hexadecimal in 4bits)

Write binary equivalent of each digit

after decimal point towards right

Octal to hexadecimal First convert octal to binary then

binary to hexadecimal

Same as for integers

Hexadecimal to octal First convert hexadecimal to binary

then binary to octal

Same as for integers

Page 24: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

BOOLENA ALGEBRA AND LOGIC GATES Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses only the binary

numbers i.e. 0 and 1. It is also called as Binary Algebra or logical Algebra. Boolean algebra was

invented by George Boole in 1854.

Rule in Boolean Algebra

Following are the important rules used in Boolean algebra.

Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.

Complement of a variable is represented by an overbar (-). Thus, complement of variable B

is represented as . Thus if B = 0 then = 1 and B = 1 then = 0.

ORing of the variables is represented by a plus (+) sign between them. For example ORing

of A, B, C is represented as A + B + C.

Logical ANDing of the two or more variable is represented by writing a dot between them

such as A.B.C. Sometime the dot may be omitted like ABC.

TRUTH TABLE:

A truth Table represents the relation between all possible inputs and outputs of any logic device or

logic circuit in a tabular form. The number of inputs may vary from one to many depending upon

the device or complexity of the circuit. Number of output also varies in this way and may be one

or more.

AXIOMS:

Axioms or Postulates are a set of logical expressions i.e., without proof. & also we can build a set of

useful theorems. Each axiom can be interpreted as the outcome of an operation performed by a

logic gate.

BASIC BOOLEAN OPERATIONS:

The normal algebra includes all standard arithmetic operations such as addition, subtraction,

division, square, cube, square root, etc. On the other hand, Boolean algebra is simpler in that

sense, as it uses only three basic operations, namely

1. OR operation 2. AND operation 3. NOT operation

Boolean Laws:

Complementation law :

Law1: 0 ̅=1

Law2: 1̅=0

Law3: if A=0,then A̅=1

Law4: if A=1,then A̅=0

Law5: if A̅=A (double inversion law)

Page 25: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

AND Law OR Law

Law1: A.0=0 (Null law) Law1: A+0=A

Law2: A.1=A (Identity law) Law2: A+1=1

Law3: A.A=A (Impotence law) Law3: A+A=A (Impotence law)

Law4: A. A̅=0 Law4: A+ A̅=1

Basic Theorems and Properties of Boolean algebra :

Commutative law :

Law1: A+B=B+A Law2: A.B=B.A

Associative law :

Law1: A + (B +C) = (A +B) +C Law2: A(B.C) = (A.B)C

Distributive law :

Law1: A.(B + C) = AB+ AC Law2: A + BC = (A + B).(A +C)

Absorption law :

Law1: A +AB =A Law2:A(A +B) = A

Solution:A(1+B) = A Solution:A.A+A.B = A+A.B = A(1+B) = A

DeMorgan Theorems :

Theorem1: (A + B)=A̅. B̅ Theorem2: (A .B)=A̅+ B̅

Redundant Literal Rule :

Rule1: A+ A̅.B=A+B; Solution: A+ A̅.B = (A+ A̅).(A+B) ∴ A + BC = (A + B).(A +C);

A+B ∴A+A=1

Rule2: A.(A̅+B)=AB ; Solution: A.(A̅+B) = A.A̅+A.B = AB

Consensus Theorem :

Theorem1. AB+ A’C + BC = AB + A’C Theorem2. (A+B). (A’+C).(B+C) =(A+B).( A’+C)

The BC term is called the consensus term and is redundant. The consensus term is formed from a

paır of terms in which a variable (A) and its complement (A’) are present; the consensus term is

formed by multiplying the two terms and leaving out the selected variable and its complement

Consensus Theorem1 Proof: AB+A’C+BC=AB+A’C+ (A+A’) BC =AB+A’C+ABC+A’BC =AB (1+C) +A’C (1+B) = AB+ A’C

Principle of Duality: Each postulate consists of two expressions statement one expression is transformed into the other by interchanging the operations (+) and (⋅) as well as the identity elements 0 and 1. Such expressions are known as duals of each other. If some equivalence is proved, then its dual is also immediately true. E.g. If we prove: (x.x) + (x’+x’) =1, then we have by duality: (x+x) ⋅ (x’.x’) =0

Page 26: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

The Huntington postulates were listed in pairs and designated by part (a) and part (b) in below table.

Table for Postulates and Theorems of Boolean algebra Part-A Part-B

A+0=A A.0=0

A+1=1 A.1=A

A+A=A (Impotence law) A.A=A (Impotence law)

A+ A̅=1 A. A̅=0

A̅=A (double inversion law) --

Commutative law: A+B=B+A A.B=B.A

Associative law: A + (B +C) = (A +B) +C A(B.C) = (A.B)C

Distributive law: A.(B + C) = AB+ AC A + BC = (A + B).(A +C)

Absorption law: A +AB =A A(A +B) = A

DE Morgan Theorem: (A + B) =A̅. B̅ (A .B)=A̅+ B̅

Redundant Literal Rule: A+ A̅.B=A+B A.(A̅+B)=AB

Consensus Theorem: AB+ A’C + BC = AB + A’C (A+B). (A’+C).(B+C) =(A+B).( A’+C)

Canonical and Standard Forms

We need to consider formal techniques for the simplification of Boolean functions.

Identical functions will have exactly the same canonical form.

1. Minterms and Maxterms

2. Sum-of-Minterms and Product-of- Maxterms

3. Product and Sum terms

4. Sum-of-Products (SOP) and Product-of-Sums (POS)

Definitions :

Literal: A variable or its complement.

Product term: literals connected by •.

Sum term: literals connected by +.

Minterm: a product term in which all the variables appear exactly once, either complemented or

uncomplemented.

Maxterm: a sum term in which all the variables appear exactly once, either complemented or

uncomplemented.

Canonical form: Boolean functions expressed as a sum of Minterms or product of Maxterms are

said to be in canonical form.

Minterm Represents exactly one combination in the truth table. Denoted by mj, where j is the

decimal equivalent of the minterm’s corresponding binary combination (bj). A variable in mj is

complemented if its value in bj is 0, otherwise is uncomplemented.

Example: Assume 3 variables (A, B, C), and j=3. Then, bj = 011 and its corresponding minterm is

denoted by mj = A’BC

Maxterm Represents exactly one combination in the truth table. Denoted by Mj, where j is the

decimal equivalent of the maxterm’s corresponding binary combination (bj).A variable in Mj is

complemented if its value in bj is 1, otherwise is uncomplemented.

Page 27: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Example: Assume 3 variables (A, B, C), and j=3. Then, bj = 011 and its corresponding maxterm is

denoted by Mj = A+B’+C’.

Truth Table notation for Minterms and Maxterms :

Minterms and Maxterms are easy to denote using a truth table.

Example: Assume 3 variables x,y,z (order is fixed)

x y z Minterm Maxterm

0 0 0 x’y’z’ = m0 x+y+z = M0

0 0 1 x’y’z = m1 x+y+z’ = M1

0 1 0 x’yz’ = m2 x+y’+z = M2

0 1 1 x’yz = m3 x+y’+z’= M3

1 0 0 xy’z’ = m4 x’+y+z = M4

1 0 1 xy’z = m5 x’+y+z’ = M5

1 1 0 xyz’ = m6 x’+y’+z = M6

1 1 1 xyz = m7 x’+y’+z’ = M7

Canonical Forms

Every function F ( ) has two canonical forms:

a. Canonical Sum-Of-Products (sum of minterms)

b. Canonical Product-Of-Sums (product of maxterms)

Canonical Sum-Of-Products: The minterms included are those mj such that F( ) = 1 in row j of the

truth table for F( ).

Canonical Product-Of-Sums: The maxterms included are those Mj such that F( ) = 0 in row j of the

truth table for F( ).

A Boolean function can be expressed algebraically from a given truth table by forming a

minterm for each combination of the variables that produces a 1 in the function and then

taking the OR of all those terms. For example, the function f1 in Table 1.2 is determined by

expressing the combinations 001, 100, and 111 a x’y’z, xy’z’, and xyz, respectively. Since each one of

these minterms results in f1 = 1, we have f1 = x’y’z + xy’z’ + xyz = m1 + m4 + m7

Table 1.2: Functions of Three Variables

Similarly, it may be easily verified that f2 = x’yz + xy’z + xyz’ + xyz = m3 + m5 + m6 + m7.

These examples demonstrate an important property of Boolean algebra: Any Boolean function can

be expressed as a sum of minterms (with “sum” meaning the ORing of terms).

Page 28: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Now consider the complement of a Boolean function. It may be read from the truth table by

forming a minterm for each combination that produces a 0 in the function and then ORing those

terms. The complement of f1 is read as

f1’= x’y’z’+ x’yz’ + x’yz + xy’z + xyz’

If we take the complement of f1’, we obtain the function f1:

f1 = (x + y + z) (x + y’+ z) (x’ + y + z’) (x’ + y’ + z) = M0. M2. M3. M5. M6

Similarly, it is possible to read the expression for f2 from the table:

f2 = (x + y + z)(x + y + z’)(x + y’ + z)(x’+ y + z)= M0M1M2M4

These examples demonstrate a second property of Boolean algebra: Any Boolean function can be

expressed as a product of maxterms (with “product” meaning the ANDing of terms). The

procedure for obtaining the product of maxterms directly from the truth table is as follows: Form

a maxterm for each combination of the variables that produces a 0 in the function, and then form

the AND of all those maxterms. Boolean functions expressed as a sum of minterms or

product of maxterms are said to be in canonical form.

Shorthand: Σ and Π :

f1(a,b,c) = Σ m(1,2,4,6), where Σ indicates that this is a sum-of-products form, and m(1,2,4,6)

indicates that the minterms to be included are m1, m2, m4, and m6.

f1(a,b,c) = Π M(0,3,5,7), where Π indicates that this is a product-of-sums form, and M(0,3,5,7)

indicates that the maxterms to be included are M0, M3, M5, and M7.

Since mj = Mj’ for any j, Σ m(1,2,4,6) = Π M(0,3,5,7) = f1(a,b,c)

Conversion between Canonical Forms

Replace Σ with Π (or vice versa) and replace those j’s that appeared in the original form with those

that do not.

Example: f1(a,b,c)= a’b’c + a’bc’ + ab’c’ + abc’ = m1 + m2 + m4 + m6 = Σ(1,2,4,6)

= Π(0,3,5,7) = (a+b+c)•(a+b’+c’)•(a’+b+c’)•(a’+b’+c’)

Standard Forms

Another way to express Boolean functions is in standard form. In this configuration, the terms

that form the function may contain one, two, or any number of literals.

There are two types of standard forms: the sum of products and products of sums.

The sum of products is a Boolean expression containing AND terms, called product terms, with

one or more literals each. The sum denotes the ORing of these terms. An example of a function

expressed as a sum of products is F1 = y’ + xy + x’yz’, The expression has three product terms, with

one, two, and three literals. Their sum is, in effect, an OR operation.

A product of sums is a Boolean expression containing OR terms, called sum terms. Each term may

have any number of literals. The product denotes the ANDing of these terms. An example of a

function expressed as a product of sums is F2 = x(y’ + z)(x’ + y + z’), This expression has three sum

terms, with one, two, and three literals. The product is an AND operation.

Page 29: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Conversion of SOP from standard to canonical form

Example-1.

Express the Boolean function F = A + B’C as a sum of minterms.

Solution: The function has three variables: A, B, and C. The first term A is missing two variables;

therefore, A = A(B + B’) = AB + AB’

This function is still missing one variable, so A = AB(C + C’) + AB’ (C + C’)

= ABC + ABC’ + AB’C + AB’C’

The second term B’C is missing one variable; hence,B’C = B’C(A + A’) = AB’C + A’B’C

Combining all terms, we have F = A + B’C = ABC + ABC’ + AB’C + AB’C’+ A’B’C

But AB’C appears twice, and according to theorem (x + x = x), it is possible to remove one of those

occurrences. Rearranging the minterms in ascending order, we finally obtain

F = A’B’C + AB’C + AB’C + ABC’ + ABC = m1 + m4 + m5 + m6 + m7

When a Boolean function is in its sum‐of‐minterms form, it is sometimes convenient to express

the function in the following brief notation: F(A, B, C) = Σm (1, 4, 5, 6, 7)

Example-2.

Express the Boolean function F = xy + x’z as a product of maxterms.

Solution: First, convert the function into OR terms by using the distributive law:

F = xy + x’z = (xy + x’)(xy + z) = (x + x’)(y + x’)(x + z)(y + z) = (x’+ y)(x + z)(y + z)

The function has three variables: x, y, and z. Each OR term is missing one variable; therefore,

x’+ y = x’ + y + zz’ = (x’ + y + z)(x’ + y + z’)

x + z = x + z + yy’ = (x + y + z)(x + y’ + z)

y + z = y + z + xx’ = (x + y + z)(x’ + y + z)

Combining all the terms and removing those which appear more than once, we finally obtain

F = (x + y + z)(x + y’ + z)(x’ + y + z)(x’ + y + z)

F= M0M2M4M5

A convenient way to express this function is as follows: F(x, y, z) = πM(0, 2, 4, 5)

The product symbol, π, denotes the ANDing of maxterms; the numbers are the indices of the

maxterms of the function.

Digital Logic Gates:

Boolean functions are expressed in terms of AND, OR, and NOT operations, it is easier to

implement a Boolean function with these type of gates.

NAND and NOR gates are used extensively as standard logic gates and are in fact far more popular

than the AND and OR gates. This is because NAND and NOR gates are easily constructed with

transistor circuits and because digital circuits can be easily implemented with them.

Page 30: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Page 31: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Properties of XOR Gates :

XOR (also ⊕) : the “not-equal” function

XOR(X,Y) = X ⊕ Y = X’Y + XY’

Identities:

a. X ⊕ 0 = X

b. X ⊕ 1 = X’

c. X ⊕ X = 0

d. X ⊕ X’ = 1

Properties:

a. X ⊕Y = Y ⊕ X

b. (X ⊕ Y) ⊕ W = X ⊕ ( Y ⊕ W)

Universal Logic Gates:

NAND and NOR gates are called Universal gates. All fundamental gates (NOT, AND, OR) can be

realized by using either only NAND or only NOR gate. A universal gate provides flexibility and

offers enormous advantage to logic designers.

NAND as a Universal Gate:

Implementation of gates using NAND gates :

a) NOT gate:

b) AND gate:

c) OR gate:

d) NOR gate:

e) Ex-OR gate:

f) Ex-NOR gate:

Page 32: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Implementation of gates using NOR gates :

a) NOT gate:

b) AND gate:

c) OR gate:

d) NAND gate:

e) Ex-OR gate:

f) Ex-NOR gate:

Page 33: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Multilevel Implementation:

Multi-level NAND or NOR implementation of a Boolean circuit can be achieved by replacing each

gate in the circuit with the NAND or NOR equivalent circuits respectively. With this type of

implementation, very large propagation delay is achieved and only two input gates are required.

NAND Implementation:

By replacing each gate in the circuit with the NAND equivalent, multi level NAND circuit is

achieved. When two single input NAND gates (inverters) are in series, they can be removed.

NOR Implementation:

By replacing each gate in the circuit with the NOR equivalent, multi-level NOR circuit is achieved.

When two single input NOR gates (inverters) are in series, they can be removed.

Page 34: STLD - WordPress.com · hand, digital systems are those in which physical quantities are represented in digital form; that is, the quantities can take on only discrete values. Any

Vignana Bharathi Institute of Technology UNIT 1 STLD

potharajuvidyasagar.wordpress.com P VIDYA SAGAR

Simplification using Boolean Laws & Theorems:

The Boolean functions can be simplified by using appropriate Boolean laws and theorems.

Examples: Simplify the following functions using Boolean laws and theorems: