210 likes | 299 Views
Section 10.3. Logic Gates. Boolean algebra & circuits. Boolean algebra is used to model electronic circuitry Each input & output of electronic device can be thought of as a member of the set {0,1} Electronic devices made up of circuits
E N D
Section 10.3 Logic Gates
Boolean algebra & circuits • Boolean algebra is used to model electronic circuitry • Each input & output of electronic device can be thought of as a member of the set {0,1} • Electronic devices made up of circuits • Each circuit can be designed using rules of Boolean algebra
Logic gates • Basic elements of circuits are called gates • Each type of gate implements a Boolean operation (e.g. Boolean product, Boolean sum, complement) • Combinational circuits or gating networks: • give output that depends only on input, not current state of circuit • have no memory capability
Elements of combinational circuits Inverter: accepts value of a Boolean variable as input and produces the complement as output OR gate: inputs are values of 2 or more Boolean variables; output is Boolean sum of their values
Elements of combinational circuits AND gate: inputs are values of 2 or more Boolean variables; output is Boolean product of their values AND gates and OR gates may have multiple inputs
Combinations of gates • Combinational circuits can be constructed using combinations of inverters, OR gates, and AND gates • In such circuit combinations, some gates may share inputs • Output from a gate may be used as input by another element
Example 1 Construct a circuit to produce the output:
Example 2 Construct a circuit to produce the output:
Example 3 • We can use circuits to model various types of computational operations • For example, suppose a committee of 3 people decides issues for an organization; each one votes yes or no for each proposal that arises, and a proposal passes if it receives at least 2 yes votes
Example 3 • Let x, y and z represent the voters’ decisions - a value of 1 means a yes vote, and 0 means a no vote • We can design a circuit to output 1 when two or more of x, y and z are 1 by representing the Boolean function xy + xz + yz
Example 3 The resulting circuit looks like this:
Example 4 • Light fixtures may be controlled by more than one switch • Circuits for such fixtures must be designed so that flipping any switch in the circuit will turn the light on when it is off and off when it is on • We will look at such a circuit with 2 switches
Example 4 • We represent the two switches as Boolean variables x and y • When a switch is open, its value is 0, and 1 when it is closed • We need to define a function F(x,y)=1 when the light is on, 0 when it is off
Example 4 • Suppose the light is on if both switches are closed; then F(1,1) = 1 • Opening either switch turns the light off, so F(0,1) = F(1,0) = 0 • If one switch is open (and the light is off), opening the other switch will turn the light on, so F(0,0) = 1 • We can get these results if F(x,y) = xy +
Example 4 A three-way circuit can be designed in a similar fashion; for the three switches x,y,z the function F(x,y,z) =
Adders • Logic circuits can be used to carry out addition of two positive integers from their binary expansions • Such circuits form the basis of computer arithmetic • Half adder: a circuit that takes 2 bits as input, outputting a sum bit and a carry bit; a half adder is a multiple output circuit • A full adder computes the sum and carry bits when 2 bits and a carry are added
Half adder Table below shows the possible inputs and corresponding outputs of a half adder: x and y are the input bits, s is their sum, and c is the carry: From the table we can see that c = xy and s = x y s c 1 1 0 1 1 0 1 0 0 1 1 0 0 0 0 0 or
Full adder Inputs to full adder are the bits x and y and the carry ci; outputs are the sum bit s and the new carry ci+1 x y ci s ci+1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 The outputs of the full adder, which are the sum bit and the new carry, are given by the sum-of-products expansions: Sum: Carry:
Full adder A full adder can be built using half adders to produce the desired output:
Section 10.3 Logic Gates