DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

Similar documents
CHW 261: Logic Design

Module 2: Computer Arithmetic

Number representations

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

COMP Overview of Tutorial #2

BINARY SYSTEM. Binary system is used in digital systems because it is:

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems CHAPTER Positional Number Systems

D I G I T A L C I R C U I T S E E

Level ISA3: Information Representation

Number System. Introduction. Decimal Numbers

Digital Fundamentals

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

Chapter 2: Number Systems

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Internal Data Representation

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

COMPUTER ARITHMETIC (Part 1)

CS & IT Conversions. Magnitude 10,000 1,

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

MACHINE LEVEL REPRESENTATION OF DATA

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

Number Systems. Both numbers are positive

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0

Chapter 3 Data Representation

Chapter 1 Review of Number Systems

Numbering systems. Dr Abu Arqoub

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

CHAPTER 5: Representing Numerical Data

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Signed Binary Numbers

Number Systems Base r

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Divide: Paper & Pencil

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

NUMBER SYSTEMS AND CODES

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal


CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Chapter 5 : Computer Arithmetic

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

Number Systems and Computer Arithmetic

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Lecture 8: Addition, Multiplication & Division

Arithmetic Processing

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.

Introduction to Numbering Systems

MC1601 Computer Organization

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Final Labs and Tutors

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

Computer Organization

Computer Arithmetic. In this article we look at the way in which numbers are represented in binary form and manipulated in a computer.

Chapter 5: Computer Arithmetic

Bits, Words, and Integers

TOPIC: NUMBER SYSTEMS

Chapter 4 Section 2 Operations on Decimals

carry in carry 1101 carry carry

UNIT-III COMPUTER ARTHIMETIC

CS 101: Computer Programming and Utilization

Number Systems and Their Representations

CO212 Lecture 10: Arithmetic & Logical Unit

Chapter 2. Data Representation in Computer Systems

Digital Fundamentals

Number Systems MA1S1. Tristan McLoughlin. November 27, 2013

Chapter 10 - Computer Arithmetic

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

Computer Arithmetic. Appendix A Fall 2003 Lec.03-58

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Microcomputers. Outline. Number Systems and Digital Logic Review

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION

Signed umbers. Sign/Magnitude otation

Octal and Hexadecimal Integers

Digital Logic Circuits Volume I Digital Number Systems

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

COMP2611: Computer Organization. Data Representation

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

THE LOGIC OF COMPOUND STATEMENTS

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

Chapter 4. Operations on Data

Positional Number System

Review of Data Representation & Binary Operations Dhananjai M. Rao CSA Department Miami University

Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION. Data Representation in Computer Systems

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah

Computer Architecture and Organization

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

DIGITAL SYSTEM DESIGN

Transcription:

UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error detecting and correcting codes, digital logic gates(and, NAND,OR,NOR, Ex-OR, Ex-NOR), Boolean algebra, basic theorems and properties, Boolean functions, canonical and standard forms. DLD VIDYA SAGAR P

Number Systems : 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 Hexadecimal base 16 Octal base 8 Binary base 2 The base determines the range of a digit in the number system which starts with 0 and ends with base-1 For bases with range exceeding 10, the A-Z alpha symbols are used to represent values greater than 9 Examples Base 10 digit range is 0 9 Base 5 digit range is 0-4 Base 16 digit range is 0 9 and A F Computers internally stores and process data using the binary system Binary is compatible with the computer hardware architecture which is based on Boolean digital logic Binary is base 2 with a digit range of 0-1 A binary digit is also known as bit Most computers use the hexadecimal or the octal number systems in programming and debugging Hexadecimal is also known as hex Hex is base 16 with a digit range of 0 9, A F Octal is base 8 with a digit range of 0 7 Advantages Both number systems can be used as a short hand notation for binary More readable than binary and hence easier for humans to work with Easy to convert into and from binary Humans on the other hand, work with the decimal system, Conversion between binary and decimal is necessary to make human to machine interaction possible, Conversion between the different number systems is also possible, Conversion does not change the magnitude of the number

Counting in Different Bases : Counting is the process of repeatedly adding 1 to the number Going through a complete digit range, exhausting all possible combinations Shift to the left one place Repeat as necessary until the number is completely represented Theoretically, the counting process can continue indefinitely, However, there is always a limit on the available digits to store a number (storage size),therefore, counting process will stop when all the available digits are exhausted, Overflow will occur when storage size limit is exceeded The following table shows a count in hexadecimal, decimal, octal, and binary Hexadecimal Decimal Octal Binary 0 0 0 0 1 1 1 1 2 2 2 10 3 3 3 11 4 4 4 100 5 5 5 101 6 6 6 110 7 7 7 111 8 8 10 1000 9 9 11 1001 A 10 12 1010 B 11 13 1011 C 12 14 1100 D 13 15 1101 E 14 16 1110 F 15 17 1111 10 16 20 10000 Range Calculations : The range of a number that can be represented is determined by: Storage size number of digits Base of the number system used to represent the number Range can be computed as: (result in decimal) R = B n (R = Range, B = Base, n = number of digits)

Examples: 8 binary bits range 2 8 = 256 10 3 decimal digits range 10 3 = 1000 10 3 digits in hex range 16 3 = 4096 10 Binary range calculations is often required in computers Examples : Integer number data unit range with storage size of 16 bits = 2 16 = 65536 Memory addressing capability MAR size of 32 bits = 2 32 = 4GB Range can also be computed as the product of its sub-ranges 32 binary bits range 2 10 X 2 10 X 2 10 X 2 2 = 1K X 1K X 1K X 4 = 4G 12 binary bits range 2 10 X 2 2 = 1K X 4 = 4K Integer Digit Weight Calculations : A digit weight is computed as: (result is always in decimal) W = B n (W = Weight, B = base, n = digit position) Digit position numbering starts from the least significant digit and ends with the most significant digit Digit position starts at 0 and ends with the number of digits 1 Examples: 4-digit decimal weight calculation 10 3, 10 2, 10 1, 10 0 = 1000 10, 100 10, 10 10, 1 10 4-bit binary weight calculation 2 3, 2 2, 2 1, 2 0 = 8 10, 4 10, 2 10, 1 10 4-digit octal weight calculation 8 3, 8 2, 8 1, 8 0 = 512 10, 64 10, 8 10, 1 10 Note: that any base power 0 = 1 Each digit has n times the weight of its next rightmost neighbor (where n is the base) In binary each digit has twice the weight of its next right neighbor In decimal each digit has 10 times the weight of its next rightmost neighbor Convert between related bases : Two number systems are related when one number system base is an integral power of the other A single digit in the larger base requires n digits in the smaller base (where n is the power value) Octal is related to binary since it takes 3 binary digits to represent 1 octal digit (2 3 = 8) Hex is related to binary since it takes 4 binary digits to represent 1 hex digit (2 4 = 16) Hex and octal, however, are not related Conversion between related number systems is direct Use a trial and error method to determine if two bases are related Smaller base power 2, 3, 4, and so on If result = larger base, then the two bases are related If result exceed larger base, then the two bases are not related

Examples : 1. Are 2 and 16 related? 2 2 = 4 2 3 = 8 2 4 = 16 base 2 and 16 are related 2. Are 3 and 8 related? 3 2 = 9 base 3 and 8 are not related Smaller base to larger base conversion method : Determine the n value Construct a conversion table (i.e. counting table as seen above is an example of conversion table) Group the number into groups of n digits Must start grouping from the right (i.e. least significant digit) Pad with zeros if last group is less than n digits Group by group, perform direct conversion using the conversion table Examples : Convert 11010111011000 2 to hex 4 binary digits are required to represent a single hex digit (i.e. n = 4) Refer to the conversion table above Group the number into groups of 4 digits: 11 0101 1101 1000 Pad last group with zeros: 0011 0101 1101 1000 Convert each group to their equivalent hex digit = 35D8 16 Convert 11010111011000 2 to octal 3 binary digits are required to represent a single octal digit (i.e. n = 3) Refer to the conversion table above Group the number into groups of 3 digits: 11 010 111 011 000 Pad last group with zeros: 011 010 111 011 000 Convert each group to their equivalent octal digit = 32730 8 Convert 11010111011000 2 to base 4 2 binary digits are required to represent a single base 4 digit (i.e. n = 2) Construct a conversion table Base 4 Binary 0 00 1 01 2 10 3 11 Group the number into groups of 2 digits: 11 01 01 11 01 10 00 Convert each group to their equivalent hex digit = 3113120 16

