Table of contents

1 INTRODUCTION...... 3

1.1 NUMBER SYSTEMS...... 4 1.2 Base Values...... 4 1.3 Decimal Number System...... 4 1.4 Binary Number system ( Base 2)...... 5 1.5 Octal Base System (Base 8)...... 5 1.6 Hexadecimal Number System (Base16)...... 5 2 CONVERTING DECIMAL NUMBERS TO BINARY NUMBERS...... 6

2.1 Method 1: Using the remainder theorem...... 6 2.2 Method 2: Using the Binary Exponential Placeholders...... 7 2.3 CONVERTING DECIMAL FRACTIONS TO BINARY...... 10 2.4 Converting mixed decimal numbers to binary...... 11 2.5 Converting decimal numbers to octal number system...... 13 2.6 Converting decimal fractions to octal system...... 13 2.7 Converting decimal numbers to Hexadecimal number system...... 15 2.8 Converting decimal fractions to hexadecimal number system...... 15 2.9 Converting binary numbers to octal number system...... 16 2.10 Converting binary numbers to hexadecimal number system...... 17 3 SIGNED FIXED POINT NUMBERS...... 18

3.1 Signed magnitude...... 18 3.2 Ones Complement...... 18 3.3 Twos complement...... 19 3.4 Excess Representation...... 20 3.5 Gray Code...... 22 3.6 Converting a number in Gray to Binary...... 22 3.7 Excess 3 Gray Code...... 25 3.8 Range and Precision in Floating Point Numbers...... 25 3.9 Representing floating point numbers in the computer...... 26 4 BINARY CODED DECIMAL...... 29

4.1 Representing signed numbers in BCD...... 29 4.2 NINES AND TENS COMPLEMENT...... 30 4.2.1 Nines complement (Negative)...... 30 4.2.2 Tens complement (Negative)...... 30 5 COMPUTER CODES...... 31

5.1 ASCII (American Standard Code for Information Interchange)...... 31 5.2 EBCDIC – (Extended Binary Coded Decimal Information Code)...... 32 5.3 UNICODE...... 33 6 BOOLEAN ALGEBRA...... 35 6.1 PROPERTIES OF BOOLEAN ALGEBRA...... 35 6.2 DE MORGAN’S THEOREM...... 36 7 LOGIC GATES...... 38

7.1 NOT Logic gate...... 38 7.2 The OR Logic Gate...... 39 7.3 The AND logic gate...... 40 7.4 The NOR logic gate...... 40 7.5 The NAND logic gate...... 41 7.6 EXclusive OR (XOR) logic gate...... 42 7.7 EXclusive NOR (XNOR) logic gate...... 42 8 KARNAUGH MAPS...... 44

8.1 One variable Karnaugh map...... 44 8.2 Two variable Karnaugh map...... 44 8.3 The three variable Karnaugh map...... 45 8.4 The Four variable Karnaugh map...... 46 8.5 Karnaugh Maps Rules for Boolean Functions Simplification...... 46 8.6 WORKING WITH DON’T CARE CONDITIONS...... 51 9 COMBINATIONAL AND SEQUENTIAL CIRCUITS...... 55

9.1 ADDERS...... 55 9.2 FULL ADDER...... 57 9.3 REDUCTION OF COMBINATIONAL CIRCUITS...... 59 9.4 DECODER...... 61 9.5 MULTIPLEXER (MUX)...... 63 9.6 DE MULTIPLEXER (DEMUX)...... 64 10 SEQUENTIAL CIRCUITS...... 65

10.1 Flip Flop Circuits...... 65 10.2 Clocked R S Flip Flop...... 68 10.3 JK Flip-flop (Universal Flip-flop)...... 69 10.4 JK Master Slave flip-flop built on NAND gates...... 70 10.5 D flip-flop (Delay Flip-flop)...... 71 10.6 EDGE TRIGGERED FLIP FLOPS...... 72 10.7 EXCITATION TABLES...... 73 10.8 SEQUENTIAL CIRCUIT EQUATIONS...... 75 11 DIGITAL COUNTERS...... 84

11.1 An asynchronous 4 bit Binary Up counter...... 85 11.2 An Asynchronous 4-Bit Down Counter...... 86 11.3 SYNCHRONOUS COUNTERS...... 88 12 REGISTERS AND THEIR OPEATIONS...... 90

12.1 SHIFT REGISTERS...... 92 12.2 SERIAL-IN SERIAL-OUT REGISTER...... 92 12.3 SERIAL-IN PARALLEL-OUT SHIFT REGISTER...... 93 12.4 PARALLEL IN- SERIAL –OUT REGISTER...... 94 APPENDICES...... 95

APPENDIX 1...... 95 APPENDIX 2...... 98 REFERENCES...... 101

1 INTRODUCTION

Digital Logic Technology has a strong impact in our daily lives. Therefore a course in Digital Logic Design Concepts becomes a standard requirement for undergraduates majoring in computer science, physics, electrical engineering as and in mathematics

(for those who do a computer science with mathematics degree).

In this module emphasis is on digital logic design. This book assumes no background in computers on the part of the reader but a good background in physics and mathematics is a requirement. Our intention, as authors of this module, is to present a set of procedures commonly encountered in Digital Logic Design.

Our philosophy as authors of this module is that an introductory course in Digital

Logic Design should establish a strong foundation on the basic principles that are provided by a more traditional approach to the design of combinational and sequential circuits before one engages on the use of computer-aided design tools.

Once the basic concepts and principles have been mastered then the use of design software becomes more meaningful and allows the student to use the design software more effectively. So this module focuses on the understanding of basic principles of

Digital Logic Design and the application of these principles to the analysis and design of combinational and sequential logic circuits

1.1 NUMBER SYSTEMS

A number system defines a set of values used to represent quantity. We talk about the number of people attending class, the number of modules taken per student, and also use numbers to represent grades achieved by students in tests.

Quantifying values and items in relation to each other is helpful for us to make sense of our environment. The study of number systems is not just limited to computers. We apply numbers every day, and knowing how numbers work will give us an insight into how a computer manipulates and stores numbers.

1.2 Base Values

The base value of a number system is the number of different values the set has before repeating itself. For example, decimal has a base of ten values, 0 to 9.

 Decimal = 10 (0 - 9)  Binary = 2 (0, 1)  Octal = 8 (0 - 7)  Hexadecimal = 16 (0 - 9, A-F)

We will limit ourselves to the above number base systems. 1.3 Decimal Number System

This number base system is also called denary system and is the most common to us as human beings as we use it in our daily lives to do calculations and counting. It uses ten (10) different symbols to represent values. The set values used in decimal are 0 1

