 Assalamu alaikum students, I am Wasimi Kram. This is the fifth lecture in a series of 45 lectures on digital logic design. How are you today? I hope you have been keeping well. But before that, let us have a look at the material which we covered in the last lecture. In the last lecture, we looked at the octal number system, which is in fact a base 8 number system. It gives you 8 different values. We said when you write long strings of binary numbers, then you could generate an error. So to represent long strings of binary numbers, you use the octal representation. While the hexadecimal number system is present, the octal number system is not frequently used. But still, since we are studying different number systems, so octal is again an important number system. We talked about converting from binary to octal, octal to binary, then octal to decimal, decimal to octal. Standard methods are used, divide by 8, sum of 8 methods are used. Next, we talked about alternate representations. First, we did 4 representations, twos complement, unsigned, unsigned, magnitude, floating point. In addition, there are some representations which are being used in special applications. We talked about the access code. Where is the main use of the access code? We used it in the floating point representation. We also talked about the BCD code. BCD code we said was the binary coded decimal. When we need to display decimal numbers or write decimal numbers, we generate a binary code to represent those decimal digits 0 to 9. So, we have to use a 4-bit binary code which has 10 different values to represent numbers 0 to 9 of course. Gray code we said is not a positional code. Gray code we said is not a positional based code. The important thing about gray code is that when you count, let us say 4, 3, 4, 5, successive numbers, the number of bits that change is limited to 1. We saw an application of that. You have a motor, a rotating machine. You have to know at what angle it is. So, you attach a disk to it through gray code. So, when the machine rotates, you would get to see different numbers and those numbers would represent the actual position in terms of angles. We also talked about alpha numerical codes. Alpha numerical code is because when you write a text, you have characters in it. A, B, C, D, small A, B, C, D, punctuation marks, numbers are also there. Even though we have discussed all the codes, they all deal with positive, negative numbers, fractions and of course, integers. So, ASCII code is a 7-bit code which gives you up to 128 unique symbols. Every symbol has a binary 7-bit representation which you are storing in a digital system and using it. We talked about an extended version of the ASCII code which is an 8-bit ASCII code. 8-bit ASCII code allows you up to 256 different characters or unique codes. If you want unique characters, then you have another code, the unique code. This means 16-bit representation here. So, you can represent up to 64,000 characters. The last two topics which we discussed was the detection of errors using the parity bit. So, we said one way of detecting an error is to use the odd parity. The other way is to use the even parity. So, both the methods are very similar. When you detect an error, you cannot correct it. That is another subject. Up till now, we have been talking about numbers or characters which we represent in terms of binary digits or bets. Now, the important question is, how do we process all this information? The digital systems which need this information, how do we use it? Well, in the first lecture, we mentioned that digital systems are based on basically digital circuits and the building block is the logic gate. So, logic gate is the most important component or the smallest component which can be combined with other logic gates to form a digital circuit. So, today we would be talking about logic gates. Now, before we move on and discuss about logic gates, let us discuss an example. A motorcycle. Before using a motorcycle, you should know about it. For example, how many liters of fuel does it require? What is its maximum speed? How frequently should you service the motorcycle? How many, how much load can it carry? There are three or two motorcycles in it. Now, if you meet or fulfill all the specifications, then of course, you would be able to use the motorcycle for a longer duration of time. If you are misusing it, it will get spoiled quickly. Now, in electronic terms, each component which you use in an electric circuit has its specifications and characteristics. So, each component has to be used based on those characteristics. For example, you have a transistor. There are three pins in it. So, before you can use the transistor, you should know what it does. You should also know what are the input voltages and what are the output voltages? Another important criteria is its gain. What is the output voltage? Frequency response. There are different characteristics which you have to study. Now, when you implement an electric circuit, how would you describe it to somebody? Well, to describe an electric circuit which you have implemented, you draw a circuit diagram. It's like the architecture, the architect who draws your house plan. When you make a house, the architect will first make a whole map. He will indicate where the doors are, where the windows are, where the room is, where the kitchen is. Similarly, when you implement a digital circuit, you have to draw a circuit diagram. What would be the circuit diagram? Connections. Which components are connected to which? The components themselves. For example, if you are using a transistor, which transistor? How would you describe a transistor in a circuit diagram? It has a unique symbol. What is its symbol? It's a zigzag line. What is the capacitor? You can see two horizontal lines. So, these are the symbols of these components. Now, let's turn back to logic gates. Logic gates, we said, are the basic components or the basic building blocks of a digital circuit or a digital system. Now, when you design a digital system and implement it, you need to have its circuit diagram. In the circuit diagram, what do you see? You would be seeing all those gates which are connected to each other. So, each gate would be uniquely represented by a symbol. Now, when you connect all these gates, you also need to know how these gates function. What are their characteristics? So, today we would be looking at all these gates which are used in digital logic design or digital circuits. And the issues which we would be looking at would, of course, be the symbols. We would describe a gate and a gate. What are the symbols? What else? What is the other important information which you need to know about a gate? How does it work? What is its function? What are its inputs and outputs? Now, you have to tell someone about a gate. So, how would you convey that information? Well, one way is to draw out a table. In the table, you will write the inputs and the corresponding output values. So, one way of describing the function of a logic gate is through a truth table or a function table where you list all the inputs and the corresponding output values. Another way of describing the function of a logic gate would be by writing a mathematical expression or a formula. So, two ways of describing the function of a logic gate. The other important issue which we need to know about a logic gate is its performance for a certain period of time. Now, when you connect a logic gate in a circuit diagram, you would be continuously applying signals to its input. So, for example, let us suppose an AND gate which is used for 10 seconds. For 10 seconds, you would be wearing the inputs. So, of course, for the 10 second time period, you would be getting either different outputs or the same outputs. So, you need to convey that information as well. So, how would you convey that information that how a gate works during that 10 second interval through a timing diagram? So, when we describe an AND gate or any other gate, we would be describing or we would be identifying the gate through its symbol. We would be describing its function through a truth table or a function table. We can also write an expression which represents the operation or the function of the gate. And we would also be describing or writing out its timing diagram. So, now let us look at the different gates which are used in digital logic circuits. Basically, there are three gates which are used, the AND gate, the OR gate and the inverter. Let us start by looking at the AND gate. Now, an AND gate is represented by a symbol which is a closed U lying on its side. You will see the exact diagram of the symbol which represents the AND gate. An AND gate can have a number of inputs, but it has to be more than one. So, it could be a two-input AND gate, three-input, four-input, multiple-inputs can be there. And a AND gate always has a single output. So, if you see the symbol of a two-input AND gate, you would see two lines which represent the two inputs and one line at the other end or towards the curved end of the U which indicates the output of the AND gate. So, this is the symbol. If it is a three-input AND gate, you would see three lines at the input indicating the three different inputs. So, multiple input AND gates would have multiple lines at the input AND. Now, how would you describe the operation of this AND gate? We said we would be using a truth table or a function table. Let us consider the example of a two-input AND gate. So, look, you could apply both zeros at both inputs or a combination of zero and one or one zero or one one. So, four possible combinations are applied at the input of a two-input AND gate. What is the output for each of these four combinations? If there is zero-zero input, the output is zero. If there is zero-one input, the output is again zero. If there is one-zero input, the output is again zero. Only for the inputs one-one, the output is one. What is the function that is being implemented? If you remember, when we talked about binary multiplication, this is exactly what was happening in binary multiplication. When we multiplied two single binary bits, then when both the bits were ones, only then the answer was a one. For all other combinations, the answer was zero. So, if you say that you implement multiplication for binary numbers, you can use an AND gate. It implements the multiply function. Now, how would you represent the operation or the function of this AND gate in terms of an equation? Well, let us consider that f indicates the output of the AND gate and a input a and b indicates the two inputs of the AND gate. So, the equation would be or the function representing the operation of the AND gate would be f equals to a dot b. The dot is the AND operator. Now, if the AND gate is a multiple input AND gate, let us suppose four inputs a, b, c and d. So, how would you write its expression? It would be f equals to a dot b dot c dot d. What would be the function table of the AND gate? Well, it would have four inputs or four input columns a, b, c, d and a single output column f. How many possible combinations are there? Remember, four-bit input. So, if you use a four-bit input binary number, you can get 16 different combinations. So, in 16 different input combinations, what would be the 16 different outputs? Well, for all cases except for the case where the inputs are all ones, the output would be zero. So, once again, if your input is all ones, the output would be one. For all other cases, the output would be zero. So, this satisfies the function, the expression which we had written or multiply function which satisfies that as well. Now, let us look at the timing diagram. Let us suppose you connect this two input AND gate and you apply different inputs for, let us say, a time period of 10 seconds. Inputs vary, enhancement. So, what do you get at the output? You would get 10 different outputs or perhaps the same output. It depends on the input values. So, let us have a look at a slide which shows the timing diagram of an AND gate. The combination of ones and zeros applied at the A input of the AND gate is represented by the timing diagram, the timing shape A. The combination of zeros and ones applied at the B input of the AND gate is shown by the wave shape B. Now, both these inputs vary over a time period of seven time intervals, T0 to T6. Now, let us have a look at the output. Now, in the time interval T0, the input A and B both are logic one. So, what is the output? Well, considering the function table, the output has to be A1. Consider the time interval T1. The input A is zero. The input B is one. So, what should be the output? It should be zero. Similarly, at time interval T2, the input A is one. The input B is zero. The output is again zero. At time interval T3, both the inputs A and B are logic one. The output should be one as seen in the timing diagram F. At intervals T4, T5 and T6, the output is zero because the inputs have a zero value. The timing diagram which we saw describes the operation of the AND gate for seven time intervals. Well, we can extend this time interval to let us say 100 time intervals or 200 time intervals. The thing which I forgot to tell you, there is an alternate symbol which represents the AND gate. It is a square with one pin at the output which indicates the output and two lines at the input side. Within the square you have an ampersand symbol which basically indicates an AND gate. Now, let us look at the OR gate. The OR gate is represented by a symbol which is similar to a V lying on its side. The V is a closed V, of course. The corner of the V has the output of the OR gate and the other end, the closed end of the V has the inputs. So, like the AND gate, OR gate can be a multiple input OR gate. Of course, inputs have to be more than one. So, the minimum number of inputs have to be two, maximum 10B or 12B. Normally, you have three inputs, OR gate, four inputs, five, six. Now, how does an OR gate function or rather what is the function of an OR gate? Now, that can be described by looking at the function table or the truth table of an OR gate. Let us consider the two input OR gate. Now, how many inputs? Of course, two inputs. So, input A and input B. How many outputs? Of course, OR gates have a single output. So, the output is output F. How many input combinations can we apply to a two input OR gate? Again, it is two raised to power two. So, four different input combinations. What are those input combinations? Well, 00, 01, 10 and 11. Output, what is it? Well, for the combination 00, the output is 0. For the combination 01, the output is A1. For the input combination 10, the output is again A1. For the input combination 11, the output is again 1. So, OR gate's case may, when input, both inputs are 0, only then the output is 0. For all other cases, the output is 1. If you compare this, and if you recall, the binary addition that we did, what was it? Very similar. When we added 1 and 1, we had a sum part which was 0 and a carry part. If you look at the OR gate operation, the OR gate operation is different. It is different from the rest. So, OR gate operation is described as a Boolean addition. Now, what happens if we have a 3-input or a 4-input OR gate? How will that behave? Well, let us consider the example of a 4-input OR gate. So, there will be 4 inputs, A, B, C and D. Output, of course, will be F. Again, how many input combinations can be made? Well, there are 4 bits, 4 inputs. So, 16 different combinations can be made. 2 raised to the power of 4, 16. Now, one output will come for which combinations? Well, if you look at the function table or the truth table for the 2-input OR gate, you would see that, again, if all the 4 inputs are all 0s, only then the output would be 0. For all other combinations, of course, the output would be A1. This OR gate function, one way or the other, we have told you that you are describing the truth table or function table. How will this be written in the expression form? Well, let us again consider the example of the 2-input OR gate. So, the expression would be F equals to A plus B. So, the plus operator indicates the OR operation. This is not the add symbol. The plus sign here indicates the OR operation. The OR gate asset was represented by a closed V lying on its side. An alternate symbolic representation of an OR gate is a square with one line at one end representing the output and some more lines on the other end representing the input. Within the square, you have an equal to greater than sign which represents the OR gate. Now, we would be interested in the timing diagram of an OR gate. That is, if a certain set of inputs, continuous inputs are applied at the input of an OR gate, what would be its output? How would it behave? So, let us have a look at the timing diagram of an OR gate. Let us consider a 2-input OR gate and having inputs A and B. The combination of 1s and 0s is applied at the input A and again another combination of 1s and 0s is applied at the input B. The timing diagram shows both the inputs A and B. The output remains high for the entire time interval that is from T0 to T6. Let us see why. Well, considering the time interval T0, the input is high, logic 1. The input B is high or logic 1. Now, referring to the function table or the truth table for the OR gate, the output should be A1. Considering the time interval T1, the input A is a 0, the input B is a 1. So, what should be the output? If any input is 1, the output has to be A1. Similarly, for time interval T2, the input A is a 1, the input B is a 0. So, what is the output? It should be again 1. If any input is A1, the output has to be A1. Similarly, if you look at intervals T3, T4, T5 and T6, and these 4 intervals, either both the inputs are logic 1 or only a single input is logic 1. For all these 4 cases, the output has to be A1. We just looked at the timing diagram of a 2-input OR gate and we observed the inputs and the outputs for time interval of 7, T0, say like a T6 that. OR gate code OR kinkathane. Well, the English word OR means this or this. So, if you look at the function table, if any input is 1, the output is 1. So, this OR this is A1. This is the AND gate code AND kinkathane. Again, it is the English word AND. That means this AND this should give you the output. So, if both the inputs are 1s, only then you would have the output 1. If any of the inputs is a 0, then of course, the output is not going to be A1. Let us look at the third gate, the inverter gate. The inverter gate is also known as a NOT gate. Symbolically, it is a triangle with a line leading end to the triangle and another line coming out of the corner of the triangle. At the corner or the pointed end of the triangle, you have a bubble, a circle. This symbol represents what? Well, the input applied at the NOT gate is inverted at the output. Now, as you can see from the symbol, a NOT gate has a single input and a single output. This is the only gate which has a single input. The output is of course 1. Let us have a look at the complete function of a NOT gate. So, the function table would have an input column A and output column F. How many combinations can we apply at the input? Since we only have a single input, so you could only apply either a 0 or a binary 1. So, if you apply a 0 at the input of a NOT gate or an inverter gate, what do you get at the output? Basically, 0 is inverted at the output. So, you would get a 1. Now, if you apply a 1 at the input, what do you get at the output? Again, it is inverted. So, you would get a 0 at the output. How will we write this function in the form of an expression? Well, if F is the output, so the expression representing the operation of a NOT gate would be F equals to A bar, A cube per bar. So, in digital logic, whenever you see a bar on top of a letter, that means that particular variable has been inverted. So, A is an input variable. So, bar means, it has been inverted and that is equal to the output F. Now, can you have a multiple input NOT gate? Well, we said no. Inverter or NOT gate ka kaam yeh hai ke ek hi input ko leke invert ka rahe usne. So, it is not possible to have multiple inputs. Output to hota hi ek hai. Now, let us have a look at the timing diagram of an inverter. How would it behave when we apply a set of 0s and 1s at the input of a NOT gate? Since the inverter or the NOT gate has only a single input, so you can only apply a sequence of 0s and 1s at the input A, which is shown in the diagram. The inverter or the NOT gate has a single output, so the output is shown by the timing diagram represented by F. Let us discuss the inputs and outputs during different intervals. At T 0, the input is 1. Since the NOT gate inverts the input, so what should be the output? It should be 0. Similarly, at interval T 1, the input is 0. So, the output should be inverse of this, so it is A 1. Similarly, during intervals T 2 and T 3, the input remains A 1. The output has to be a 0. And similarly for intervals T 4, T 5 and T 6, you can see that the output has been inverted. We have just looked at the timing diagram of a NOT gate. Before we move on any further, let us have a look at the use of these 3 gates, the AND gate, the OR gate and the NOT gate. So, let us have a look at the diagrams. The AND gate can be used to enable or disable a device. Consider a counter. How does a counter count? Well, it is connected to a clock input. So, as the counter receives the clock pulses, it increments its count. So, perhaps it is at the number 1, it receives a clock pulse, it increments to 2, it receives another clock pulse, it increments to number 3 and so on. Now, you can disable the counter by stopping the clock pulse from reaching the counter input. So, how do you do that? You connect an AND gate to the input of the clock input of the counter. Now, the AND gate has the input A and another input B. The clock is connected to input A of the AND gate. And the input B is connected to a switch. If the switch is set to 1, the AND gate would allow the clock pulses to be available at its output. So, the counter would start counting. If the input of AND gate B is disabled or set to 0, what would be the output of the AND gate? It would be 0. So, no matter what the clock is, it is high or low, the output would remain as 0. So, in fact, by setting the input B of the AND gate to 0, you have disabled the output. The output remains as 0 and the counter does not count. Now, let us consider the application of an OR gate. A car has 4 doors. So, an OR gate can be used to sound an alarm if any of the 4 doors is open. Let us have a circuit which generates 5 volts when any door is open. So, let us suppose all the doors are closed. So, the 4 circuits would be generating a 0. If all the outputs of these 4 circuits are connected to the 4 inputs of an OR gate, what would be the output? It would be a 0. Let us suppose the front left door is open. The circuit would generate 5 volts. Now, this is considered to be a logic 1. So, what are the inputs to the OR gate? Well, the 3 inputs would be 0. The single input which is connected to the circuit of the front left door would be 1. What is the output? It is a 1. Now, the output of the OR gate is connected to an alarm. So now, whenever any of the 4 doors or all 4 doors are open, the inputs would be 1s corresponding to the open door. The output would of course be 1 and the alarm would be sounded. Let us consider the application of NOT gate. We talked about calculating the 2s complement of a number. So, how do you calculate the 2s complement? Well, you first calculate the 1s complement. How do you calculate the 1s complement? You basically invert the entire number. So, if the number is 1 1 0 0 1 0 1 0, its 1 complement would be 0 0 1 1 0 1 0 1. So, how do you perform this 1s complement? By using NOT gates. So, how many NOT gates do you require? Since the number is an 8 bit number, so you would require 8 NOT gates. We have just looked at applications of the AND gate, the OR gate and the NOT gate. Now, before we move on, let us look at alternate representations of the AND gate and the OR gate. Symbolically, the AND gate is represented by a closed U lying on its side. The AND gate symbol can also be represented by the OR gate, the closed V symbol. But the inputs have bubbles and the output also has a bubble. So, the general rule is if you need to represent a gate by its alternate symbol, you just select the other symbol. If the AND gate symbol is there, you select the OR gate symbol. The other thing which you need to do is to put bubbles at the inputs and the outputs where there are no inputs. So, if you consider the original AND gate symbol, it does not have bubbles at the inputs or the outputs. So, when you select the alternate symbol, which is the closed V, you would put bubbles at the inputs and the outputs. If we define this symbol, what does it represent? The OR gate symbol indicates this or this. Since a two input AND gate has two bubbles at the inputs, that means zero or zero, what should be the output? The output again has a bubble. So, the output is zero. So, this means this zero or this zero would give you a zero at the output. Now, if you look at the function table of an AND gate, what do you get at the output? Well, if any of the inputs is a zero, the output is a zero. So, this alternate symbol is exactly explaining the same thing. Let us look at the OR gate symbol. The OR gate symbol is of course the closed V lying on its side. The OR gate symbol which represents the OR gate is the AND symbol. The inputs and outputs at the inputs, you put a bubble at the outputs. What does the bubble mean? It means invert. So, let us see what this alternate symbol for an OR gate represents. It means zero AND zero should give you a zero output. Now, if you just remember or you look at the function diagram or the two table of the OR gate, when does one come? If any of the inputs or all inputs are a one. If both inputs are a zero, what do you get? The output is a zero. So, this is what the second symbol represents. We have just looked at the alternate symbolic representations of the AND gate and the OR gate. In the handouts, I have given some examples. So, that would help explain the alternate representations of the AND gate and the OR gate. By the way, the inverter gate can be alternately represented by a bubble not at its output but at the input. So, inverter be doh tarikon se aap represent ka sakte symbolically. Now, let us go back to the gates. We have talked about AND gate OR gate and NOT gate. Let us continue our discussion with the NAND gate. NAND gate basically, again, it has multiple inputs and a single output. The number of inputs has to be more than one and of course, it can be more than 10-12. What does the NAND gate do? Basically, it is a combination of the AND gate and a NOT gate. So, if you connect a NOT gate at the output of an AND gate, that would give you a NAND gate. Let us look at the function table or the truth table of a NAND gate. Let us consider the two input NAND gate. What are the inputs A and B? What is the output F? Again, it is a two input NAND gate. So, you have four different combinations 0 0 0 1 1 0 and 1 1. What is the output? Well, for 0 0, the output is A 1. For the combination 0 1, what is the output? Again, it is 1. For the combination 1 0, what is the output? Again, it is A 1. For the input combination 1 1, what is the output? It is A 0. Now, if you compare the output of a NAND gate with that of an AND gate, you would see a direct inversion between the two outputs. So, that is what we explained earlier. NAND gate is made up of an AND gate along with a NOT gate connected to its output. Let us have a look at a mathematical expression which describes the function of a NAND gate. Well, we are using a two input NAND gate. So, it has inputs A and B. So, the expression would be F equals to A dot B and bar over the entire expression. Bar, we said, represents the inversion. So, in fact, the product of A and B is being inverted. Simple what will happen of NAND gate? Well, it is very similar to that of the AND gate with a bubble at the output which indicates that the output is being inverted. Let us have a look at the timing diagram of NAND gate. Again, we apply a certain number of inputs, rather a train of binary numbers at the inputs and we observe the output. And we simply draw a timing diagram which explains the behavior during that particular time interval. Let us consider the example of a two input NAND gate. We apply a series of 1s and 0s at both the inputs A and B which are shown in the diagram. The output F is again shown in the diagram. Let us consider the time interval T0. At time interval T0, both the inputs are a 1. What should be the output? Referring to the truth table of the NAND gate, the output should be 0. Whenever all the inputs are 1s, the output is 0. Consider the time interval T1. The input B is a 1, whereas input A is a 0. So, what should be the output? Referring to the function table or the truth table of the NAND gate, if any one of the inputs is a 0, the output is going to be a 1. So, during time interval T1, you see a 1 at the output. Similar is the case with time interval T2. Input B is a 0. So, the output has to be a 1. Looking at interval T3, both the inputs are 1s. So, the output has to be a 0. Intervals T4, T5 and T6, you see an output which is high or 1. Why? Because during intervals T4, T5 and T6, one of the inputs is a 0. We have just looked at the timing diagram of a 2 input NAND gate. Before we move on and talk about the universal NAND gate, let us talk about a 3 input or a 4 input NAND gate. Do we have a 3 input, 4 input NAND gate? Yes, NAND gate can have multiple inputs more than 2 inputs like the NAND gate and the OR gate. Function table, let us say a 4 input NAND gate. Again, the same NAND gate case or OR gate case method. You have inputs A, B, C and D. You have 16 possible combinations. So, you have 16 possible outputs. So, 4 input NAND gate output, what will happen? Well, again, if all the 4 inputs are 1s, what do you get? You get a 0. For all other combinations, you would get a 1. 4 input NAND gate expression, mathematical expression, what will happen? Well, basically it is F equals to A dot B dot C dot D an entire bar over the entire expression, which indicates that of course the product of A, B, C and D is being inverted. Now, let us see why we call a NAND gate a universal NAND gate. Well, if we have a NAND gate, we can use the NAND gate to implement an inverter in OR gate. We can use it to implement a NAND gate. We can use it to implement an OR gate. Let us see how we can use a NAND gate to implement an inverter. Let us consider a 2 input NAND gate. What happens if you connect both the inputs together? So now, if you connect both the inputs together, you can only apply a single input. Single input, what will happen? There will be 0 or 1 here. Now, if you look at the function table or the 2 table of a 2 input NAND gate, you are left with 2 options, the 0 0 option and the 1 1 option. 0 1 or 1 0 combination is not possible because you have connected both the inputs. So, what do you get when you have 2 0s, 0 0 at the input? Well, the output is a 1. What do you have when the 2 inputs are a 1 1? Of course, both the inputs are connected together. So, you have basically a 1, the output is going to be a 0. Now, what happens if you have a 3 input NAND gate and you connect all the 3 inputs together? Would you obtain an inverter? Yes, since you can only have 2 combinations, either all 3 0s at the inputs or all 3 1s at the inputs. So, what do you get when you have all 3 0s at the 3 inputs connected together? Of course, the output is going to be a 1. When you apply 1, then of course, the output is going to be a 0. Now, let us see how we can use an NAND gate to implement an NAND gate. And NAND gate basically, it is an NAND gate with an inverter connected to the output. So, if you connect another inverter at the output of a NAND gate, what happens? The 2 inverters cancel each other out and you are left with an NAND gate. How do you obtain an OR gate using a NAND gate? Well, you have to use a combination of 3 NAND gates. Now, to explain this conversion or implementation of an NAND gate using a NAND gate and the implementation of an OR gate using a combination of 3 NAND gates, let us have a look at the diagram. Let us first look at the implementation of an NAND gate using NAND gates. NAND gate 1 functions like a NAND gate. The output of NAND gate 1 is shown by F1. Now, this output has to be inverted so that we have an NAND gate output. Another NAND gate, NAND gate 2 is used as an inverter. Both its inputs are connected together and they are connected to the output of NAND gate 1. Now, if you look at the function table, the output of NAND gate 2 which now has been connected as an inverter is 0 0 0 1 which is the function table or the 2 table of an NAND gate. Now, let us see how we can implement an OR gate using NAND gates. An OR gate can be alternately represented by the NAND gate symbol with bubbles at the output and the inputs. Now, if you just discard the bubbles at the input, what do you see? You see an NAND gate. What do the bubbles mean? Well, bubbles indicate an inverter. So, the 2 bubbles at the 2 inputs mean 2 inverters. So, how do you implement an inverter by connecting the 2 inputs of a NAND gate? So, the circuit which represents the OR gate is implemented by using 3 NAND gates 1, 2 and 3. NAND gates 1 and 2 are connected as inverters and NAND gate 3 is used as a NAND gate. The function diagram confirms the operation of this 3 NAND gate circuit as a OR gate. We have just looked at 2 circuits which describe the use of NAND gate to implement an NAND gate and another circuit which describe the use of NAND gate to implement an OR gate. Let us now look at the NOR universal gate. The NOR universal gate again can be used to implement an OR gate, an NAND gate, an inverter and NAND gate. So, before we describe how we can implement all these circuits, let us have a look at the NOR gate. NOR gate basically combines the OR gate and a NOR gate. So, that means if the output of the OR gate is inverted, what do you get? You get a NOR function. Let us have a look at a 2 input NOR gate. So, what are the combinations again? You have 4 combinations 0, 0, 0, 1, 1, 0 and 1, 1. What should be the output? What was the output for the OR gate for the combination 0, 0? It was a 0. Since the NOR gate is inverting the output of the OR gate, so you should get a 1. Similarly, for the input 0, 1, what should be the output of the NOR gate? It should be the reverse of the OR gate. So, the output should be a 0. Again for the combination 1, 0, the output should be a 0. And for the input combination 1, 1, the output of a NOR gate again is a 0. Symbolically, NOR gate as I present, it is very similar to the OR gate except for a bubble at the output, which indicates that the output of the OR gate is of course being inverted. How will you write this as an expression? Well, f equals to a plus b whole bar. That means the entire expression is being inverted. Multiple inputs, that means let us say 4 input, 5 input NOR gates. Yes, it is true. Let us have a look at 3 input NOR gate. How many outputs will there be? Well, there are 8 possible input combinations of 3 input NOR gates. So, we have 8 possible output values. What can happen in this? Well, for the combination 0, 0, 0, you would have a 1 output. For all other combinations, you would get a 0 output. Expressions make a significant difference in the 3 input NOR gate. Basically, f equals to a plus b plus c whole bar. Plus, as you remember, we said it does not indicate addition. It simply indicates an OR function. The bar indicates the NOR function. Let us have a look at the timing diagram. Again, let us suppose we have a 2 input NOR gate having inputs a and b and of course the output f. We apply a certain number of inputs at input a and b. Let us observe the output through a timing diagram. A sequence of 1s and 0s is applied at the 2 inputs of the NOR gate a and b as shown in the diagram. The output of the NOR gate for intervals t0 to t6 is shown to be 0. Let us see how. At interval t0, the inputs, the 2 inputs are both 1s. What should be the output? Looking at the function table of the NOR gate, the output should be a 0. Again, for time interval t1, the output, rather the input b is a 1. So, the output should again be a 0. So, if any of the 2 inputs is a 1, the output should be 0. So, if you look at intervals t2, t3, t4, t5 and t6, either both the inputs are 1s or only a single input is a 1. Therefore, the output has to be a 0. We just looked at the timing diagram of a 2 input NOR gate. Now, let us look at the NOR gate as a universal NOR gate. Why did we say it is a universal NOR gate? Well, we can use it to implement any other gate. Let us again start by implementing the inverter. So, how do you implement an inverter or an OR gate using the NOR gate? Again, if you just join the 2 inputs or the inputs, 3 inputs, 4 inputs together, you get an inverter. If you look at the function table of a NOR gate, when all the inputs are 0s, what do you get? You get a 1. When all inputs are a 1, what do you get? The output is a 0. So, basically you have implemented an inverter. How would you implement an OR gate and an AND gate using an OR gate? Well, implementing an OR gate is very simple. NOR gate, we had told you that basically it is an OR gate and the output of the OR gate is being inverted. So, if you put another inverter, the 2 inverters cancel out and you end up with an OR gate. So, NOR gate up a claim, uske inputs milade, that becomes an inverter. You just connect it to the output of another NOR gate. That gives you an OR gate. Implementing an AND gate using an OR gate would require a combination of 3 NOR gates. With that, we would be looking at a diagram, but we would be looking at this diagram in the next lecture. Let us stop for today. Today, we looked at logic gates, which are the basic building blocks in any digital circuit. We talked about the 3 gates, the basic gates, AND gate, OR gate and NOR gate. And then we talked about the 2 universal gates, the NAND gate and the NOR gate. So, we would be continuing with these 5 gates in the next lecture. See you in the next lecture. Adha Hafiz and Asalaamu Alaikum.