Larger base to Smaller base conversion : Determine the n value Construct a conversion table (i.e. counting table as seen above) Digit by digit, perform direct conversion using the conversion table Notes: don t miss padding leading zeros to fill the n digits in the smaller base Examples Convert 35D8 16 to binary Each hex digit requires 4 binary digits (i.e. n = 4) Refer to the conversion table above Map each digit to its equivalent binary digits Convert 275331 8 to binary = 0011 0101 1101 1000 2 Each octal digit requires 3 binary digits (i.e. n = 3) Refer to the conversion table above Map each digit to its equivalent binary digits Convert 21223 4 to binary = 010 111 101 011 011 001 2 Each base 4 digit requires 2 binary digits (i.e. n = 2) Refer to the base 4 to binary conversion table above Map each digit to its equivalent binary digits = 10 01 10 10 11 2 Convert between non decimal and non related number systems : It is impractical to directly convert between none decimal number systems that are not related Decimal can be used as an intermediary conversion base As well, a base that is related to both bases can be used as an intermediary conversion base Binary can be used as an intermediate conversion base to convert between hex and octal Examples : Convert 35D8 16 to octal (note that the two bases are none decimal and are not related) Convert the number to binary = 0011010111011000 2 Convert the binary result to octal = 011 010 111 011 000 = 32730 2 Convert 2120 3 to base 5 (note that the two bases are none decimal and are not related) There is no intermediate base that is related to both bases so we use decimal as an intermediate base

Convert the number to decimal = 0 x 3 0 + 2 x 3 1 + 1 x 3 2 + 2 x 3 3 = 69 10 Convert the decimal result to base 5 = 234 5 Fraction conversion: = 234 5 Fraction number conversion does not always result in an accurate result due to: Representation of a fraction number that is possible in one base may be impossible to represent in another base If precise conversion cannot be done, conversion will result in lose of accuracy (i.e. lose of significant digits) Examples: 0.1 10 is impossible to represent in binary (0.0001100110011 ) 0.1 3 is impossible to represent in decimal (0.333333 ) When converting a number that contains both integer and fraction parts The two parts must be converted separately The fraction point must remain at its original location Number base conversions: Decimal to any base conversion Steps : Step 1 Divide the decimal number to be converted by the value of the new base. Step 2 Get the remainder from Step 1 as the rightmost digit (Least Significant Digit) of new base number. Step 3 Divide the quotient of the previous divide by the new base. Step 4 Record the remainder from Step 3 as the next digit (to the left) of the new base number. Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes zero in Step 3. The last remainder thus obtained will be the Most Significant Digit (MSD) of the new base number. Examples: Decimal to Binary: 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: 163.87510 binary 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=2 5 =1000002, Remainder is 35-32=3 The largest no., a power of 2, not exceeding 35is 2. 2=2 1 =102, Remainder is 3-2=1 1=2 0 = 12 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 0.5=2-1 =0.1002, Remainder is 0.875-.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. Here is an example of using double dabble method to convert 1792 decimal to binary: Decimal NumberOperationQuotientRemainderBinary Result 1792 2 = 896 0 0 896 2 = 448 0 00 448 2 = 224 0 000 224 2 = 112 0 0000 112 2 = 56 0 00000 56 2 = 28 0 000000 28 2 = 14 0 0000000 14 2 = 7 0 00000000 7 2 = 3 1 100000000 3 2 = 1 1 1100000000 1 2 = 0 1 11100000000 0 done.

Decimal to Octal Here is an example of using repeated division to convert 1792 decimal to octal: Decimal NumberOperationQuotientRemainderOctal Result 1792 8 = 224 0 0 224 8 = 28 0 00 28 8 = 3 4 400 3 8 = 0 3 3400 0 done. Decimal to Hexadecimal Here is an example of using repeated division to convert 1792 decimal to hexadecimal: Decimal Number Operation Quotient Remainder Hexadecimal Result 1792 16 = 112 0 0 112 16 = 7 0 00 7 16 = 0 7 700 0 done. The only addition to the algorithm when converting from decimal to hexadecimal is that a table must be used to obtain the hexadecimal digit if the remainder is greater than decimal 9. Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A B C D E F The addition of letters can make for funny hexadecimal values. For example, 48879 decimal converted to hex is: Decimal Number Operation Quotient Remainder Hexadecimal Result 48879 16 = 3054 15 F 3054 16 = 190 14 EF 190 16 = 11 14 EEF 11 16 = 0 11 BEEF 0 done. MORE EXAMPLES: Convert 6124 10 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 = 143444 5

Convert 8151 10 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 = 1FD7 16 Convert 64 10 to binary New Base From Base Number Remainder 2 64 0 least significant digit 2 32 0 2 16 0 2 8 0 2 4 0 2 2 0 2 1 1 most significant digit 0 = 1000000 2 Binary to any base conversion Steps: Binary to Decimal: A method to convert from binary to decimal. This method involves addition and multiplication. 1. Start the decimal result at 0. 2. Remove the most significant binary digit (leftmost) and add it to the result. 3. If all binary digits have been removed, you re done. Stop. 4. Otherwise, multiply the result by 2. 5. Go to step 2. Here is an example of converting 11100000000 binary to decimal: Binary Digits Operation Decimal Result Operation Decimal Result 11100000000 +1 1 2 2 1100000000 +1 3 2 6 100000000 +1 7 2 14 00000000 +0 14 2 28 0000000 +0 28 2 56 000000 +0 56 2 112 00000 +0 112 2 224 0000 +0 224 2 448 000 +0 448 2 896 00 +0 896 2 1792 0 +0 1792 Done.

Binary to Octal: An easy way to convert from binary to octal is to group binary digits into sets of three, starting with the least significant (rightmost) digits. Binary: 11100101 = 11 100 101 011 100 101 Then, look up each group in a table: Pad the most significant digits with zeros if necessary to complete a group of three. Binary: 000 001 010 011 100 101 110 111 Octal: 0 1 2 3 4 5 6 7 Binary = 011 100 101 Octal = 3 4 5 = 345 oct Binary to Hexadecimal: An equally easy way to convert from binary to hexadecimal is to group binary digits into sets of four, starting with the least significant (rightmost) digits. Binary: 0000 0001 0010 0011 0100 0101 0110 0111 Hexadecimal: 0 1 2 3 4 5 6 7 Binary: 1000 1001 1010 1011 1100 1101 1110 1111 Hexadecimal: 8 9 A B C D E F Binary: 11100101 = 1110 0101 Then, look up each group in a table: Binary = 1110 0101 Hexadecimal = E 5 = E5 hex Octal to any base conversion Steps: Octal to Binary: Converting from octal to binary is as easy as converting from binary to octal. Simply look up each octal digit to obtain the equivalent group of three binary digits. Octal: 0 1 2 3 4 5 6 7 Binary: 000 001 010 011 100 101 110 111 Octal = 3 4 5 Binary = 011 100 101 = 011100101 binary Octal to Hexadecimal : When converting from octal to hexadecimal, it is often easier to first convert the octal number into binary and then from binary into hexadecimal. For example, to convert 345 octal into hex: (from the previous example) Octal = 3 4 5 Binary = 011 100 101 = 011100101 binary

