Presentation on theme: "Digital logic gates 1. The basic building blocks of a computer are called logical gates or just gates. Gates are basic circuits that have at least one."— Presentation transcript:
The basic building blocks of a computer are called logical gates or just gates. Gates are basic circuits that have at least one (and usually more) input and exactly one output. Input and output values are the logical values true and false. In computer architecture it is common to use 0 for false and 1 for true. Gates have no memory. The value of the output depends only on the current value of the inputs. Their output is the truth table. In a truth table, the value of each output is shown for every possible combination of the input values. There are three basic kinds of gates, and-gates, or-gates, and not-gates (or inverters). 2
There are several ways of representing logic functions: Symbols to represent the gates Truth tables Boolean algebra 3
Gates types (from them a vast array of gating functions can be created) AND OR NOT BUT NAND NOR XOR XNOR AND gate A basic AND gate consists of two or more inputs and a single output. The AND gate performs logical multiplication, commonly known as AND function. The output of AND gate is HIGH only when all its inputs are HIGH (i.e. even if one input is LOW, Output will be LOW). If, e.g., the two inputs are X and Y, the output is on only if both X and Y are also on. In digital electronics, the on state is often represented by a 1 and the off state by a 0. The relationship between the input signals and the output signals is often summarised in a truth table, which is a tabulation of all possible inputs and the resulting outputs. e.g. If X and Y are two inputs, then output F can be represented mathematically as F = X.Y. Dot (.) denotes the AND operation. Truth table (another way, in addition to logic equations, to define functionality - their sizes grow exponentially with number of inputs) and symbol of the AND gate: 4 XYF=(X.Y) 000 010 100 111
e.g. Two input AND gate using "diode-resistor" logic where X, Y are inputs and F is the output: 5 If X = 0 and Y = 0, then both diodes D1 and D2 are forward biased and thus both diodes conduct and pull F low. If X = 0 and Y = 1, D2 is reverse biased, thus does not conduct. But D1 is forward biased, thus conducts and thus pulls F low. If X = 1 and Y = 0, D1 is reverse biased, thus does not conduct. But D2 is forward biased, thus conducts and thus pulls F low. If X = 1 and Y = 1, then both diodes D1 and D2 are reverse biased and thus both the diodes are in cut-off and thus there is no drop in voltage at F. Thus F is HIGH.
OR gate The OR gate is kind of the reverse of the AND gate. The OR function, like its verbal counterpart, allows the output to be true (logic 1) if any one or more of its inputs are true. e.g. If it is raining OR if I turn on the sprinkler, the lawn will be wet. The lawn will still be wet if the sprinkler is on and it is also raining. This is correctly reflected by the basic OR function. In symbols, the OR function is designated with a plus sign (+). In logical diagrams, the symbol below designates the OR gate. The truth table for an or-gate with two inputs looks like this: As with the AND function, the OR function can have any number of inputs. Practical commercial OR gates are mostly limited to 2, 3, and 4 inputs, as with AND gates. 6 xyz 000 011 101 111
NOT Gate (Inverter) The inverter is a little different from AND and OR gates - it always has exactly one input as well as one output. Whatever logical state is applied to the input, the opposite state will appear at the output. The NOT function is necessary in many applications and highly useful in others. e.g. The door is NOT locked. (You may enter.) In the inverter symbol, the triangle actually denotes only an amplifier, which in digital terms means that it "cleans up" the signal but does not change its logical sense. It is the circle at the output which denotes the logical inversion. The circle could have been placed at the input instead, and the logical meaning would still be the same. The truth table for an inverter looks like this: 7 xy 01 10