1、 2.Logic gates 2.1 Logic signals 2.2 Basic logic functions2.3 Boolean relationships2.4 Universal gates2.5 Other gates2.6 Gate design1 2.1 Logic signalsTwo-valued signals are used in digital systems to represent ON/OFF control actions and to represent the digits of binary numbers.We often use the hig
2、her voltage to represent a logic 1 and lower voltage to represent a logic 0.A voltage level will represent each of the two logic values.1.Two-valued logic signals2 2.1 Logic signals2.Algebra manipulation of two-valued variablesJust as complex arithmetic expressions are created by using a few basic a
3、rithmetic operations,logic functions can be specified by using simple logic operations.Logic functions can be thought of as algebraic expressions where variables can take on only one of the two values.3 2.2 Basic logic functionsThere are three fundamental operations in Boolean algebra from which all
4、 logic functions can be developed,namely:NOT;AND;ORThey are implemented by circuits called gates.A gate accepts logic signals and produces a logic output according to a basic logic function of the inputs.4 2.2 Basic logic functions1.NOT gateDefinition:The NOT operation is applied to a single variabl
5、e,say A,and produces the opposite logic value to A.The NOT operation on a variable A is written as A.AASymbol Truth table 5 2.2 Basic logic functionsTruth tableA truth table lists the output for each possible combinations of the input variables.InverterThe NOT gate is sometimes called an inverter.Co
6、mplement Some terms Inverting a variable can form its complement.6 2.2 Basic logic functions2.AND gateDefinition:The AND operation,operating on two variables A and B,producing a 1 if A is a 1 and B is a 1,otherwise the result is a 0.The AND operation between two variables A and B is written as AB,or
7、 simply AB.7 2.2 Basic logic functionsABABSymbolTwo-input AND gateThe AND operation can be applied to any number of variables.The result is a 1 only if all the variables are 1.Truth table8 2.2 Basic logic functions3.OR gateDefinition:The OR operation applied to two variables A and B,produces a 1 if
8、A is a 1 or B is a 1,or both A and B are 1,otherwise the result is a 0.The OR operation between two variables A and B is written as A+B.9 2.2 Basic logic functionsABA+BSymbolTwo-input OR gateThe OR operation can be applied to any number of variables.The result is a 1 if any of the variable is a 1.On
9、ly when all variables are 0,the result is a 0.Truth table10 2.3 Boolean relationships1.Basic Boolean identitiesA 1=A;A 0=0;A A=A;A+1=1;A+0=A;A+A=A;A A=0;A+A=1;A=A;These identities can be easily proved by listing all possible values of the variables in a truth table and checking that each combination
10、 of variables results in the same value in each side of the equation.The basic identities can be extended to more variables.11 2.3 Boolean relationships2.Applications of the identities(1)To determine what to do with unused inputs of gatesSuppose we have a three-input gate available,but only require
11、the two-input function,so A and B will be applied to two of the inputs,the third input C is unused.12 2.3 Boolean relationships)Unused inputs of an AND gateTo maintain the logic AND function between the two variables A and B,we have two choices:C is connected to a permanent logic 1(+5V);C is connect
12、ed to A or B;13 2.3 Boolean relationships)Unused inputs of an OR gateTo maintain the logic OR function between the two variables A and B,we have two choices:C is connected to a permanent logic 0(0V);C is connected to A or B;14 2.3 Boolean relationships(2)To determine the effect of faults on gatesFau
13、lts can often be modeled by assuming that a permanent logic 0 or a permanent logic 1 appears on a single line(the so-called stuck-at fault model).Stuck-at fault modelThe effect of a fault on the output can be easily found from the basic relationships.15 2.3 Boolean relationships3.Basic algebraic rul
14、es(1)The commutative lawA+B=B+A;A B=B A(2)The associative lawA+B+C=(A+B)+C=A+(B+C)A B C=(A B)C=A(B C)The order that we compute an expression composed of variables connected by the same operator is not important in Boolean algebra.The rule is called the associative law.16 2.3 Boolean relationships(3)
15、The distributive lawA(B+C)=AB+AC;A+(BC)=(A+B)(A+C)Order can be enforced with parentheses in Boolean algebra.Parentheses are also used in ordinary algebra to show that multiplication applies to a group.It is also true in Boolean to both AND and OR operators and is called the distributive law.The laws
16、 and relationships provide tools for designing a logic expression and creating alternative.17 2.3 Boolean relationships4.DualitySuppose we have a function f,if we change:)all 0s to 1s)all 1s to 0s)all +s to s )all s to +sThe new function we get is the dual of the function f,which is written as fd.(1
17、)The dual function18 2.3 Boolean relationships(2)Dual equalities Principle of DualitySuppose we have proved an equality:F(A,B,C,.,+,0,1)=G(A,B,C,.,+,0,1)Then it follows that a dual equality:Fd(A,B,C,.,+,1,0)=Gd(A,B,C,.,+,1,0)To obtain the dual equality,we simply change all+s to s,all s to+s,all 0s t
18、o 1s and all 1s to 0s.The basic identities can be grouped into dual.19 2.3 Boolean relationships5.DeMorgans theoremA+B=AB;AB=A+BThese relationships are known as DeMorgans theorem.DeMorgans theorem can be proved by listing each function in a truth table and confirming that both are the same for each
19、combination of A and B.Proving DeMorgans theorem for two variables20 2.3 Boolean relationshipsDeMorgans theorem can be extended to more variables.A+B+C=ABC;ABC=A+B+CFor three variables,we have:21 2.4 Universal gates1.NAND gateDeMorgans theorem provides a relationship between AND and OR.Hence,of the
20、three basic operations,only two are strictly necessary because the third can be replaced by a function of the other two.We can combine AND and NOT to form a“universal”operation NAND,which can be used to implement AND,OR,NOT and any Boolean expressions.22 2.4 Universal gatesTruth tableNOT,AND,OR from
21、 NAND gatesABABTwo-input NAND gateSymbol 23 2.4 Universal gates2.NOR gateApart from the NAND gate,we could use the NOR gate as the universal gate.ABA+BTwo-input NOR gateSymbol Truth table24 2.4 Universal gatesNOT,AND,OR from NOR gates25 2.5 Other gates1.Exclusive-OR gateThe exclusive-OR operation is
22、:A B=AB+ABABA BSymbolTruth table26 2.5 Other gatesThe exclusive-OR operation is not regarded as a fundamental operation because the operation can be broken down into AND,OR and NOT operation.The basic identities for the exclusive-OR operation are:A 0=A;A 1=A;A A=0;A A=1;A B=A B=A B;The exclusive-OR
23、operation also obeys the commutative,associative and distributive laws:Commutative law:A B=B AAssociative law:(A B)C=A (B C)Distributive law:A (B C)=AB AC27 2.5 Other gates2.Exclusive-NOR gateThe exclusive-NOR operation is:A B=AB+ABABABSymbol Truth table28 2.5 Other gates3.Commutative functionsSo fa
24、r,the functions we have discussed are commutative functions,whose variables can be interchanged without affecting the results.One advantage of limiting gates to commutative functions is that the inputs can be used in any order,and interchanged at will.29 2.6 Gates design1.TTL combinational logic cir
25、cuitsTTL Transistor-Transistor LogicTTL family was introduced in the 1960s and still used for small digital systems and for interfaces.According to the number of gates in one package,TTL devices can be classified into four types:small-scale integration(SSI),medium-scale integration(MSI),large-scale
26、integration(LSI)and very large-scale integration(VLSI).30 2.6 Gates designSupply voltage The supply voltage for TTL is+5V.A logic 0 is represented by a voltage of+0.2V nominally,it can be generated between 0V and+0.4V.We often associate 0V with a logic 0.A logic 1 is represented by a voltage of+3.4V
27、 nominally,it can be generated between+2.4V and+5V.We often associate+5V with a logic 1.31 2.6 Gates designVoltages as low as+2V will be recognized as logic 1.TTL voltagesVoltages as high as+0.8V will be recognized as logic 0.32 2.6 Gates designNoise Noise is the unwanted electrical signals occurrin
28、g on wires in a system.Logic devices must be designed to accept a certain amount of electrical noise in the system and continue to operate correctly.Noise margin Noise margin is the level of voltage present as electrical noise that can be tolerated in the system.33 2.6 Gates designNoise margin is gi
29、ven in terms of the allowable noise voltage that can be added to or subtracted from a generated logic signal with the logic signal still recognized at the input of gate as the logic level.In TTL,the noise margins at both a logic 0 and a logic 1 is+0.4V.34 2.6 Gates design2.Metal oxide silicon gatesM
30、OS transistor switches The MOS transistor has three terminals:the source terminal,the drain terminal,and the gate terminal.In a MOS transistor,to change the state of the transistor,a different voltage is applied to the gate terminal of the transistor.35 2.6 Gates designWhen the transistor is switche
31、d off,no electrical conduction occurs between the source and the drain terminal.The voltage on the gate to control the on and off states is defined as the voltage across the gate and source terminals,Vgs.When the transistor is switched on,the electrical conduction occurs between the source and the d
32、rain terminal.36 2.6 Gates designPMOS AND NMOS transistorThere are two types of MOS transistor:the n-type MOS transistor(NMOS)and the p-type MOS transistor(PMOS).The n-type MOS transistor requires the drain to be more positive than the source for correct operation.Vgs=0V,the transistor is off.Vgs=+5
33、V,the transistor is on.n-type MOS37 2.6 Gates designThe p-type MOS transistor requires the drain to be more negative than the source for correct operation.Vgs=0V,the transistor is off.Vgs=-5V,the transistor is on.p-type MOS38 2.6 Gates designCMOS circuit CMOS Complementary MOSThe two kinds of transistors complement each other,when one is off the other is on and vice versa.CMOS circuit39