Drop any leading zeros or pad with leading zeros to get groups of four binary digits (bits): Binary 011100101 = 1110 0101 Then, look up the groups in a table to convert to hexadecimal digits. Binary: 0000 0001 0010 0011 0100 0101 0110 0111 Hexadecimal: 0 1 2 3 4 5 6 7 Binary: 1000 1001 1010 1011 1100 1101 1110 1111 Hexadecimal: 8 9 A B C D E F Binary = 1110 0101 Hexadecimal = E 5 = E5 hex Therefore, through a two-step conversion process, octal 345 equals binary 011100101 equals hexadecimal E5. Octal to Decimal : Converting octal to decimal can be done with repeated division. 1. Start the decimal result at 0. 2. Remove the most significant octal digit (leftmost) and add it to the result. 3. If all octal digits have been removed, you re done. Stop. 4. Otherwise, multiply the result by 8. 5. Go to step 2. Octal Digits Operation Decimal Result Operation Decimal Result 345 +3 3 8 24 45 +4 28 8 224 5 +5 229 Done. The conversion can also be performed in the conventional mathematical way, by showing each digit place as an increasing power of 8. 345 octal = (3 * 8 2 ) + (4 * 8 1 ) + (5 * 8 0 ) = (3 * 64) + (4 * 8) + (5 * 1) = 229 decimal. Hexadecimal to any base conversion Steps: Hexadecimal to Binary : Converting from hexadecimal to binary is as easy as converting from binary to hexadecimal. Simply look up each hexadecimal digit to obtain the equivalent group of four binary digits. Hexadecimal: 0 1 2 3 4 5 6 7 Binary: 0000 0001 0010 0011 0100 0101 0110 0111 Hexadecimal: 8 9 A B C D E F Binary: 1000 1001 1010 1011 1100 1101 1110 1111 Hexadecimal = A 2 D E Binary = 1010 0010 1101 1110 = 1010001011011110 binary

Hexadecimal to Octal : When converting from hexadecimal to octal, it is often easier to first convert the hexadecimal number into binary and then from binary into octal. For example, to convert A2DE hex into octal: (from the previous example) Hexadecimal = A 2 D E Binary = 1010 0010 1101 1110 = 1010001011011110 binary Add leading zeros or remove leading zeros to group into sets of three binary digits. Binary: 1010001011011110 = 001 010 001 011 011 110 Then, look up each group in a table: Binary: 000 001 010 011 100 101 110 111 Octal: 0 1 2 3 4 5 6 7 Binary = 001 010 001 011 011 110 Octal = 1 2 1 3 3 6 = 121336 octal Therefore, through a two-step conversion process, hexadecimal A2DE equals binary 1010001011011110 equals octal 121336. Hexadecimal to Decimal : Converting hexadecimal to decimal can be performed in the conventional mathematical way, by showing each digit place as an increasing power of 16. Of course, hexadecimal letter values need to be converted to decimal values before performing the math. Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A B C D E F Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A2DE hexadecimal: = ((A) * 16 3 ) + (2 * 16 2 ) + ((D) * 16 1 ) + ((E) * 16 0 ) = (10 * 16 3 ) + (2 * 16 2 ) + (13 * 16 1 ) + (14 * 16 0 ) = (10 * 4096) + (2 * 256) + (13 * 16) + (14 * 1) = 40960 + 512 + 208 + 14 = 41694 decimal Signed Number Representation: In general, we represent the positive (unsigned) numbers without any sign indication and negative numbers with minus (negative sign) sign before them. But these are not applicable for computing in the digital systems like, computers, as the data is represented in binary number system. So to represent the sign a special notation is required. Positive Signed binary numbers The binary numbers having their MSB 0 are called Positive signed binary numbers.

Negative Signed binary numbers The binary numbers having their MSB 1 are called Negative signed binary numbers. Unsigned numbers can have a wide range of representation. But whereas, in case of signed numbers, we can represent their range only from (2 (n-1) 1) to + (2 (n-1) 1). Where n is the number of bits (including sign bit). Ex: For a 5 bit signed binary number (including 4 magnitude bits & 1 sign bit), the range will be (2 (5-1) 1) to + (2 (5-1) 1) -(2 (4) 1 ) to + (2 (4) 1) -15 to +15 Unsigned 8- bit binary numbers will have range from 0-255. The 8 bit signed binary number will have maximum and minimum values as shown below. The maximum positive number is 0111 1111 +127 The maximum negative number is 1000 0000-127 There are 2 different methods used to represent signed integer in computers Sign-and-magnitude representation Complementary representation Sign-and-magnitude Representation 8-bit sign-magnitude format Sign Magnitude 7 6-0 The sign is represented followed by the number magnitude A sign bit, typically the leftmost bit, (0 for +, 1 for -) is used to represent the sign The positive range is one-half of the range and the negative range is makes up the second half Example: 16-bit (1 bit sign and 15 bit magnitude) have a positive range of: +0 to +32767 and negative range of and -0 to 32767 Note that the total range is the same but redistributed between the positive side and the negative side Disadvantage There are 2 different values for the zero (i.e. +0 and 0) The system must test at the end of every calculation to ensure the presence of a single 0,Calculations is very complex and difficult to implement in hardware (i.e. no consistent way of performing the calculations)

Complementary Representation: Complementary representation is the prevalent method for representing signed integer in computers. Every number system has 2 forms of complementary representations Base (R-1) s complement Base R s complement 2 forms of binary complementary representation 1 s complement 2 s complement 2 forms of decimal complementary representation 9 s complement 10 s complement 2 forms of hex complementary representation 15 s complement 16 s complement 2 forms of octal complementary representation 7 s complement 8 s complement

Advantage Provide sign free representation The sign of the number does not need special handling Calculations is simple and consistent for all different signed combination of numbers For simplicity let s first start by studying the decimal complementary representation: 9 s complement 10 s complement 9 s Complement Representation 9 s complement is the decimal counter part of the binary 1 s complement Positive range matches the sign-and-magnitude representation positive range Negative range is different than the sign-and-magnitude representation negative range The sign of a number is determined by checking the most significant digit Positive when most significant digit values 0-4 Negative when most significant digit values 5-9 Convert from sign-and-magnitude to 9 s complement Must specify the number of 9 s complement storage digits available to represent the number If number is positive no conversion is necessary (i.e. same as sign-and-magnitude representation) Pad the number with 0 s, if needed, to represent all the assigned number of storage digits If number is negative conversion is required (complement the number) Complementary base number The complementary base is the highest value in the number supported by the given number of digits Complementary base for: 3 digits = 999 5 digits = 99999 Examples 1. Represent 467 in 3-digit 9 s complement The number is negative so complement the number = 999 467 = 532 2. Represent 467 in 4-digit 9 s complement The number is negative so complement the number = 9999 467 = 9532 3. Represent 467 in 3-digit 9 s complement The number is positive so the 9 s complement is the same as the number = 467 4. Represent 667 in 4-digit 9 s complement The number is positive so the 9 s complement is the same as the number Need to pad with zero to fill the entire storage space = 0667 5. Represent 667 in 3-digit 9 s complement The number cannot be represented with only 3-digits (overflow occur) Maximum positive number the can be represent is 499

Convert from 9 s complement to sign-and-magnitude Determine whether the number is positive or negative (inspect the most significant digit) If the number is positive, the sign-and-magnitude equivalent is the same as the 9 s complement If the number is negative, complement the number Complementary base number Add the negative sign Examples 1. Convert 9990 to sign-and-magnitude representation The number is negative (most significant digit is 9) Complement the number: 9999 9990 = 9 Add negative sign -9 2. Convert 595 to sign-and-magnitude representation The number is negative (most significant digit is 5) Complement the number: 999 595 = 404 Add negative sign = -404 3. Convert 4990 to sign-and-magnitude representation The number is positive (most significant digit is 4) The result is the same as the 9 s complement = 4990 Addition and Subtraction Arithmetic (9 s complement) Addition in 9 s complement is done using the following method: Add the 2 numbers in the normal way Add 1 to the result if there is end-round carry An end-round carry occur if the result overflow the storage space Subtraction in 9 s complement is done using the following method: Complement any number with negative sign (i.e. eliminate the negative sign) Add the two numbers using the same method as the Addition in 9 s Complement Examples : Add (799 + 100) o 799 + 100 = 899 Add (799 + 300) o 799 + 300 =(1)099 o Add end-round carry = 1 + 099 = 100 Add (0799 + 0300) o 0799 + 0300 = 1099