2 3 4 5 6 7 8 9 and 0 has the least value and nine has the greatest value. The digit on the left has the greatest value, whilst the digit on the right has the least value.

Although this is the most common number base system in use in our daily lives, the computers do not use this base for representing data/information. 1.4 Binary Number system ( Base 2)

The binary number system uses two values to represent numbers. The values are, 0 and a 1. These two values have also the interpretations FALSE for a 0 and TRUE for a 1, LOW for a 0 and HIGH for a 1, OFF for 0 and ON for a 1. Zero (0) has the least value, and one (1) has the greatest value. The least value is also called the least significant bit (LSB), the greatest value the most significant bit (MSB)

1.5 Octal Base System (Base 8)

The octal number system uses eight values to represent numbers. The values are 0, 1,

2, 3, 4, 5, 6, 7 with 0 having the least value and seven having the greatest value.

1.6 Hexadecimal Number System (Base16)

The hexadecimal number system uses sixteen values to represent numbers. The values are, 0 1 2 3 4 5 6 7 8 9 A B C D E F with 0 having the least value and F having the greatest value. 2 CONVERTING DECIMAL NUMBERS TO BINARY NUMBERS

There are a number of ways to convert between decimal and binary.

We will start converting the decimal value 50 to binary using the remainder theorem also called the division method followed by the Subtraction method.

2.1 Method 1: Using the remainder theorem

Steps

1. Divide the decimal number by 2, and note down the remainder

2. Divide the quotient by 2 and note the remainder

3. Repeat step 2 until the number is no longer divisible by 2

4. Write down the remainder values in reverse order..

Example 1

Convert 15010 to Binary

150 / 2 75 remainder 0 LS B

75 / 2 37 remainder 1

37 / 2 18 remainder 1

18 / 2 9 remainder 0

9 / 2 4 remainder 1

4 / 2 2 remainder 0

2/ 2 1 remainder 0

1 / 2 0 remainder 1 MSB

Thus the binary equivalent is 1001011. This binary number is equivalent to 15010. We also need to prove that this is correct. To do this, we write the binary number and give it weights (indices) beginning with 20. For example 17 06 05 14 03 12 11 00

27 x 1 + 26 x 0 + 25 x 0 + 24 x 1 + 23 x 0 + 22 x 1 + 21 x 1+ 20 x 0

128 x 1 + 0 + 0 + 16 + 0 + 0+4+2 = 150

Example 2 Convert 13210 to binary equivalent

132 / 2 66 remainder 0 LSB

66 / 2 33 remainder 0

33 / 2 16 remainder 1

16 / 2 8 remainder 0

8 / 2 4 remainder 0

4 / 2 2 remainder 0

2 / 2 1 remainder 0

1 / 2 0 remainder 1 MSB

Thus the binary equivalent is 10000100

We also proved that this was correct.

1706 05 04 03 12 01 00 128 x 1 + 4 = 132

2.2 Method 2: Using the Binary Exponential Placeholders.

This method uses the binary weighting system and is also sometimes referred to as the

8:4:2:1 approach. Each column represents a power of 2. To make things easy one must to know the binary exponential holders.

Example: Convert 1110 to its binary equivalent.

The highest power of two number nearest to eleven is 3, so 23 is 8

We write 8 4 2 1 1 0 1 1

We ask ourselves the question, can 8 be subtracted from 11? The answer is yes, we write a one under the column 8. We subtract 8 from 11 and the answer is 3. The next highest power of two is 4. Ask our selves the question; can 4 be subtracted from

3? Answer is no. Write a zero (o) under column 4. The next highest power of 2 is two. Ask our selves the question, can two be subtracted from 3. The answer is yes and we write 1 under column 2. We subtract 2 from 3. The answer is 1. The next highest power of two is 1. We ask our selves the question; can 1 be subtracted from 1? The answer is yes, we write a 1under column 1.

So 1110 is equivalent to 10112

Example:

Convert 19710 to binary using Binary Exponential Placeholders

The highest Binary Exponential Placeholders next to 127 is 128, which is 27. If 128 can be subtracted from 128, we write a 1 in column 128, Subtract 128 from 197. The answer is 69. If 64 can be subtracted from 69, we put a 1 in column in 64. We subtract 64 from 69. The answer is 5. 32 cannot be subtracted from 5. We put a zero (0) in

column 32. Next is column is 8, which cannot be subtracted from 5 and we put a 0 in

column 8. Next is column 4. 4 can be subtracted from 5, so we put a 1 in column 4.

Subtract 4 from 5 and the answer is 1. Next column is 2 and 2 cannot be subtracted

from 1 and we write a 0 in column 2. Next column is 1 and 1 can be subtracted from

1, so we put a 1 in column 1.

Positional weight 27 26 25 24 23 22 21 20 Value 128 64 32 16 8 4 2 1 Number 1 1 0 0 0 1 0 1

So we have 1 1 0 0 0 1 0 12 = 19710

We prove this by converting 11000101 back to decimal.

27 x 1+ 26x1+25x 0+24x 0+23x 0 +22x1+21x0+20x1

= 128+64+4++1=197

Advantages of Binary number system are:

- Simple to work with (uses only two symbols i.e. a zero (0) and a one (1);

- Lower power consumption as it uses only two states and

- Easy to convert from binary to octal decimal and hexadecimal number

base systems

Disadvantages binary conversions

Binary numbers are:

- Cumbersome to write down; -Long strings of 1s and zeros and one can easily make mistakes when dealing

with large numbers;

- Not very meaning to the average user and

-They are understood by computers

Binary table Decimal equivalent

00 0

01 1

10 2

11 3

2.3 CONVERTING DECIMAL FRACTIONS TO BINARY

Decimal fractions are converted to binary fractions equivalent using the multiplication method.

Steps

1. Write down the decimal fraction

2. Multiply the decimal fraction by 2

3. Write down the whole number part

4. Repeat steps 2 and 3 until the degree of accuracy has been achieved.

5. Write down the whole numbers in the order you produced them.

Note that when converting decimal fractions to their binary equivalents, we should do this to a given degree of accuracy, i.e. the number of decimal points places that are needed. When using binary fractions it is recommended to use a less number of decimal places as the fractions become very inaccurate as the number of decimal points increases. Example:

Convert 0.12510 to binary equivalent

.125 x 2 = 0.250 whole number part = 0 MSB

.250 x 2 = 0.500 whole number part = 0

.500 x 2 = 1.000 whole number part = 1 LSB

Proof:

0-1 0-2 1-3

2-1 x 0 +2-2 x 0 +2-3 x1

½1 x 0 + ½2 x 0 + ½3 x 1

= 1/8 = 0.125

Example:

Convert 0.25510 to binary equivalent

0.255 x 2 = .510 whole number part = 0 MSB

0.510 x 2 = 1.020 whole number part = 1

0.020 x 2 = .040 whole number part = 0

0-1 1-2 0-3

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

= ½2 = ¼ = 0.250

This is what I meant when I said (above) when the number of binary point places increases the fractions become inaccurate. As can be observed from the above example 0.255 when converted to binary fraction converts to 0.250 and not to 0.255.

The major disadvantage of converting decimal fractions to binary fractions is that some precision can be lost in the process of conversion, for example not all terminating decimal fractions have a terminating binary equivalent, for example 0.210 becomes non-terminating binary fraction.

2.4 Converting mixed decimal numbers to binary

Steps

1 Use the remainder theorem to convert the decimal number to binary

2 Use the multiplication method to convert the decimal fraction to binary fraction

3 Write the binary integer part, followed by a period and then the fraction part.

Example:

Convert 132.12510 to binary equivalent

We convert the whole number (integer) part using the division method

132 / 2 66 remainder 0 LSB

66 / 2 33 remainder 0

33 / 2 16 remainder 1

16 / 2 8 remainder 0

8 / 2 4 remainder 0

4 / 2 2 remainder 0

2 / 2 1 remainder 0

1 / 2 0 remainder 1 MSB

Thus the binary equivalent is 10000100

We also prove that this is correct by converting back to decimal.

1706 05 04 03 12 01 00

128 x 1 + 4 = 132

We convert the fraction part (.12510) to binary equivalent using the multiplication method

.125 x 2 = 0.250 whole number part = 0 MSB

.250 x 2 = 0.500 whole number part = 0

.500 x 2 = 1.000 whole number part = 1 LSB

Proof:

0-1 0-2 1-3

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

½1 x 0 + ½2 x 0 + ½3 x 1

= 1/8 = 0.125

So 10000100.0012 is equivalent to 132.12510

2.5 Converting decimal numbers to octal number system

Steps

1. Divide the decimal number by 8 and note down the remainder

2. Divide what's left (quotient) by 8 and note the remainder

3. Repeat step 2 until the number is no longer divisible by 8

4. Write down the remainders values in reverse order. Example:

Problem: Convert 17610 in octal to decimal

176 / 8 = 22 remainder 0 LSB

22/ 8 = 2 remainder 6

2/8 = 0 remainder 2 MSB

Proof:

22 61 00

82 x 2 + 81 x 6 + 80x 0 64 x 2 + 48

128 + 48 = 176

2.6 Converting decimal fractions to octal system

Steps

1. Write down the decimal fraction

2. Multiply the decimal fraction by 8

3. Write down the whole number part

4. Repeat steps 2 and 3 until the degree of accuracy has been achieved.

5. Write down the whole numbers in the order you produced them.

Example:

Convert .62510 to octal number system equivalent

The steps used to convert decimal fraction to binary fractions still apply.

.625 x 8 = 5.000 whole number part = 5 MSB

.000 x 8 = .000 whole number part = 0 .000 x 8 = .000 whole number part = 0

.5-1 0-2 0-3

8-1x 5 + 8-2 x 0 + 8-3 x 0

= 5/8

= 0.625

Decimal – Binary – Octal Table

Decimal Binary Octal 0 000 0 1 001 1 2 010 2 3 011 3 4 100 4 5 101 5 6 110 6 7 111 7 2.7 Converting decimal numbers to Hexadecimal number system

The steps used to convert decimal numbers to binary also apply when converting decimal numbers to hexadecimal.

Steps

1. Divide the decimal number by 16 and note down the remainder

2. Divide what's left by 16 and note the remainder

3. Repeat step 2 until the number is no longer divisible by 16

4. Write down the remainder values in reverse order..

Example:

Convert 5010 to hexadecimal number system

50/ 16 = 3 remainder 2

3/ 16 = 0 remainder 3

5010 = 3 2H

Proof:

161 x 3 + 160 x 2

48 + 2 = 50

2.8 Converting decimal fractions to hexadecimal number system

The steps used to convert decimal fractions to binary and octal number systems still apply. Example:

Convert .75 to hexadecimal fraction

.75 x16 = 12.00 whole number part = 12 MSD

.00 x 16 = 0.00 whole number part = 0

.00 x 16 = 0.00 whole number part = 0

0.7510 = C0H

Proof:

16-1x C + 16-2 x 0

12/16 = 0.75

Decimal Binary Hexadecimal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F

2.9 Converting binary numbers to octal number system

One of the advantages of the binary number system representation is the easy conversion to octal and hexadecimal number systems. Steps

1. Write down the binary number

2. Dive the binary bits into groups of three bits starting from the least significant bit

3. If the number of bits to the left most bit is less than three bits, add zero(s)

4. Convert the bits in groups of three to octal number system

Example:

Convert 110100110012 to octal number system

011 010 011 001

011 = 38; 010 = 28; 011 = 38; 001= 18 so 110100110012 = 32318

2.10 Converting binary numbers to hexadecimal number system

The same steps used to convert binary numbers to octal number system apply except that instead of diving the binary bits into groups of three, subdivide them into groups of fours (4).

Steps

1. Write down the binary number

2. Divide the binary bits into groups of four bits starting from the least significant bit

3. If the number of bits to the left most bit is less than four bits, then add zero(s)

4. Convert the bits in groups of four bits to hexadecimal number system

Example:

Convert 110100110012 to octal number system 0110 1001 1001

0110 = 6H; 1001 = 9H; 1001 = 9H

So 110100110012 = 699H

3 SIGNED FIXED POINT NUMBERS

There are different ways of representing signed fixed point numbers in the computer, and these are: Signed magnitude, Ones complement, Twos complement and excess notation.

3.1 Signed magnitude

This is the most familiar as it is also used in the decimal number system. In this representation a plus (+) to the left of a number or a minus (-) indicates whether the number is positive or negative, for example +1710 or –1710

In binary signed magnitude representation, the leftmost bit is used for the sign which can be a 0 or a 1 or a ‘+’ or ‘-‘

For example:

(+ 12) 10 = (00001100)2

(- 12) 10 = (10001100)2

The negative number is calculated by simply changing the sign bit in the positive number from a 0 to a 1 for example (+3) = 011 and (-3) = 111

3.2 Ones Complement

1's complement is a method of storing negative values. A ones complement operation is performed by converting all the ones in the number to zeros and all of the zeros to ones, for example:

(+12)10 = (00001100)2

(-12)10 = (11110011)2

3.3 Twos complement

This is another way of storing negative numbers in the computer. The twos complement operation in a number is formed in a similar way to the ones complement, that is complement all the bits in the number but then add a 1 to the least significant bit (LSB).

If the addition results in a carry from the most significant bit (MSB) of the number , discard the carryout.

For example:

(+3) = 011

(-3) = 100 –ones complement +1 = 101 – twos complement.

Another way of generating a 2's complement number is to start at the least significant bit, and copy down all the 0's till the first 1 is reached. Copy down the first 1,and then invert all the remaining bits

Example:

Dec No Binary value 1’s complement value 2’s complement value

7 0000111 11111000 11111001

32 0010000 11011111 11100000 Table of Complements Binary 1’s complement 2’s complement Unsigned 0111 7 7 7 0110 6 6 6 0101 5 5 5 0100 4 4 4 0011 3 3 3 0010 2 2 2 0001 1 1 1 0000 0 0 0 1111 -0 -1 15 1110 -1 -2 14 1101 -2 -3 13 1100 -3 -4 12 1011 -4 -5 11 1010 -5 -6 10 1001 -6 -7 9 1000 -7 -8 8

Observations to be made on this table are that in the case of 1’s complement there are

two representations of zero (0),and also note that when given positive and negative

numbers , the positive numbers do no change both in the 1’s and 2’s complements.

3.4 Excess Representation

Excess representation is also called biased representation. The numbers are treated as

unsigned. A number is represented as the sum of its twos complement and another

number which is known as the “excess” for example when the excess number is four

(excess-4) then add the twos complement of the number you want to represent in

excess-4 to 4, for example to represent +2 into excess-4, add twos complement to 4;

that is, 010 + 100 = 110 Table of excess-4 Decimal Unsigned Signed 1’scomplement 2’s complement Excess- 4 3 011 011 011 011 111 2 010 010 010 010 110 1 001 001 001 001 101 0 0 0 0 0 0 -1 ------2 - 110 101 110 010 -3 - 111 100 101 001

The easiest method to represent a number in its excess form is to add the given

(original) number to the excess number and then creating the unsigned binary version.

For example consider representing (+12) 10 and (-12) 10 in an eight-bit format using an

excess code 128 representation. Excess 128 number is formed by adding 128 to the

original number and then creating the unsigned binary version.

Example:

(+12) 10 = (128 + 12 = 140) 10

140 = (10001100) 2

For (-12) 10 = (128 – 12 = 116) 10

11610 = (01110100) 2

There is however no numerical significance of the excess value , only that it has the

effect of shifting the representation of the two’s complement numbers.

The excess value is chosen to have the same bit pattern as the largest negative

number. The advantage of excess representation is that it simplifies making

comparisons between numbers. 3.5 Gray Code

This is a variable weighted code and is cyclic. This means that it is arranged so that

every transition from one value to the next value involves only one bit change.

The Gray code is sometimes referred to as reflected binary, because the first eight

values compare with those of the last 8 values, but in reverse order.

Decimal Binary Gray 0 0000 0000 1 0001 0001 2 0010 0011 3 0011 0010 4 0100 0110 5 0101 0111 6 0110 0101 7 0111 0100 8 1000 1100 9 1001 1101 10 1010 1111 11 1011 1110 12 1100 1010 13 1101 1011 14 1110 1001 15 1111 1000

The Gray code is important as it is often used in mechanical applications such as shaft

encoders. 3.6 Converting a number in Gray to Binary

To convert a number given in Gray code to binary one needs to know modulo-2 arithmetic.

Modulo-2 arithmetic operates as follows:

0+0 = 0

0+1 =1

1+1= 0

There are no carries entertained.

Steps for converting Gray to binary

1. Write down the number in Gray code

2. The most significant bit of the binary number is the most significant bit of the

Gray code

3. Add (using modulo 2) the next significant bit of the binary number to the next

significant bit of the Gray coded number to obtain the next binary bit

4. Repeat step 3 until all bits of the Gray coded number have been added

The resultant number is the binary equivalent of the Gray number

Example:

Convert 1101101 in Gray code to binary

Gray Binary 1. 1101101 2. 1101101 1 copy down the MSB

3. 1101101 10 1 modulo2 1 = 0

4. 1101101 100 0 modulo2 0 = 0

3/4 1101101 1001 0 modulo2 1 = 1

3/4 1101101 10010 1 modulo2 1 = 0

3/4 1101101 100100 0 modulo2 0 = 0

3/4 1101101 1001001 0 modulo2 1 = 1

Answer is 1001001 Steps for converting Binary to Gray

Write down the number in binary code

1. The most significant bit of the Gray number is the most significant bit of the

binary code

2. Add (using modulo 2) the next significant bit of the binary number to the next

significant bit of the binary number to obtain the next Gray coded bit

3. Repeat step 3 till all bits of the binary coded number have been added modulo 2 4. The resultant number is the Gray coded equivalent of the binary number

Example:

Convert 1001001 in binary code to Gray code

Binary Gray

1. 1001001

2. 1001001 1 copy down the MSB

3. 1001001 11 1 modulo2 0 = 1

4. 1001001 110 0 modulo2 0 = 0

3/4 1001001 1101 0 modulo2 1 = 1

3/4 1001001 11011 1 modulo2 0 = 1

3/4 1001001 110110 0 modulo2 0 = 0

3/4 1001001 1101101 0 modulo2 1 = 1

Answer is 1101101 3.7 Excess 3 Gray Code

In many applications, it is desirable to have a code that is BCD as well as unit

distance. A unit distance code derives its name from the fact that there is only one bit

change between two consecutive numbers. The excess 3 Gray code is such a code, the

values for zero and nine differ in only 1 bit, and so do all values for successive

numbers. Outputs from linear devices or angular encoders may be coded in excess 3

Gray code to obtain multi-digit BCD numbers.

Table showing the Excess-3 Gray code

Decimal Excess-3 Gray Code 0 0010 1 0110 2 0111 3 0101 4 0100 5 1100 6 1101 7 1111 8 1110 9 1010

3.8 Range and Precision in Floating Point Numbers

One of the advantages of floating point representation is that this format allows a

large range of expressible numbers to be represented in a smaller number of digits by

separating the digits used for precision from those digits used for range. Example of base 10 floating-point number: +6.023 x 1023

 The range is represented by power f ten that is, 1023.

 The digits in the fixed-point number 6.023 represent precision

 + (Sign), 23 (exponent), 6.023 (Significant)

The potential problem with representing floating numbers is that the same number can be represented in different ways which makes comparisons and arithmetic operations difficult, for example 3584.101 = 3.584 x 103 = .3584 x 104.

To avoid these multiple representations of the same number, the number must be normalised by shifting the radix point to the left or to the right and the exponent must be adjusted accordingly, until the radix point is to the left of the leftmost non-zero digit. So the number .3584 x 104 is a normalised one.

3.9 Representing floating point numbers in the computer.

A simple floating-point format to illustrate the important factors in representing floating point numbers in the computer may have the form shown below: sign bit, three bit exponent , .implied radix point , three base 16 digits

The significant is signed; the three hexadecimal digits are for the magnitude.

The exponent is a 3-bit excess 4 number with radix of 16. The bits will be packed as follows:

Sign bit on the left, followed by a three bit exponent, followed by three hexadecimal digits of the significant.

Example: Convert (358) 10 to the format given above.

Step 1: Convert the fixed point number from its original base into a fixed point number in the target base.. We will use the remainder theorem.

Original base Integer Remainder

358/16 22 6 LSB

22/16 1 6

1/16 0 1 MSB

So (358) 10 = (166) 16

Step 2: Convert the fixed-point number to floating point number

0 (166) 16 = (166.) 16 x 16

Step 3: Normalise the number, for example

0 3 (166.) 16 x 16 = (.166) 16 x 16

Step 4: write the bit fields of the number. The number is positive so in the sign bit position write a zero(0). The exponent is 3 but should be represented as excess-4, so the bit pattern for the exponent is calculated as follows;

011(+3)10

Exceaa-4 = 011+100 = 111

Step 5: Each of the base 16 digits is represented in binary as 1=0001, 6= 0110 and another 6 = 0110.

0 111 0001 0110 0110

+(sign) (exponent) (1) (6) (6)

The bit pattern is stored in the computer’s memory as 0111000101100110 Example:

Convert (9.375 x10-2) to base 2 scientific notation

Step 1: Convert from base 10 floating point to base 10 fixed point by moving the decimal point two places to the left.

Step 2: Convert from base 10 fixed point to base 2 fixed point using the multiplication method.

Step 3: Convert to normalised base 2 floating point

We follow all the steps to solve the problem

9.375 x 10-2 = .09375

.09375 x 2 = 0.1875

.1875 x 2 = 0.375

.375 x 2 = 0.75

75 x 2 = 1.5

5 x 2 = 1.0

(.09375) 10 = (.00011) 2

.00011 = .00011x 20

= 1.1 x 2-4

(.00011) . 4 BINARY CODED DECIMAL

In this code numbers can be represented in base 10 system while still using

binary encoding. Each base 10 digit occupies four bit positions which is known

as Binary Coded Decimal (BCD). Each digit can take on any of the 10 values.

There are 24 = 16 possible bit patterns for each base 10 digit and as a result six bit

patterns are unused for each digit. (see example below)

Decimal

Digit 0 1 2 3 4 5 6 7 8 9

BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

The BCD format is commonly used in calculators and business applications. There are fewer problems in representing terminating base 10 fractions in this format as opposed to base 2 representation. There is no need to convert data that is given at input in base 10 form as (used in calculators) into an internal base 2 representation.

4.1 Representing signed numbers in BCD

Signed BCD numbers are represented in the computer using:

(i) Nines and Tens complement

(ii) Nines’ complement

(iii)Tens complement 4.2 NINES AND TENS COMPLEMENT

In the nines complement number system, positive numbers are represented as ordinary

BCD numbers but the leftmost digit(sign digit) is less than five (5) for positive numbers and five or greater for negative numbers.

Example:

(+301) 10 0000 0011 0000 0001

(0)10 (3)10 (0) (1)

(Nines and Tens complement)

4.2.1 Nines complement (Negative)

Subtracting each digit from nine forms the nines complement negative, for example

9 – 0 = 9; 9 – 3 = 6; 9 – 0 = 9; 9 – 1 = 8.

(-301) 10 1001 0110 1001 1000

(9) 10 (6) 10 (9) 10 (8)10

Nines complement (negative)

4.2.2 Tens complement (Negative)

The tens complement negative is formed by adding a 1(one) to the nines complement negative.

For example:

(-301) 10 = 9698 + 1 = 9699 = 1001 0110 1001 1001

(9) 10 (6) 10 (9) 10 (9) 10

5 COMPUTER CODES

Character Codes – these are: ASCII, EBCDIC, UNICODE.

5.1 ASCII (American Standard Code for Information Interchange)

-Is a standard seven-bit code that was proposed 1963, and finalized in 1968. ASCII

was established to achieve compatibility between various types of data processing equipment. ASCII, pronounced "ask-key", is the common code for microcomputer equipment. The standard ASCII character set consists of 128 decimal numbers ranging from zero through 127 assigned to letters, numbers, punctuation marks, and the most common special characters. ASCII Character Set also consists of 128 decimal numbers and ranges from 128 through 255 representing additional special, mathematical, graphic, and foreign characters. 7 bits represent each character and an eighth bit is used for parity. The parity bit is used to detect the presence of errors during data entry or transmission

Some of the special characters include:

00 NUL Null

01 SOH Start of Heading

02 STX Start of text

03 ETX End of text

04 EOT End of transmission

05 ENQ Enquiry 06 ACK Positive Acknowledgement

07 NAK Negative Acknowledgement

Example of ASCII character set

0 1 2 3 4 5 6 7 8 9 A B C D E F

0 NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI

1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS

2 SP ! " # $ % & ' ( ) * + , - . / 3 0 1 2 3 4 5 6 7 8 9 : ; < = > ? 4 @ A B C D E F G H I J K L M N O 5 P Q R S T U V W X Y Z [ \ ] ^ _ 6 ` a b c d e f g h i j k l m n o 7 p q r s t u v w x y z { | } ~ DEL

All characters in ASCII use Hexadecimal indices, which makes character manipulation simpler.

5.2 EBCDIC – (Extended Binary Coded Decimal Information Code)

-Is an eight-bit character set that was developed by International Business Machines

(IBM). It was the character set used on most computers manufactured by IBM prior to

1981. EBCDIC is not used on the IBM PC and all subsequent "PC clones". These computer systems use ASCII as the primary character and symbol coding system.

EBCDIC is widely considered to be an obsolete coding system, but is still used in some equipment, mainly in order to allow for continued use of software written many years ago that expects an EBCDIC communication environment. Example of EBCDIC special characters

SOH Start of Heading

STX Start of Text

EXT End of Text

PF Punch Off

HT Horizontal Tab

LC Lower Case

DEL Delete

SMM Start of Manual Message

VT Vertical Tab

FF Form Feed

CR Carriage Return

SO Shift Out

SI Shift In

DLE Data Link Escape

Most of the characters in this set are the same as those used in ASCII except for some special symbols as shown above. 5.3 UNICODE

The UNICODE was developed to support characters that are outside the historical dominant (Latin) character sets used in computers. Remember ASCII and EBCDIC codes support the Latin character sets. The UNICODE is a universal character standard that supports the a greater number of the world’s character set. The

current version (4.0) of the UNICODE standard version developed by the

UNICODE Consortium assigns a unique identifier to each of 96,382 characters

(increased from 95,156 in version 3.2), covering the scripts of the world’s principal written languages and many mathematical and other symbols. A previous version

(2.1) of the Unicode Standard encompassed 38,887 characters and was adopted as part of the recommendations for HTML 4.0.

Example of Unicode Characters ♀♪א؟ ب ב A a ¥ ¼ Ñ ñ Ą ą IJ ij Ə Ύ δ Δ Љ Щ щ fi ۳ 5 ! ☺ Ẁ Ặ ỳ ₣ ₪ € № ™

The above UNICODE characters cover principal written languages of the Americas,

Europe, the Middle East, Africa, India, Asia and the Pacifica. The UNICODE

STANDARD is a character coding system designed to support the worldwide interchange, processing, and display of the written texts of the diverse languages and technical disciplines of the modern world. In addition, it supports classical and historical texts of many written languages.

6 BOOLEAN ALGEBRA

Boolean algebra is the most fundamental tool necessary to analyse and describe the logic of digital circuits. A Boolean variable A can take only two valuations, a 1 or 0, which have also the logic interpretations True for a 1 and False for a 0 or High for a 1 and Low for a 0, and On for a 1 and Off for a 0. The operations of a Boolean variable are ., + and - , which are interpreted as AND(.), OR(+) and NOT(-). Boolean equations are formed from Boolean variables which are linked by Boolean operators for example:

F  A.B  B(C  D) . The application A.B can be written simply as AB.

6.1 PROPERTIES OF BOOLEAN ALGEBRA

The basic properties of Boolean algebra are:

 Commutative

 Distributive

 Identity

 Complement

These properties are applied to logic expressions (equations) and they are also known as postulates. These postulates are basic axioms of Boolean algebra and need no proofs. Examples:

Relationship Dual Property

AB = BA A+B = B+A Commutative

A(B+C) = AB+AC A+BC =(A+B)(A+C) Distributive

1.A = A 0+A=A Identity

A.A  0 A  A  1 Complement

All Boolean algebra theorems can be proved using postulates. The dual form is obtained by changing ANDs to ORs and vice-versa.

The commutative property sates that: The order that two Boolean variables appear in an AND or OR function is not significant, that is (AB=BA), (A+B) = (B+A).

The distributive property shows how a variable is distributed over an expression with which it is ANDEd for example A(B+C) = AB+AC or A+BC= (A+B)(A+C).

The identity property staes that a variable that is ANDEd with a 1 or is ORed with a

0 produces the original variable that is 1.A = A or 0 + A = A.

The complement is derived from the involution theorem whish states that the complement of a complement leaves the original variable unchanged.

6.2 DE MORGAN’S THEOREM

This theorem has the most significance in that it is a technique for substuting AND operators for OR operators and vice-versa. For example the logic function A+B when subjected to De Morgan theorem forms the equality: A  B  AB and also that: XYZ  X  Y  Z

Summary of Relationships in Boolean algebra

T1 (a) A+B = B+A

(b) A.B = B.A

T2 (a) (A+B)+C = A+(B+C)

(b) (A.B). C = A. (B.C)

T3 (a) A. (B+C) = A.B+A.C

(b) (A+B). (A+C) = A+B.C

T4 (a) A+A=A

(b) A.A = A

T5 (a) A  A

(b) A  A

T6 (a) A+A.B = A

(b) A. (A+B) =A

T7 (a) 0+A = A

(b) 1+A =1

(c) 1.A = A

(d) 0.A = 0

T8 (a) A  A  1

(b) A.A  0

T9 (a) A  A.B  A  B (b) A.(A  B)  A.B

7 LOGIC GATES

A logic gate is a physical device that implements a simple Boolean function. The

Logic gates form the hardware basis on which digital computers are built. Logic gates are also called logic circuits. The elementary (basic) logic gates are:

NOT, BUFFER, OR, AND, NOR, NAND, EXCLUSIVE OR (XOR) and

Exclusive NOR (XNOR).

7.1 NOT Logic gate

- is also called an INVERTER and it produces a 1 at its output for a zero (0) input that is, the output is always the opposite or complement of the input.

Symbol

F

Truth Table

X Y

0 1

1 0 BUFFER

A buffer simply copies its input to its output. A buffer has no logical significance, but it serves an important practical role as an amplifier, that is it allows a number of logical gates to be driven by a single signal.

Symbol

X F

Truth table

X F

0 0

1 1

7.2 The OR Logic Gate

The basic OR gate works with two inputs and 1 output. The output of the OR gate is true

(logical 1) when either one or both inputs are logical ones (1s) and is false otherwise (0)

Symbol

F

Truth Table X Y F 0 0 0

0 1 1

1 0 1

1 1 1

Note that the output value is 1 when at least one input value is 1

7.3 The AND logic gate

A basic AND logic gate operates with two inputs and one output. The output of an

AND gate is a logical 1, only and only when both of its inputs are logical 1s and is false otherwise

Symbol

F

Truth Table

X Y F

0 0 0

0 1 0

1 0 0

1 1 1

Note that the output is 1 only when both inputs are 1 7.4 The NOR logic gate

The NOR gate is formed by connecting an INVERTER (NOT gate) at the output of an

OR gate. This gate produces complementary outputs to the OR gate.

Symbol

F

Truth Table

X Y F

0 0 1

0 1 0

1 0 0

1 1 0

7.5 The NAND logic gate

The NAND logic gate is formed by connecting a NOT gate at the output of an AND gate and this gate produces complementary outputs to the AND gate. Symbol

F

Truth Table

X Y F

0 0 1

0 1 1

1 0 1

1 1 0

7.6 The EXclusive OR (XOR) logic gate

Exclusive OR (XOR) logic gate produces a logical 1 at its output when either one of its input is a 1, excluding cases when both inputs are logical 1s and logical

0s(zeros).

Symbol

F

Truth Table

X Y F

0 0 0 0 1 1

1 0 1

1 1 0

Note that when both inputs are 1s the output is a 0.

7.7 EXclusive NOR (XNOR) logic gate

This logic gate is formed by connecting an INVERTER to the Exclusive OR gate and it produces outputs that are complementary to those of the Exclusive OR gate.

Symbol

X F Y

Truth Table

X Y F

0 0 1

0 1 0

1 0 0

1 1 1

8 KARNAUGH MAPS

Karnaugh maps are a very effective way of minimizing/reducing/simplifying Boolean functions/expressions/equations.

The Karnaugh maps are a variation of the truth tables. Because all Boolean functions/ logic functions convert to logic circuits in a computer, any reduction of the functions

will result in the following:

 Hardware cost savings

 Reduced propagation delays

 Simplification of the circuits

 High productivity

The basic concept behind Karnaugh maps is to reduce a function such as:

F  AB  AB  A(B  B)  A , by utilising the relationship/postulate (B  B)  1.

The Karnaugh map works best with two, three, four, five and six variables, but becomes clumsy, complex and almost impossible to use with seven or more variables.

8.1 One variable Karnaugh map

A one variable Karnaugh map has two possible states, for example if a variable is designated by symbol A, then A can take the logical symbol 1 (A = 1) or value 0

(A  1) . The single variable map contains two equal divisions known as cells. One half represents state A and the other half state A 8.2 Two variable Karnaugh map

The two variable map has four possible states and each variable is represented by half the total number of cells (see example below). The cells are represented by numbers, which can be used to quicken the process of minimization , for example 00 is (0), 01 is 1, 10 is 2 and 11 is 3.

A 0 1 B AB AB (00) (10)

AB AB (01) (11)

8.3 The three variable Karnaugh map

The three variable Karnaugh map has 23 possible combinations of the input variables and each variable occupies exactly half the total number of cells.

Example:

AB 00 01 11 10 C

0 ABC ABC ABC ABC (000) (010) (110) (100)

ABC ABC ABC ABC 1 (001) (011) (111) (101)

The cells are represented by numbers, for example (000) is 0, (001) is , (010) is 2, (011) is 3, (100) is 4, (101) is 5, (110) is 6 and (111) is 7. This numbering quicken the process of inserting the ones(1s) in cells during minimisation of Boolean functions.

8.4 The Four variable Karnaugh map

The four variable Karnaugh map has 24 possible input combinations and each variable occupies exactly half the total number of cells in the whole map.

Example:

AB 00 01 11 10 CD 00 0000 0100 1100 1000 (0) (4) (12) (8) (1) (5) (13) (9) 01 0001 0101 1101 1001

11 0011 0111 1111 1011 (3) (7) (15) (11) (2) (6) (14) (10) 10 0010 0110 1110 1010

Note that each cell can be represented by a decimal or a hexadecimal number.

When using the hexadecimal encoding , 10 is replaced by an A, 11 by a B, 12 by a

C, 13 by a D, 14 by an E and 15 by an F.

8.5 Karnaugh Maps Rules for Boolean Functions Simplification

The Karnaugh map uses the following rules for the simplification of expressions by grouping together adjacent cells containing 1s.  Groups may not include any cell containing a zero

So the function on the right reduces to: F = B

 Groups may be horizontal or vertical, but not diagonal.

The above function reduces to: F = A+B

 Groups must contain 1, 2, 4, 8, or in general 2n cells.

That is if n = 1, a group will contain two 1's since 21 = 2.

If n = 2, a group will contain four 1's since 22 = 4.

 Each group should be as large as possible.

Although no Boolean rules have been broken on the right three variable map, it can still be reduced to F  C  AC , the equivalent of the correct groupings.

 Each cell containing a one (1) must be in at least one group.

 Groups may overlap.

 Groups may wrap around the table. The leftmost cell in a row may be grouped with the rightmost cell and the top cell in a column may be grouped with the bottom cell.

 There should be as few groups as possible, as long as this does not contradict any of the previous rules.

The function on the left above reduces to :

F  C  A . Note that the map on the right (wrong) is wrong because the groupings do not produce the minimal result as it can still be reduced to : F  C  A

EXAMPLES OF MINIMISING FOUR VARIABLE MAPS

DC BA 00 01 11 10 1 00 1 0 0 1 1 01 0 1 0 1

11 1 1 0 0 1 1 1 1 10 1 1 11 0 0 1

F  BD  ACD  1B D C  ADC 1

DC BA 00 01 11 10

00 1 11 11 0 1

01 1 0 0 1 1 1 11 1 1 1 0 0 1 10 1 0 0 0

F  DC  BC  BAD  BAD

DC BA 00 01 11 10 1 00 1 11 0 1 1 01 1 1 0 1 1 11 11 11 0 0

1 10 0 1 0 0

F  DC  BC  AD

DC BA 00 01 11 10 1 00 1 0 0 1 1 01 0 0 0 1 11 1 0 0 0 1 10 1 1 0 0

 F  DCB  BDC  BAD  BAC  BADC

8.6 WORKING WITH DON’T CARE CONDITIONS

There are two cases when don’t care conditions can arise.

The first case is when the designer does not care what the output will provide. This can be illustrated by an example of the S, R flip-flop truth table below.

S R Q Q

0 0 0 1 0 1 0 1

The two conditions R = 0, R=1 are collectively called a don’t care condition because in each case the result at the outputs are the same. So this means that it does not matter whether R=1 or R= 0, as long as S = 0 the outputs at the Q and Q remain the same, so the designer has the liberty to use what is at his/her disposal or what is less expensive.

The other simple example is when designing say a machine to report the voting outcome when 4 people vote. Two binary outputs are used. If one output is assigned to a indicate a tie then we don’t care what the YES/NO output shows when there is a tie.

The second case is when the inputs will never occur as is the case with a binary coded decimal to seven-segment decoder, where we only use the inputs from 0 to 9 and the other six states remain unused.

When using don’t care conditions in Karnaugh maps the minimum requirement is that the number of don’t care conditions in a group must be equal to the number of 1s.

However a group may contains more ones than don’t care conditions.

Examples of using don’t care conditions with four variable Karnaugh maps

In all the examples the xs indicate don’t care conditions and all the rules for simplification of Boolean functions apply. DC BA 00 01 11 10

00 1 0 x 11

01 0 1 x 1

11 1 1 x x x

10 1 1 x x 1 1 x x

F  B  AC  AC  BD

DC BA 00 01 11 10 1 1 x 1 00 1 1 x 1

01 1 0 x 1 1 1 x x 11 1 1 x x

10 1 0 x x

F  C  BA  BA

DC BA 00 01 11 10 1 1 x 1 00 1 1 1 x x 11 1 1 x 1 01 1 1 x 1 1 1 1 1 xx x 11 1 11 x 1 x xx x 1 x 10 0 1 1 x x x 1 1 F  A  C  B

DC BA 00 01 11 10

00 1 0 xx 11

01 0 0 x 1

11 1 0 x x 1 1 x x 10 x1 1 x xx

F  BC  BA  BD  AC 9 COMBINATIONAL AND SEQUENTIAL CIRCUITS

(Implementation of logic gates)

A combinational circuit is a logic circuit, whose output entirely depends on the inputs, that is the output is always a function of the inputs. The circuit has no storage capabilities (see block diagram below)

Combinational circuits can be used to build devices for solving problems of simple

logic nature

The array of outputs Yo – Yn entirely depend on the array of inputs Xo- Xn.

Combinational circuits can be used to build devices for solving problems of simple logic nature.

The typical examples of combinational logic circuits are logic gates, half adders, full adders, multiplexers, decoders, etc.

9.1 ADDERS

Adders are logic circuits that are used for addition operations in digital computers.

A half adder can compute the sum of two inputs and a carry to the left. It is only good for 1 bit additions.

Circuit Symbol

Truth Table

Carry(C) Sum(S) B A

0 0 0 0

0 1 0 1

0 1 1 0

1 0 1 1

From the truth table above, we derive the Boolean logic equations used to construct the circuit. These are: SUM  AB  AB  A  B and Carry  AB . 9.2 FULL ADDER

Full adder was developed to overcome the limitations of the half adder, that is , its in ability to handle a carry into position from the right. The full adder is built on two half adders(circuit diagram below)

Truth Table

9.2.1.1 Carry Out(C) Sum( S) Carry in(Cin) B A

0 0 0 0 0

0 1 0 0 1

0 1 0 1 0

1 0 0 1 1

0 1 1 0 0

1 0 1 0 1 1 0 1 1 0

1 1 1 1 1

From the truth table, we derive the logic equations for building the full adder circuit as follows:

S  ABCin  ABC in  ABCin  ABCin

SUM  A(BCin  BC in)  A(BC in  BCin)

SUM  A(B  Cin)  A(B  Cin)

SUM  A  B  Cin

COUT  ABCin  ABCin  ABCin  ABCin

COUT  ABC in  ABCin  ABCin  ABCin

COUT  B(C in  Cin)  Cin(AB  AB)

COUT  AB  Cin(A  B) 9.3 REDUCTION OF COMBINATIONAL CIRCUITS

In many cases the sum of products or product of sums forms of Boolean equations is not the minimal in terms of their number and size. Smaller Boolean equations translate to a lower gate input counts in the target circuits. So the reduction of an equation is an important consideration when circuit complexity is an issue.

We have already looked at the Karnaugh map method of minimising Boolean equation and the benefits derived from its use. We will look at the algebraic method by way of an example.

Consider the Boolean equation:

F  A˙ BC  ABC  ABC  ABC . The properties of Boolean algebra can be used to reduce the equation.

F  ABC  ABC  AB(C  C) Distributive property (1)

F  ABC  ABC  AB(1) Complement property (2)

F  ABC  ABC  AB Identity property (3)

We can reduce equation 3 by introducing the property Idempotence and re- introducing ABC, for example:

F  ABC  ABC  AB  ABC Idempotence (4)

F  ABC  AC(B  B)  AB Distributive (5)

F  ABC  AC  AB Identity (6) We can also re-introduce ABC to equation 6, for example

F  ABC  AC  AB  ABC Idempotence (7)

F  BC(A  A)  AC  AB Distributive (8)

F  BC  AC  AB Identity (9)

From the above equation, it is clear to see that the, the original equation is not minimal and has four AND gates, three OR gates and three NOT gates. The total number of gates is ten (10).

Equation 9, which is the minimal form of the original equation, has three AND gates and one OR gate. The total number of gates is five( 5). This means that the total number of logic gates has been reduced by five(half). This simplifies the circuit, save components costs and also reduces propagation delays.

Example 1:

Express the Boolean equation below in its minimal form

S  ABC  ABC  ABC  ABC

S  A(BC  BC )  A(BC  BC _

S  A(B  C)  A(B  C )

S  A  B  C

Example 2:

Show that:

(A  B  AB)(A  C  AC)  A  BC

A  B can be written as AB  AB

AB  AB  AB AB  B(A  A)

AB  B(1) Complement property

AB  B)  A  B This is by absorption

Since the second expression in parenthesis is the same as the first expression it follows that:

A  C  AC = A + C

(A+B)(A+C) = A + BC 9.4 DECODER

A decoder is a logic circuit that translates a logical encoding into a spatial location. At any given time exactly one output of a decoder is high(logical 1) and is determined by the settings on the control inputs.

A decoder is used to control other circuits and at times it may be inappropriate to enable any of the other circuits. For that reason an enable line is added to the decoder, which forces all outputs to 0 if a zero is applied to its input. IN is the enable

line. When IN = 1, the circuit is active and when N=0, the whole circuit is inhibited.

The other important application of a decoder is to translate memory addresses into physical locations.

A 3 to 8 decoder This circuit will selects one output at any given time and this depends on the input combinations.

Outputs D0 to D7 can be specified by Boolean equations, for example,

D0  ABC D1  ABC D2  ABC D3  A˙ BC D4  ABC D5  ABC D6  ABC D7  ABC 9.5 MULTIPLEXER (MUX)

A multiplexer is a component/device/logic circuit that a connects a number of inputs to a single output.(see circuit diagram below)

The output F takes on the value of the data input that is selected by control lines S1 and S2. If S1S2 = 00, the value on line D0 ( either a one(1)or a zero(0) will appear

at F and the output at F at any given time is given by the Boolean logic equation:

F  S1S 2D0  S1S2D1 S1S 2D2  S1S2D3 9.6 DE MULTIPLEXER (DEMUX)

A DEMUX is the converse of a MUX. It has one data input and any outputs. Data can be transferred from this single input to one of its many outputs. The application of

DEMUX is to send data from a single source to one of a number of destinations.

The circuit above can still be used as a De Multiplexer/Decoder.

IN is used as the single data input and will send data to one of the many outputs,

that is, OUT0 TO OUT3.