Subtract (799 100) o Find 9 s complement of 100 = 999 100 = 899 o Add 799 + 899 = (1) 698 o Add the end-round carry = 1 + 698 = 699 Subtract (106 090) o Find 9 s complement of 90 = 999 90 = 909 o Add 106 + 909 = (1)015 o Add end-round carry = 1 + 015 = 016 Subtract (0106 0090) o Find 9 s complement of 90 = 9999 90 = 9909 o Add 0106 + 9909 = (1) 0015 o Add end-round carry = 1 + 0015 = 0016 Subtract (-40-2) o Find 9 s complement of 40 = 99 40 = 59 o Find 9 s complement of 2 = 99 2 = 97 o Add 59 + 97 = (1) 56 o Add end-round carry = 1 + 56 = 57 10 s Complement Representation The 10 s complement solves the dual zero problem in 9 s complement See Figure 4.11 in page 110 for 10 s complement representation of 3-digit decimal number 10 s complement = 9 s complement + 1 Convert from sign-and-magnitude to 10 s complement Similar to 9 s complement with the following differences Complementary base is 1 more than the 9 s complement (i.e. 9 s complement + 1) Examples Represent 467 in 3-digit 10 s complement The number is negative so complement the number = 1000 467 = 533 Represent 467 in 4-digit 10 s complement The number is negative so complement the number = 10000 467 = 9533 Represent 467 in 3-digit 10 s complement The number is positive so the 10 s complement is the same as the number = 467 Represent 667 in 4-digit 10 s complement The number is positive so the 10 s complement is the same as the number = 0667 Represent 667 in 3-digit 10 s complement The number cannot be represented with only 3-digits (overflow)

Convert 10 s complement to sign-and-magnitude Similar to 9 s complement with the following differences Complementary base is 1 more than the 9 s complement (i.e. 9 s complement + 1) Examples 1. Convert 9990 to sign-and-magnitude representation The number is negative (most significant digit is 9) Find 10 s complement = 10000 9990 = 10 Add negative sign = -10 Convert 595 to sign-and-magnitude representation The number is negative (most significant digit is 5) Complement the number: 1000 595 = 405 Add negative sign = -405 2. Convert 4990 to sign-and-magnitude representation o The number is positive (most significant digit is 4) o The result is the same as the 10 s complement = 4990 Addition and Subtraction Arithmetic (10 s complement) Addition in 10 s complement is done using the following method: Add the two numbers Carry beyond the specified number of digits is dropped Subtraction in 10 s complement is done using the following method: Find the 10 s complement of any number with negative sign (i.e. eliminate the negative sign) Add using the same method as the Addition in 10 s Complement Examples 1. Add (799 + 100) o 799 + 100 = 899 2. Add (799 + 300) o 799 + 300 = (1)099 o Drop the end-round carry = 099 3. Add (0799 + 0300) o 0799 + 0300 = 1099 4. Subtract (799 100) o Find the 10 s complement of 100 = 1000 100 = 900 o Add 799 + 900 = (1) 699 o Drop the end-round carry = 699 5. Subtract (106 090) o Find the 10 s complement of 90 = 1000 90 = 910 o Add 106 + 910 = (1) 016; Drop the end-round carry = 016

6. Subtract (0106 0090) o Find the 10 s complement of 0090 = 10000 90 = 9910 o Add 0106 + 9910 = (1) 0016 o Drop the end-round carry = 0016 1 s Complement Representation 1 s complement is a complementary representation method for representing signed integer in binary 1 s complement is the counter part of 9 s complement in decimal See Figure 4.10 for illustration of 8-bit 1 s complement representation The sign of a number is determined by checking the most significant bit Positive when most significant bit is 0 Negative when most significant bit is 1 1 s complement is performed by inverting every bit (0 becomes 1 and 1 becomes 0) Find 1 s complement Pad the number with 0 s if needed to represent all the assigned number of storage bits Invert the bits Examples Find the 8-bit 1 s of the binary number 00101101 Invert to find the 1 s complement = 11010010 Find the 16-bit 1 s of the binary number 00101101 Pad with 0 s to get 16-bit representation = 0000000000101101 Invert to find the 1 s complement = 1111111111010010 Convert from decimal sign-and-magnitude to 1 s complement Convert the decimal number to binary Pad with zeros to fill the entire storage space Determine whether the number is positive or negative If the number is positive, no need to complement the number If the number is negative, you need to complement the number Examples Convert 45 10 to 8-bit 1 s complement Convert from decimal to binary = 101101 Pad with 0 s to get 8-bit representation = 00101101 The number is negative (the sign is -) so invert the bits = 11010010

Convert 45 10 to 16-bit 1 s complement Convert from decimal to binary = 101101 Pad with 0 s to get 16-bit representation = 0000000000101101 The number is positive so no need to complement = 0000000000101101 Convert -25 10 to 16-bit 1 s complement Convert from decimal to binary = 11001 Pad with 0 s to get 16-bit representation = 0000000000011001 The number is negative so invert the bits = 1111111111100110 Convert from 1 s complement to decimal sign-and-magnitude Determine whether the number is positive or negative If the number is positive, no need to complement the number If the number is negative, you need to complement the number Convert to decimal Add the negative sign if the number is negative Examples Convert 00101101 to decimal sign-and-magnitude The number is positive (most significant bit is 0), no need to complement Convert to decimal = 45 = 45 Convert 11010010 to decimal sign-and-magnitude The number is negative (most significant bit is 1), then first find the complement of the number Find 1 s complement = 00101101 Convert to decimal = 45 Add the negative sign = -45 Convert 1111111111100110 to decimal sign-and-magnitude The number is negative (most significant bit is 1), then first find the complement of the number Find 1 s complement = 0000000000011001 Convert to decimal = 25 Add the negative sign = -25 Addition and Subtraction Arithmetic (1 s complement) Addition in 1 s complement is done using the following method Add the two numbers If there is an end-round carry, add the carry to the result Subtraction in 1 s complement is done using the following method

Find 1 s complement of the number with negative sign in front (i.e. eliminate negative sign) Adding the two numbers Examples 1. Add (00101101 + 00111010) (i.e. 45 + 58 = 103) 00101101 + 00111010 = 01100111 = 103 in decimal 2. Add (01101010 + 11111101) (i.e. 106-2 = 104) 01101010 + 11111101 = (1) 01100111 Add end-carry to the result = 1 + 01100111 = 01101000 = 104 in decimal 3. Subtract (00101101-00111010) (i.e. 45-58 = -13) Find 1 s complement of the second number = 11000101 Add the 2 numbers = 00101101 + 11000101 = 11110010 = 11110010 = -13 in decimal 4. Subtract (01101010 11111101) (i.e. 106 - -2 = 106 + 2 = 108) Find 1 s complement of the second number = 00000010 Add the 2 numbers = 01101010 + 00000010 = 01101100 = 01101100 = 108 in decimal 2 s Complement Representation The 2 s complement is an alternative complementary representation for signed integers See Figure 4.1 for 2 s complement representation of 8-bit number 2 s complement = 1 s complement + 1 2 s complement solves the dual zero problem (i.e. 0 and +0) found in 1 s complement The 0 is eliminated and the negative scale is shifted to the right by 1 (i.e. add 1) 2 s complement is more common than 1 s complement in computers Advantages Addition arithmetic is faster as it does not require an extra end-round carry step 2 s complement solves the dual zero Disadvantages Finding complement requires one extra step (i.e. adding 1 after inversion) Convert from decimal sign-and-magnitude to 2 s complement Similar to 1 s complement with the following differences: Complement number = invert bits + 1 Examples Convert 45 10 to 8-bit 2 s complement The number is negative (the sign is -) Convert from decimal to binary = 101101

Pad with 0 s to get 8-bit representation = 00101101 Invert the bits = 11010010 Add 1 = 11010011 Convert 45 10 to 16-bit 2 s complement The number is positive Convert from decimal to binary = 101101 Pad with 0 s to get 16-bit representation = 0000000000101101 = 0000000000101101 Convert -25 10 to 16-bit 1 s complement The number is negative (the sign is -) Convert from decimal to binary = 11001 Pad with 0 s to get 16-bit representation = 0000000000011001 Invert the bits = 1111111111100110 Add 1 = 1111111111100111 Convert from 2 s complement to decimal sign-and-magnitude Similar to 1 s complement with the following differences: Examples Complement number = invert bits + 1 Convert 00101101 to decimal sign-and-magnitude The number is positive (most significant bit is 0), no need to complement Convert to decimal = 45 Convert 11010010 to decimal sign-and-magnitude The number is negative (most significant bit is 1), then first find the complement of the number Find 2 s complement = 00101101 + 1 = 00101110 Convert to decimal = 46 Since the number is negative, add the negative sign = -46 Convert 1111111111100110 to decimal sign-and-magnitude The number is negative (most significant bit is 1), then first find the complement of the number Find 2 s complement = 0000000000011001 + 1 = 0000000000011010 Convert to decimal = 26 Since the number is negative, add the negative sign = -26 Addition and Subtraction Arithmetic (2 s complement) Addition in 2 s complement is similar to 1 s complement with the following differences: The end-carry is dropped rather than added to the result Subtraction in 2 s complement is similar to 1 s complement with the exception

2 s complement is found for numbers with negative sign instead of 1 s complement Examples 1. Add (01101010 + 11111101) (i.e. 106-3 = 103) 01101010 + 11111101 = (1) 01100111 Drop the end carry = 01100111 = 103 in decimal 2. Add (00101101 + 00111010) (i.e. 45 + 58 = 103) 00101101 + 00111010 = 01100111 = 103 in decimal 3. Subtract (01101010-11111101) (i.e. 106 - -3 = 106 + 3 = 109) Complement the second number to eliminate the negative sign = 00000010 + 1 = 00000011 01101010 + 00000011 = 01101101 = 109 in decimal 4. Subtract (00101101-00111010) (i.e. 45-58 = -13) Complement the second number to eliminate the negative sign = 11000101 + 1 = 11000110 00101101 + 11000110 = 11110011 = -13 in decimal Overflow and Carry Conditions Typically, an overflow occur when the result of calculation does not fit into the storage space In 2 s complement an addition or subtraction overflow occur when the result overflows into the sign bit An overflow can be detected when the sign of the result is an opposite of the sign of both numbers In computers, an overflow flag is used to test for an overflow (flag is set/reset at every calculation) In 2 s complement an addition or subtraction carry occur when the result exceeds the storage space A carry flag is used to test for carry (flag is set/reset at every calculation) Overflow and carry can occur independent of each other 4 possible outcomes as a result of addition or subtraction No overflow and No carry No overflow and carry Overflow and no carry Overflow and carry Overflow produces an incorrect result Carry still produces a correct result

Examples (addition of two 4-bit 2 s complement numbers) 0100 + 0010 = 0110 0100 + 0110 = 1010 (4+2 = 6) no overflow and no carry (result is correct) (4+6 = -6) overflow and no carry (result is incorrect) 1100 + 1110 = (1) 1010 (-4-2 = -6) no overflow and carry (result is correct) 1100 + 1010 = (1) 0110 (-4-6 = 6) overflow and carry (result is incorrect) Binary Arithmetic: Addition Adding unsigned numbers Adding unsigned numbers in binary is quite easy. Recall that with 4 bit numbers we can represent numbers from 0 to 15. Addition is done exactly like adding decimal numbers, except that you have only two digits (0 and 1). The only number facts to remember are that 0+0 = 0, with no carry, 1+0 = 1, with no carry, 0+1 = 1, with no carry, 1+1 = 0, and you carry a 1. so to add the numbers 06 10=0110 2 and 07 10=0111 2 (answer=13 10=1101 2) we can write out the calculation (the results of any carry is shown along the top row, in italics). Decimal 1 (carry) 06 +07 13 Unsigned Binary 110 (carry) 0110 +0111 1101 The only difficulty adding unsigned numbers occurs when you add numbers that are too large. Consider 13+5. Decimal 0 (carry) 13 +05 18 Unsigned Binary 1101 (carry) 1101 +0101 10010 The result is a 5 bit number. So the carry bit from adding the two most significant bits represents a results that overflows (because the sum is too big to be represented with the same number of bits as the two addends). Adding signed numbers Adding signed numbers is not significantly different from adding unsigned numbers. Recall that signed 4 bit numbers (2's complement) can represent numbers between -8 and 7. To see how this addition works, consider three examples. Decimal -2 +3 1 Signed Binary 1110 (carry) 1110 +0011 0001 Decimal Signed Binary

-5 +3-2 011 (carry) 1011 +0011 1110 Decimal -4-3 -7 Signed Binary 1100 (carry) 1100 +1101 1001 In this case the extra carry from the most significant bit has no meaning. With signed numbers there are two ways to get an overflow -- if the result is greater than 7, or less than -8. Let's consider these occurrences now. Decimal 6 +3 9 Decimal -7-3 -10 Signed Binary 110 (carry) 0110 +0011 1001 Signed Binary 1001 (carry) 1001 +1101 0110 Obviously both of these results are incorrect, but in this case overflow is harder to detect. But you can see that if two numbers with the same sign (either positive or negative) are added and the result has the opposite sign, an overflow has occurred. Adding fractions There is no further difficult in adding two signed fractions, only the interpretation of the results differs. For instance consider addition of two Q3 numbers shown (compare to the example with two 4 bit signed numbers, above). Decimal Fractional Binary -0.25 +0.375 0.125 1110 (carry) 1110 +0011 0001 Decimal Fractional Binary -0.625 +0.375-0.25 011 (carry) 1011 +0011 1110 Decimal Fractional Binary -0.5-0.375-0.875 1100 (carry) 1100 +1101 1001

If you look carefully at these examples, you'll see that the binary representation and calculations are the same as before, only the decimal representation has changed. This is very useful because it means we can use the same circuitry for addition, regardless of the interpretation of the results. Even the generation of overflows resulting in error conditions remains unchanged (again compare with above) Decimal Fractional Binary 0.75 +0.375 1.125 110 (carry) 0110 +0011 1001 Decimal Fractional Binary -0.875-0.375-1.25 1001 (carry) 1001 +1101 0110 Multiplication Multiplying unsigned numbers Multiplying unsigned numbers in binary is quite easy. Recall that with 4 bit numbers we can represent numbers from 0 to 15. Multiplication can be performed done exactly as with decimal numbers, except that you have only two digits (0 and 1). The only number facts to remember are that 0*1=0, and 1*1=1 (this is the same as a logical "and"). Multiplication is different than addition in that multiplication of an n bit number by an m bit number results in an n+m bit number. Let's take a look at an example where n=m=4 and the result is 8 bits Decimal Binary Decimal Binary 10 x6 60 1010 x0110 0000 1010 1010 +0000 0111100 13 x14 182 1101 x1110 0000 1101 1101 +1101 10110110 In this case the result was 7 bit, which can be extended to 8 bits by adding a 0 at the left. When multiplying larger numbers, the result will be 8 bits, with the leftmost set to 1, as shown. As long as there are n+m bits for the result, there is no chance of overflow. For 2 four bit multiplicands, the largest possible product is 15*15=225, which can be represented in 8 bits. Multiplying signed numbers There are many methods to multiply 2's complement numbers. The easiest is to simply find the magnitude of the two multiplicands, multiply these together, and then use the original sign bits to determine the sign of the result. If the multiplicands had the same sign, the result must be positive, if they had different signs, the result is negative. Multiplication by zero is a special case (the result is always zero, with no sign bit).

Multiplying fractions As you might expect, the multiplication of fractions can be done in the same way as the multiplication of signed numbers. The magnitudes of the two multiplicands are multiplied, and the sign of the result is determined by the signs of the two multiplicands. There are a couple of complications involved in using fractions. Although it is almost impossible to get an overflow (since the multiplicands and results usually have magnitude less than one), it is possible to get an overflow by multiplying -1x-1 since the result of this is +1, which cannot be represented by fixed point numbers. The other difficulty is that multiplying two Q3 numbers, obviously results in a Q6 number, but we have 8 bits in our result (since we are multiplying two 4 bit numbers). This means that we end up with two bits to the left of the decimal point. These are sign extended, so that for positive numbers they are both zero, and for negative numbers they are both one. Consider the case of multiplying -1/2 by -1/2 (using the method from the textbook): Decimal Fractional Binary -0.5 x0.5-0.25 1100 x0100 0000 0000 +111100 11110000 This obviously presents a difficulty if we wanted to store the number in a Q3 result, because if we took just the 4 leftmost bits, we would end up with two sign bits. So what we'd like to do is shift the number to the left by one and then take the 4 leftmost bit. This leaves us with 1110 which is equal to -1/4, as expected. Binary Subtraction For binary subtraction, there are four facts instead of one hundred: 0 0 = 0 1 0 = 1 1 1 = 0 10 1 = 1 The first three are the same as in decimal. The fourth fact is the only new one; it is the borrow case. It applies when the top digit in a column is 0 and the bottom digit is 1. (Remember: in binary, 10 is pronounced one-zero or two. ) Example Subtraction: Now let s subtract 1011.11 from 10101.101, following the same algorithm used for decimal numbers: Steps of Binary Subtraction Step 1: 1 0 = 1. Step 2: Borrow to make 10 1 = 1. Step 3: Borrow to make 10 1 = 1.

Step 4: Cascaded borrow to make 10 1 = 1. Step 5: 1 1 = 0. Step 6: 0 0 = 0. Step 7: Borrow to make 10 1 = 1. Binary Division Binary division is similar to decimal division. It is called as the long division procedure. Example Division Let s return to the example of the introduction, 1011.11/11. Here it is broken down into steps, following the same algorithm I used for decimal numbers:

Steps of Binary Division Step 0 Does 11 go into 1? No, because it s greater than 1. Does 11 go into 10? No, because it s greater than 10. Does 11 go into 101? Yes, because it s less than or equal to 101. (Remember, these are binary numerals; pronounce them one-one, one-zero, onezero-one, etc.) Step 1 1. Divide: Does 11 go into 101? (Yes, we already know that from step 0.) How many times does it go in? One time. There is no guessing. It s easy to see 11 is less than 101, so we know it goes in. And if it goes in, it goes in only once. 2. Multiply: 1 x 11 = 11. (Remember how simple it is to multiply a binary number by a single digit just copy the number down if that single digit is 1, or write down 0 if that single digit is 0.) 3. Subtract: 101 11 = 10. 4. Bring down: Bring down the 1 to make 101. Step 2 1. Divide: Does 11 go into 101? Yes, 1 time. 2. Multiply: 1 x 11 = 11. 3. Subtract: 101 11 = 10. 4. Bring down: Bring down the 1 to make 101. Step 3 1. Divide: Does 11 go into 101? Yes, 1 time. 2. Multiply: 1 x 11 = 11. 3. Subtract: 101 11 = 10. 4. Bring down: Bring down the 1 to make 101. Step 4 1. Divide: Does 11 go into 101? Yes, 1 time. 2. Multiply: 1 x 11 = 11. 3. Subtract: 101 11 = 10. 4. Bring down: Bring down the 0 to make 100. Step 5 1. Divide: Does 11 go into 100? Yes, 1 time. 2. Multiply: 1 x 11 = 11. 3. Subtract: 100 11 = 1. 4. Bring down: Bring down the 0 to make 10. Step 6 1. Divide: Does 11 go into 10? No (write down a 0). 2. Multiply: (We don t need to record this step; we re just going to get 0.) 3. Subtract: (We don t need to record this step; we re just going to get 10.) 4. Bring down: Bring down the 0 to make 100. Step 7 We stop here, recognizing that we divided 100 by 11 two steps ago. This means we have a two-digit cycle (10) from here on out. The quotient is 11.1110.

Octal Addition Following octal addition table will help you to handle octal addition. To use this table, simply follow the directions used in this example: Add 6 8 and 5 8. Locate 6 in the A column then locate the 5 in the B column. The point in 'sum' area where these two columns intersect is the 'sum' of two numbers. 6 8 + 5 8 = 13 8.

Example Addition Addition, Subtraction, Multiplication, Division of two Octal numbers 1. Find addition of (321)8 and (47)8 1 3 2 1 + 0 4 7 3 7 0 3. Find multiplication of (321)8 and (47)8 321 47 15040 2667 17727 2. Find Subtraction of (321)8 and (47)8 9 2 1 9 3 2 1-0 4 7 2 5 2 4. Find division of (321)8 and (7)8 3 5 7 3 2 1 2 5 5 1 4 3 6 Here, Divisor = 7 Dividend = 321 Quotient = 35 Remainder = 6

Octal Subtraction The subtraction of octal numbers follows the same rules as the subtraction of numbers in any other number system. The only variation is in borrowed number. In the decimal system, you borrow a group of 10 10. In the binary system, you borrow a group of 2 10. In the octal system you borrow a group of 8 10. Example Subtraction Hexadecimal Arithmetic The arithmetical operations on base 16 hexadecimal numbers can be performed in the similar they are accomplished on decimal numbers. Tables for hexadecimal addition and multiplication are used for this purpose. The arithmetic operations differ from those done on decimal numbers as described below: 1. The sum 16 is carried over to the next higher place as 1 as 10 is carried over as 1 in decimal addition. 2. When 1 is borrowed from the immediate higher place, it is counted as 16 instead of 10 in decimal subtraction. Let us look into more detail how hexadecimal arithmetical operations are performed. Hexadecimal Arithmetic Examples Hexadecimal Addition: The Addition table below shows the sum for all possible combination of digits in addition

Example: Add 16F 16 + 4A2 16. 1 1 Carried over digits 1 6 F + 4 A 2 ---------------- 6 1 1 ----------------- The digits in unit's place F are 2. From the table, F + 2 = 11 16 from which 1 is written in unit's place and 1 is carried over to the next higher (16) place. The digits in 16's place are added as 1 + 6 + A = 7 + A = 11 16 (From table) out of which, 1 is written down as sum and 1 is carried to the next higher (16 2 ) place. The digits in 16 2 's place add as 1 + 1 + 4 = 6 16. Thus 16F 16 + 4A2 16 = 611 16. Hexadecimal Subtraction: The rule to be remembered for subtraction is the digit borrowed from the immediate higher place is counted as 16. Example: Subtract B4A 16 from C39 16. 16 16 Borrowed B 2 Remaining digit after borrowing C 3 9 - B 4 A ------------------ E F ------------------- In units place, A the bigger number is to be subtracted from 9. So, 1 digit from 16's place is borrowed and 16 + 9 = 25. A is subtracted from 25. 25 - A 16 = F 16 (Note the values of A and F are 10 and 15). As 1 is borrowed from 3, now for the next place 4 is to be subtracted from 2. This again requires borrowing from the next higher place. 16 + 2-4 = 18-4 = E 16. Now, for the next place, B is to B subtracted from B remaining after lending 1.B -B = 0. Thus C39 16 - B4A 16 - = EF 16. Hexadecimal Multiplication: The following table gives products of all combinations of two single digits. While multiplying, if the product consists of two digits, the digit on the left is carried over and added to the product in the next place. Example: Find the product of 1A8 16 and AF 16. 6 5 Digits carried over in second multiplication 9 7 Digits carried over in first multiplication. 1 A 8 x A F --------------- 1 8 D 8 1 0 9 0 0 -------------------------- 1 2 1 D 8 ---------------------------

First the digit F in the number AF 16 is multiplied with each of the digits in the number 1A8 16. F x 8 = 78. The digit 8 is written below in the product row and 7 is carried over to the next place to be added with the next product. F x A = 96 16 and 96 16 + 7 16 = 9D 16. D is written in the product row and 9 is carried over to the next place F x 1 = F. and F 16 + 9 16 = 18 16. The second row of multiplication is done in a similar manner, by multiplying the digit A with each of the digits in 1A8 16. The two products are then added to get the final product. Thus 1A8 16 x AF 16 = 121D8 16. BCD or Binary Coded Decimal: BCD or Binary Coded Decimal is that number system or code which has the binary numbers or digits to represent a decimal number. A decimal number contains 10 digits (0-9). Now the equivalent binary numbers can be found out of these 10 decimal numbers. In case of BCD the binary number formed by four binary digits, will be the equivalent code for the given decimal digits. In BCD we can use the binary number from 0000-1001 only, which are the decimal equivalent from 0-9 respectively. Suppose if a number have single decimal digit then its equivalent Binary Coded Decimal will be the respective four binary digits of that decimal number and if the number contains two decimal digits then its equivalent BCD will be the respective eight binary of the given decimal number. Four for the first decimal digit and next four for the second decimal digit. It may be cleared from an example. Let, (12)10 be the decimal number whose equivalent Binary coded decimal will be 00010010. Four bits from L.S.B is binary equivalent of 2 and next four is the binary equivalent of 1. Table given below shows the binary and BCD codes for the decimal numbers 0 to 15. From the table below, we can conclude that after 9 the decimal equivalent binary number is of four bit but in case of BCD it is an eight bit number. This is the main difference between Binary number and binary coded decimal. For 0 to 9 decimal numbers both binary and BCD is equal but when decimal number is more than one bit BCD differs from binary.

Decimal number Binary number 0 0000 0000 1 0001 0001 2 0010 0010 3 0011 0011 4 0100 0100 5 0101 0101 6 0110 0110 7 0111 0111 8 1000 1000 9 1001 1001 Binary Coded Decimal(BCD) 10 1010 0001 0000 11 1011 0001 0001 12 1100 0001 0010 13 1101 0001 0011 14 1110 0001 0100 15 1111 0001 0101 Binary floating point number: Here it is not a decimal point we are moving but a binary point and because it moves it is referred to as floating. What we will look at below is what is referred to as the IEEE 754 Standard for representing floating point numbers. The standard specifies the number of bits used for each section (exponent, mantissa and sign) and the order in which they are represented. The standard specifies the following formats for floating point numbers: Single precision, which uses 32 bits and has the following layout: 1 bit for the sign of the number. 0 means positive and 1 means negative. 8 bits for the exponent. 23 bits for the mantissa. Double precision, which uses 64 bits and has the following layout. 1 bit for the sign of the number. 0 means positive and 1 means negative. 11 bits for the exponent. 52 bits for the mantissa. eg. 0 00011100010 0100001000000000000001110100000110000000000000000000 Double precision has more bits, allowing for much larger and much smaller numbers to be represented. As the mantissa is also larger, the degree of accuracy is also

increased (remember that many fractions cannot be accurately represented in binary). Whilst double precision floating point numbers have these advantages, they also require more processing power. With increases in CPU processing power and the move to 64 bit computing a lot of programming languages and software just default to double precision. We will look at how single precision floating point numbers work below (just because it's easier). Double precision works exactly the same, just with more bits. The sign bit This is the first bit (left most bit) in the floating point number and it is pretty easy. As mentioned above if your number is positive, make this bit a 0. If your number is negative then make it a 1. The Exponent The exponent gets a little interesting. Remember that the exponent can be positive (to represent large numbers) or negative (to represent small numbers, ie fractions). Your first impression might be that two's complement would be ideal here but the standard has a slightly different approach. This is done as it allows for easier processing and manipulation of floating point numbers. With 8 bits and unsigned binary we may represent the numbers 0 through to 255. To allow for negative numbers in floating point we take our exponent and add 127 to it. The range of exponents we may represent becomes 128 to -127. 128 is not allowed however and is kept as a special case to represent certain special numbers as listed further below. Eg. let's say: We want our exponent to be 5. 5 + 127 is 132 so our exponent becomes - 10000100 We want our exponent to be -7. -7 + 127 is 120 so our exponent becomes 01111000 The Mantissa In scientific notation remember that we move the point so that there is only a single (non zero) digit to the left of it. When we do this with binary that digit must be 1 as there is no other alternative. The creators of the floating point standard used this to their advantage to get a little more data represented in a number. After converting a binary number to scientific notation, before storing in the mantissa we drop the leading 1. This allows us to store 1 more bit of data in the mantissa. eg. If our number to store was 111.00101101 then in scientific notation it would be 1.1100101101 with an exponent of 2 (we moved the binary point 2 places to the left). We drop the leading 1. and only need to store 1100101101. If our number to store was 0.0001011011 then in scientific notation it would be 1.011011 with an exponent of -4 (we moved the binary point 4 places to the right). We drop the leading 1. and only need to store 011011.

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. Advantages of Binary Code Following is the list of advantages that binary code offers. Binary codes are suitable for the computer applications. Binary codes are suitable for the digital communications. Binary codes make the analysis and designing of digital circuits if we use the binary codes. Since only 0 & 1 are being used, implementation becomes easy. 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 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.

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 Baudot 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. Decimal Binary 8421 2421 5211 Excess-3 Gray Code 0 0 0000 0000 0000 0011 0000 1 1 0001 0001 0001 0100 0001 2 10 0010 0010 0011 0101 0011 3 11 0011 0011 0101 0110 0010 4 100 0100 0100 0111 0111 0110 5 101 0101 1011 1000 1000 0111 6 110 0110 1100 1010 1001 0101 7 111 0111 1101 1100 1010 0100 8 1000 1000 1110 1110 1011 1100 9 1001 1001 1111 1111 1100 1101 10 1010 1111 11 1011 1110 12 1100 1010 13 1101 1011 14 1110 1001 15 1111 1000

Error Codes : There are binary code techniques available to detect and correct data during data transmission. What is Error? Error is a condition when the output information does not match with the input information. During transmission, digital signals suffer from noise that can introduce errors in the binary bits travelling from one system to other. That means a 0 bit may change to 1 or a 1 bit may change to 0. Error-Detecting codes Whenever a message is transmitted, it may get scrambled by noise or data may get corrupted. To avoid this, we use error-detecting codes which are additional data added to a given digital message to help us detect if an error occurred during transmission of the message. A simple example of error-detecting code is parity check. Error-Correcting codes Along with error-detecting code, we can also pass some data to figure out the original message from the corrupt message that we received. This type of code is called an error-correcting code. Error-correcting codes also deploy the same strategy as errordetecting codes but additionally, such codes also detect the exact location of the corrupt bit. In error-correcting codes, parity check has a simple way to detect errors along with a sophisticated mechanism to determine the corrupt bit location. Once the corrupt bit is located, its value is reverted (from 0 to 1 or 1 to 0) to get the original message. How to Detect and Correct Errors? To detect and correct the errors, additional bits are added to the data bits at the time of transmission. The additional bits are called parity bits. They allow detection or correction of the errors. The data bits along with the parity bits form a code word. Parity Checking of Error Detection It is the simplest technique for detecting and correcting errors. The MSB of an 8-bits word is used as the parity bit and the remaining 7 bits are used as data or message bits. The parity of 8-bits transmitted word can be either even parity or odd parity.

Even parity -- Even parity means the number of 1's in the given word including the parity bit should be even (2,4,6,...). Odd parity -- Odd parity means the number of 1's in the given word including the parity bit should be odd (1,3,5,...). Use of Parity Bit The parity bit can be set to 0 and 1 depending on the type of the parity required. For even parity, this bit is set to 1 or 0 such that the no. of "1 bits" in the entire word is even. Shown in fig. (a). For odd parity, this bit is set to 1 or 0 such that the no. of "1 bits" in the entire word is odd. Shown in fig. (b). How Does Error Detection Take Place? Parity checking at the receiver can detect the presence of an error if the parity of the receiver signal is different from the expected parity. That means, if it is known that the parity of the transmitted signal is always going to be "even" and if the received signal has an odd parity, then the receiver can conclude that the received signal is not correct. If an error is detected, then the receiver will ignore the received byte and request for retransmission of the same byte to the transmitter.

BOOLEAN ALGEBRA & LOGIC GATES : Logic gates are electronic circuits that can be used to implement the most elementary logic expressions, also known as Boolean expressions. The logic gate is the most basic building block of combinational logic. There are three basic logic gates, namely the OR gate, the AND gate and the NOT gate. Other logic gates that are derived from these basic gates are the NAND gate, the NOR gate, the EXCLUSIVEOR gate and the EXCLUSIVE-NOR gate. This chapter deals with logic gates and implementations using NAND and NOR gates followed by simplification of Boolean functions using Boolean Laws and theorems and using K-maps. Positive and Negative Logic The binary variables can have either of the two states, i.e. the logic 0 state or the logic 1 state. These logic states in digital systems such as computers, for instance, are represented by two different voltage levels or two different current levels. If the more positive of the two voltage or current levels represents a logic 1 and the less positive of the two levels represents a logic 0, then the logic system is referred to as a positive logic system. If the more positive of the two voltage or current levels represents a logic 0 and the less positive of the two levels represents a logic 1, then the logic system is referred to as a negative logic system. If the two voltage levels are 0 V and +5 V, then in the positive logic system the 0 V represents logic 0 and the +5 V represents logic 1. In the negative logic system, 0 V represents logic 1 and 5 V represents logic 0. If the two voltage levels are 0 V and 5 V, then in the positive logic system the 0 V represents a logic 1 and the 5 V represents a logic 0. In the negative logic system, 0 V represents logic 0 and 5 V represents logic 1. Logic Gates The logic gate is the most basic building block of any digital system, including computers. Each one of the basic logic gates is a piece of hardware or an electronic circuit that can be used to implement some basic logic expression. While laws of Boolean algebra could be used to do manipulation with binary variables and simplify logic expressions, these are actually implemented in a digital system with the help of electronic circuits called logic gates. The three basic logic gates are the OR gate, the AND gate and the NOT gate. OR Gate A logic gate used to perform the operation of logical addition is called an OR gate. An OR gate performs an ORing operation on two or more than two logic variables. The OR operation on two independent logic variables A and B is written as Y = A+B and reads as Y equals A OR B. An OR gate is a logic circuit with two or more inputs and one output. The output of an OR gate is LOW only when all of its inputs are LOW. For all other possible input combinations, the output is HIGH. A truth table lists all possible combinations of input binary variables and the corresponding outputs of a logic system. Figure shows the circuit symbol and the truth table of a two-input OR gate. The operation of a two-input OR gate is explained by the logic expression

Y = A+B Two input OR Gate AND Gate : A logic gate used to perform logical multiplication is known as AND gate. An AND gate is a logic circuit having two or more inputs and one output. The output of an AND gate is HIGH only when all of its inputs are in the HIGH state. In all other cases, the output is LOW. The logic symbol and truth table of a two-input AND gate is shown in figure. The AND operation on two independent logic variables A and B is written as Y = A.B and reads as Y equals A AND B. The operation of a two-input AND gate is explained by the logic expression Y = A.B Two input AND Gate NOT Gate A logic gate used to perform logical inversion is known as a NOT gate. A NOT gate is a one -input, one-output logic circuit whose output is always the complement of the input. That is, a LOW input produces a HIGH output, and vice versa. If is the input to a NOT circuit, then its output Y is given by Y = or and reads as Y equals NOT. The logic symbol and truth table of a NOT gate is shown in figure. The operation of a NOT gate is explained by the logic expression Y = A NAND Gate NOT Gate NAND stands for NOT AND. An AND gate followed by a NOT circuit makes it a NAND gate. The output of a NAND gate is logic 0 when all its inputs are logic 1. For all other input combinations, the output is logic 1. The symbol and truth table of a NAND gate is as shown. NAND gate operation is logically expressed as Y = A.B Two input NAND Gate NAND Gate is known as Universal gate as it can be used alone to implement any gate operation. Hence it is said to be functionally complete.

NOR Gate NOR stands for NOT OR. An OR gate followed by a NOT circuit makes it a NOR gate. The output of a NOR gate is logic 1 when all its inputs are logic 0. For all other input combinations, the output is logic 0. The symbol and truth table of a NOR gate is as shown. The output of a two-input NOR gate is logically expressed as Y = A+B Two input NOR Gate NOR gate is also known as Universal gate as it is used alone to implement any gate operation and hence it is also functionally complete. EXCLUSIVE-OR Gate The EXCLUSIVE-OR gate, commonly written as EX-OR gate, is a two-input, one-output gate. The output of an EX-OR gate is logic 1 when the inputs are unlike and logic 0 when the inputs are like. Although EX-OR gates are available in integrated circuit form only as two-input gates, unlike other gates which are available in multiple inputs also, multiple-input EX-OR logic functions can be implemented using more than one twoinput gates. The output of a multiple-input EX-OR logic function is logic 1 when the number of 1s in the input sequence is odd and logic 0 when the number of 1s in the input sequence is even, including zero. The symbol and truth table of an EX-OR gate is shown in figure. The output of a two-input EX-OR gate is logically expressed as EXCLUSIVE-NOR Gate Two input EX-OR Gate EXCLUSIVE-NOR (commonly written as EX-NOR) means NOT of EX-OR, i.e. the logic gate that we get by complementing the output of an EX-OR gate. The truth table of an EX-NOR gate is obtained from the truth table of an EX-OR gate by complementing the output entries as shown in figure. Logically, Two input EX-NOR Gate The output of a two-input EX-NOR gate is logic 1 when the inputs are like and logic 0 when they are unlike. In general, the output of a multiple-input EX-NOR logic function is logic 0 when the number of 1s in the input sequence is odd and a logic 1 when the number of 1s in the input sequence is even including zero.

Boolean algebra: Boolean algebra is an algebraic structure defined on a set of elements B together with two binary operators + and provided the following postulates are satisfied: Boolean Laws & Theorems: Duality Principle: It states that every algebraic expression deducible from the postulates of Boolean algebra remains valid if the operators and identity elements are interchanged. If the dual of an algebraic expression is desired, OR and AND operators are interchanged and 1 s are replaced by 0 s and 0 s by 1 s. DeMorgan s Theorem: Absorption Theorem: 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:

Universal Gates OR, AND and NOT gates are the three basic logic gates as they together can be used to construct the logic circuit for any given Boolean expression. NOR and NAND gates have the property that they individually can be used to hardware-implement a logic circuit corresponding to any given Boolean expression. That is, it is possible to use either only NAND gates or only NOR gates to implement any Boolean expression. This is so because a combination of NAND gates or a combination of NOR gates can be used to perform functions of any of the basic logic gates. It is for this reason that NAND and NOR gates are universal gates. 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: 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: Boolean Expressions: A Boolean expression or a function is an expression which consists of binary variables joined by the Boolean connectives AND and OR along with NOT operation. Any Boolean expression can be expressed in two forms: a) Canonical form b) Standard form Canonical Form: An expanded form of Boolean expression, where each term contains all Boolean variables in their true or complemented form, is known as the canonical form of the expression. a) Sum of minterms: Any Boolean function can be expressed as a sum of minterms expression. A minterm is a standard product which consists of all variables in either complemented or un-complemented form for which the output is 1. For example, is a sum of minterms expression with three variables. b) Product of maxterms: Any Boolean function can be expressed as a product of maxterms expression. A maxterm is a standard sum which consists of all variables in either complemented or un-complemented form for which the output is 0. For example, Standard Form: is a product of maxterms expression with three variables. A simplified form of a Boolean expression which may consist of one or more number of variables in each term in either complemented or un-complemented form, is known as Standard form of the expression.

a) Sum of Products (SOP): The sum of products is a Boolean expression containing AND terms, called Product terms, of one or more literals each; the sum denotes the ORing of these terms. For example, is a SOP expression with three variables. b) Product of Sums (POS): It is a Boolean expression containing OR terms called Sum terms and the product denotes the ANDing of these terms. is a POS expression with three variables. ** Canonical form is obtained when a function is taken from a truth table. When Implementing a Boolean function with gates, standard form is preferred. Simplification of Boolean expressions: The primary objective of all simplification procedures is to obtain an expression that has the minimum number of terms. Obtaining an expression with the minimum number of literals is usually the secondary objective. The Boolean functions can be simplified by using a) Boolean Laws and theorems b) K maps c) Quine Mc-Cluskey or Tabulation Method Simplification using K-maps: A Karnaugh map is a graphical representation of the logic system. It can be drawn directly from either minterm (sum-of-products) or maxterm (product-of-sums) Boolean expressions. Drawing a Karnaugh map from the truth table involves an additional step of writing the minterm or maxterm expression depending upon whether it is desired to have a minimized sum-of-products or a minimized product of sums expression. An n-variable Karnaugh map has 2 n squares, and each possible input is allotted a square. In the case of a minterm Karnaugh map, 1 is placed in all those squares for which the output is 1, and 0 is placed in all those squares for which the output is 0. 0s are omitted for simplicity. An X is placed in squares corresponding to don t care conditions. a) Two Variable K-map:

i) Sum of minterms representation ii) Product of maxterms representation b) Three Variable K-map: i) Sum of minterms representation ii) Product of maxterms representation c) Four Variable K-map: i) Sum of minterms representation ii) Product of maxterms representation d) Five Variable K-map:

Simplification Algorithm: Simplification of logical functions using K-maps is based on the principle of combining terms in adjacent cells. Two cells are said to be adjacent if they differ in only one variable. 1. Identify the ones which cannot be combined with any other ones and encircle them. These are called essential prime implicants. 2. Identify the ones that can be combined in groups of two in only one way. Encircle them. 3. Identify the ones that can be combined with three other ones, to make a group of four adjacent ones, in only one way. Encircle such group of ones. 4. Identify the ones that can be combined with seven other ones, to make a group of eight adjacent ones, in only one way. Encircle them. 5. After identifying the essential groups of 2, 4, and 8 ones, if there still remain some ones which have not been encircled, then these are to be combined with each other or with other already encircled ones. Examples: