0% found this document useful (0 votes)
33 views

final Unit2

Uploaded by

panthers82638
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

final Unit2

Uploaded by

panthers82638
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 64

LOGIC GATES

Positive and Negative Logic


The binary variables, as we know, can have either of the two states, i.e. the logic ‘0’ state or the logic ‘1’ state.
These logic states in digital systems such as computers, for instance, are represented by two different voltage
levels or two different current levels. If the more positive of the two voltage or current levels represents a logic
‘1’ and the less positive of the two levels represents a logic ‘0’, then the logic system is referred to as a positive
logic system. If the more positive of the two voltage or current levels represents a logic ‘0’ and the less positive
of the two levels represents a logic ‘1’, then the logic system is referred to as a negative logic system. The
following examples further illustrate this concept.

If the two voltage levels are 0 V and +5 V, then in the positive logic system the 0 V represents a logic ‘0’ and the
+5 V represents a logic ‘1’. In the negative logic system, 0 V represents a logic ‘1’ and +5 V represents a logic ‘0’.

If the two voltage levels are 0 V and −5 V, then in the positive logic system the 0 V represents a logic ‘1’ and the
−5 V represents a logic ‘0’. In the negative logic system, 0 V represents a logic ‘0’ and −5 V represents a logic ‘1’.

It is interesting to note, as we will discover in the latter part of the chapter, that a positive OR is a negative AND.
That is, OR gate hardware in the positive logic system behaves like an AND gate in the negative logic system.
The reverse is also true. Similarly, a positive NOR is a negative NAND, and vice versa.
LOGIC GATES
The logic gate is the most basic building block of any digital system,
including computers. Each one of the basic logic gates is a piece of
hardware or an electronic circuit that can be used to implement some
basic logic expression. While laws of Boolean algebra could be used
to do manipulation with binary variables and simplify logic
expressions, these are actually implemented in a digital system with
the help of electronic circuits called logic gates. The three basic logic
gates are the OR (+)gate, the AND (.) gate and the NOT (-) gate.

https://de-iitr.vlabs.ac.in/exp/truth-table-gates/theory.html
https://de-iitr.vlabs.ac.in/exp/truth-table-gates/simulation.html
OR Gate
An OR gate performs an ORing operation on two or more than two logic variables. The OR operation on two
independent logic variables A and B is written as Y = A+B and reads as Y equals A OR B and not as A plus B. An
OR gate is a logic circuit with two or more inputs and one output. The output of an OR gate is LOW only when all
of its inputs are LOW. For all other possible input combinations, the output is HIGH. This statement when
interpreted for a positive logic system means the following.
The output of an OR gate is a logic ‘0’ only when all of its inputs are at logic ‘0’. For all other possible input
combinations, the output is a logic ‘1’. Figure 4.3 shows the circuit symbol and the truth table of a two-input OR
gate. The operation of a two-input OR gate is explained by the logic expression
Y = A+B
As an illustration, if we have four logic variables and we want to know the logical output of (A+B+C+D), then it
would be the output of a four-input OR gate with A, B, C and D as its inputs.
OR Gate
An OR gate performs an ORing operation on two or more than two logic variables. The OR operation on two
independent logic variables A and B is written as Y = A+B and reads as Y equals A OR B and not as A plus B. An
OR gate is a logic circuit with two or more inputs and one output. The output of an OR gate is LOW only when all
of its inputs are LOW. For all other possible input combinations, the output is HIGH. This statement when
interpreted for a positive logic system means the following.
The output of an OR gate is a logic ‘0’ only when all of its inputs are at logic ‘0’. For all other possible input
combinations, the output is a logic ‘1’. Figure 4.3 shows the circuit symbol and the truth table of a two-input OR
gate. The operation of a two-input OR gate is explained by the logic expression
Y = A+B
As an illustration, if we have four logic variables and we want to know the logical output of (A+B+C+D), then it
would be the output of a four-input OR gate with A, B, C and D as its inputs.
AND Gate
An AND gate is a logic circuit having two or more inputs and one output. The output of an AND gate is HIGH only
when all of its inputs are in the HIGH state. In all other cases, the output is LOW. When interpreted for a positive
logic system, this means that the output of the AND gate is a logic ‘1’ only when all of its inputs are in logic ‘1’
state. In all other cases, the output is logic ‘0’. The logic symbol and truth table of a two-input AND gate are
shown below:
The AND operation on two independent logic variables A and B is written as Y = AB and reads as Y equals A AND
B and not as A multiplied by B. Here, A and B are input logic variables and Y is the output. An AND gate performs
an ANDing operation:
NOT Gate
A NOT gate is a one-input, one-output logic circuit whose output is always the complement of the input. That is,
a LOW input produces a HIGH output, and vice versa. When interpreted for a positive logic system, a logic ‘0’ at
the input produces a logic ‘1’ at the output, and vice versa. It is also known as a ‘complementing circuit’ or an
‘inverting circuit’. Figure 4.10 shows the circuit symbol and the truth table.

The NOT operation on a logic variable X is denoted as X or X . That is, if X is the input to a NOT circuit, then its
output Y is given by Y = X or X and reads as Y equals NOT X. Thus, if X = 0Y = 1 and if X = 1Y = 0.
EXCLUSIVE-OR Gate
The EXCLUSIVE-OR gate, commonly written as EX-OR gate, is a two-input, one-output gate.
_ _
Y = (A⊕B) = AB+AB
NAND Gate
NAND stands for NOT AND. An AND gate followed by a NOT circuit makes it a NAND gate
___
Y = A.B

In General
______
Y = (A.B.C.D.)
NOR Gate
NOR stands for NOT OR. An OR gate followed by a NOT circuit makes it a NOR gate.
___
Y = A+B

In General
________
Y = (A+B+C+D)
Universal Gate
1. OR, AND and NOT gates are the three basic logic gates as they together can be
used to construct the logic circuit for any given Boolean expression.
2. NOR and NAND gates have the property that they individually can be used to
hardware-implement a logic circuit corresponding to any given Boolean
expression. That is, it is possible to use either only NAND gates or only NOR
gates to implement any Boolean expression.
3. This is so because a combination of NAND gates or a combination of NOR gates
can be used to perform functions of any of the basic logic gates.

It is for this reason that NAND and NOR gates are universal gates.
Digital Logic Design
ASSOCIATIVE LAW:
A binary operator * on a set S is said to be associative whenever (x * y) * z = x * (y *
z) for all x, y, z Î S, for all Boolean values x, y and z.

COMMUTATIVE LAW:
A binary operator * on a set S is said to be commutative whenever x * y = y * x for all
x, y, z є S

IDENTITY ELEMENT:
A set S is said to have an identity element with respect to a binary operation * on S if
there exists an element e є S with the property e * x = x * e = x for every x є S
BASIC IDENTITIES OF BOOLEAN ALGEBRA
• Postulate 1(Definition): A Boolean algebra is a closed algebraic system
containing a set K of two or more elements and the two operators · and
+ which refer to logical AND and logical OR •x + 0 = x
•x·0=0 •x+1=1 •x·1=1 •x+x=x
•x·x=x • x + x’ = x • x · x’ = 0 •x+y=y+x
• xy = yx
•x+(y+z)=(x+y)+z
• x (yz) = (xy) z
• x ( y + z ) = xy + xz
• x + yz = ( x + y )( x + z)
• ( x + y )’ = x’ y’
• ( xy )’ = x’ + y’
• (x’)’ = x
DIGITAL LOGIC DESIGN
DeMorgan's Theorem
(a) (a + b)' = a'b' (b) (ab)' = a' + b'
Generalized DeMorgan's Theorem
(a) (a + b + … z)' = a'b' … z' (b) (a.b … z)' = a' + b' + … z‘
Basic Theorems and Properties of Boolean algebra Commutative law
Law1: A+B=B+A Law2: A.B=B.A
Associative law
Law1: A + (B +C) = (A +B) +C Law2: A(B.C) = (A.B)C
Distributive law
Law1: A.(B + C) = AB+ AC Law2: A + BC = (A + B).(A +C)
Absorption law Law1: A +AB =A Law2: A(A +B) = A
Solution: A(1+B) Solution: A.A+A.B
A A+A.B
A(1+B)
A
Boolean Function
A Boolean function expresses the logical relationship between binary variables and is evaluated by
determining the binary value of the expression for all possible values of the variables.
A Boolean function can be represented in a truth table. The number of rows in the truth table is 2n,
where n is the number of variables in the function. The binary combinations for the truth table are
obtained from the binary numbers by counting from 0 through 2n - 1.
Algebraic Manipulation (Minimization of Boolean function)
Boolean algebra is a useful tool for simplifying digital circuits.
• Why do it? Simpler can mean cheaper, smaller, faster.
• Example: Simplify F = x’yz + x’yz’ + xz.
F= x’yz + x’yz’ + xz
= x’y(z+z’) + xz
= x’y•1 + xz
= x’y + xz

Example: Prove
x’y’z’ + x’yz’ + xyz’ = x’z’ + yz’
• Proof:
x’y’z’+ x’yz’+ xyz’
= x’y’z’ + x’yz’ + x’yz’ + xyz’
= x’z’(y’+y) + yz’(x’+x)
= x’z’•1 + yz’•1
= x’z’ + yz’
Binary Arithmetic
Mathematical operations include addition, subtraction, multiplication, and division. Binary addition
follows rules similar to decimal addition. When adding with binary numbers, there are only four
conditions that can occur:

The first three conditions are easy because they are like adding decimals, but the last condition is
slightly different. In decimal, 1 + 1 = 2. In binary, a 2 is written 10. Therefore, in binary, 1 + 1 = 0,
with a carry of 1 to the next most significant place value. When adding larger binary numbers,
the resulting 1s are carried into higher-order columns, as shown in the following examples.
COMBINATIONAL CIRCUITS

Combinational Logic
• Logic circuits for digital systems may be combinational or sequential.

• A combinational circuit consists of input variables, logic gates, and output variables.

For n input variables, there are 2n possible combinations of binary input variables .For
each possible input Combination ,there is one and only one possible output
combination. A combinational circuit can be described by m Boolean functions one for
each output variables. Usually the input s comes from flip-flops and outputs go to flip-
flops.
Design Procedure

The different steps involved in the design of a combinational logic circuit are
as follows:
1. Statement of the problem.
2. Identification of input and output variables.
3. Expressing the relationship between the input and output variables.
4. Construction of a truth table to meet input–output requirements.
5. Writing Boolean expressions for various output variables in terms of input
variables.
6. Minimization of Boolean expressions.
7. Implementation of minimized Boolean expressions.
HALF ADDER A N D F U L L A D D ER
What is Adder?

● Adder : In electronics an adder is digital circuit that


perform addition of numbers. In modern computer
adder reside in the arithmetic logic unit (ALU).
Adders :
● Adders are important not only in the computer but
also in many types of digital systems in which the
numeric data are processed.

● Types of adder:
 Half adder
 Full adder
● Half adder : The half adder accepts two binary
digits on its inputs and produce two binary digits
outputs, a sum bit and a carry bit.

● The half adder is an example of a simple, functional


digital circuit built from two logic gates. The half
adder adds two one-bit binary numbers (AB). The
output is the sum of the two bits (S) and the carry (C).
● Note that how the same two inputs are directed to
two different gates. The inputs to the XOR
gate are also the inputs to the AND gate.
The input "wires" to the XOR gate are tied to the
input wires of the AND gate; thus, when voltage
is applied to the A input of the XOR gate, the A
input to the AND gate receives the same voltage.
Truth Table:
• 2-input • 2-input AND
Exclusive-OR Gate
Gate

Symbol Truth
Symbol Truth
Table
B A Table
B A C
S
0 0 0
0 0
0 1 0
0
2-input Ex-OR 2-input AND 1 0 0
0 1
Gate Gate 1 1 1
1
1 0
1
1 1
0
● Half adder truth table

S=A  B (Exclusive OR)


C=A.B (AND)
● Full adder : The full adder accepts two inputs bits and
an input carry and generates a sum output and an
output carry.

● The full-adder circuit adds three one-bit binary numbers


(Cin, A ,B) and outputs two one-bit binary numbers, a sum
(S) and a carry (Cout).
● If you look closely, you'll see the full adder is simply two half
adders joined by an OR.
● We can implement a full adder circuit with the help of two
half adder circuits. The first half adder will be used to add A
and B to produce a partial Sum. The second half adder
logic can be used to add CIN to the Sum produced by the
first half adder to get the final S output. If any of the half
adder logic produces a carry, there will be an output carry.
Thus, COUT will be an OR function of the half-adder Carry
outputs.
● Full adder truth table

S= A  B  Cin
C=AB +Cin(A  B)
Complements:
In digital computers to simplify the subtraction operation & for logical
manipulation complements are used. There are two types of
complements used in each radix system.
i) The radix complement or r’s complement
ii) The diminished radix complement or (r-1)’s complement
Subtractors

The subtraction of two binary numbers may be accomplished by taking the


complement of the subtrahend and adding it to the minuend. By this, the
subtraction operation becomes an addition operation and instead of having a
separate circuit for subtraction, the adder itself can be used to perform
subtraction. This results in reduction of hardware. In subtraction, each
subtrahend bit of the number is subtracted from its corresponding significant
minuend bit to form a difference bit. If the minuend bit is smaller than the
subtrahend bit, a 1 is borrowed from the next significant position., that has
been borrowed must be conveyed to the next higher pair of bits by means of
a signal coming out (output) of a given stage and going into (input) the next
higher stage.
The Half-Subtractor
A Half-subtractor is a combinational circuit that subtracts one bit from
the other and produces the difference. It also has an output to specify if a 1
has been borrowed. . It is used to subtract the LSB of the subtrahend from
the LSB of the minuend when one binary number is subtracted from the
other.
A Half-subtractor is a combinational circuit with two inputs A and B
and two outputs d and b. d indicates the difference and b is the output signal
generated that informs the next stage that a 1 has been borrowed. When a
bit B is subtracted from another bit A, a difference bit (d) and a borrow bit (b)
result according to the rules given as
The Half-Subtractor
The Full-Subtractor
The half-subtractor can be only for LSB subtraction. IF there is a borrow
during the subtraction of the LSBs, it affects the subtraction in the next
higher column; the subtrahend bit is subtracted from the minuend bit,
considering the borrow from that column used for the subtraction in the
preceding column. Such a subtraction is performed by a full-subtractor. It
subtracts one bit (B) from another bit (A) , when already there is a borrow bi
from this column for the subtraction in the preceding column, and outputs
the difference bit (d) and the borrow bit(b) required from the next d and b.
The two outputs present the difference and output borrow. The 1s and 0s for
the output variables are determined from the subtraction of A-B-bi.
The Full-Subtractor
Multiplexer
A multiplexer or MUX, also called a data selector, is a combinational circuit
with more than one input line, one output line and more than one selection
line. There are some multiplexer ICs that provide complementary outputs.
Also, multiplexers in IC form almost invariably have an ENABLE or STROBE
input, which needs to be active for the multiplexer to be able to perform its
intended function. A multiplexer selects binary information present on any
one of the input lines, depending upon the logic status of the selection
inputs, and routes it to the output line. If there are n selection lines, then the
number of maximum possible input lines is 2n and the multiplexer is referred
to as a 2n-to-1 multiplexer or 2n ×1 multiplexer. Figures 8.1(a) and (b)
respectively show the circuit representation and truth table of a basic 4-to-1
multiplexer.
Multiplexer
Multiplexer
Demultiplexers
A demultiplexer is a combinational logic circuit with an input line, 2n output
lines and n select lines. It routes the information present on the input line to
any of the output lines. The output line that gets the information present on
the input line is decided by the bit status of the selection lines. A decoder is a
special case of a demultiplexer without the input line. Figure 8.18(a) shows
the circuit representation of a 1-to-4 demultiplexer. Figure 8.18(b) shows the
truth table of the demultiplexer when the input line is held HIGH.
Encoders

An encoder is a multiplexer without its single output line. It is a


combinational logic function that has 2n (or fewer) input lines and n output
lines, which correspond to n selection lines in a multiplexer.
The n output lines generate the binary code for the possible 2n input lines.
Let us take the case of an octal-to-binary encoder. Such an encoder would
have eight input lines, each representing an octal digit, and three output
lines representing the three-bit binary equivalent. The truth table of such an
encoder is given in Table In the truth table, D0 to D7 represent octal digits 0
to 7. A, B and C represent the binary digits.
Encoders
The eight input lines would have 28 = 256
possible combinations. However, in the
case of an octal-to-binary encoder, only
eight of these 256 combinations would
have any meaning. The remaining
combinations of input variables are ‘don’t
care’ input combinations. Also, only one of
the input lines at a time is in logic ‘1’ state.
Figure shows the hardware
implementation of the octal-to-binary
encoder described by the truth table. This
circuit has the shortcoming that it
produces an all 0s output sequence when
all input lines are in logic ‘0’ state. This can
be overcome by having an additional line
to indicate an all 0s input sequence.
Decoders

A decoder, as mentioned earlier, is a combinational circuit that decodes the information


on n input lines to a maximum of 2n unique output lines. Figure shows the circuit
representation of 2-to-4, 3-to-8 and 4-to-16 line decoders. If there are some unused or
‘don’t care’ combinations in the n-bit code, then there will be fewer than 2n output
lines.

Decoder

0 0 0
0 0 1
SEQUENTIAL CIRCUITS
Flip-Flops
• A flip-flop is a storage element based on the gated latch principle.
• It can have its output state changed only on the edge of the controlling clock signal
• We consider two types:
 Edge-triggered flip-flop is affected only by the input values present when the
active edge of the clock occurs
 Master-slave flip-flop is built with two gated latches
 The master stage is active during half of the clock cycle, and the slave stage is
active during the other half.
 The output value of the flip-flop changes on the edge of the clock that activates
the transfer into the slave stage.
S-R Latch using NOR Gates
Master-Slave D Flip-Flop
Excitation Tables
Registers and Counters
A Simple Shift Register

 An n-bit register is a
cascade of n flip-
flops and can store
an n-bit binary data
 A counter can count
occurrences of
events and can
generate timing
intervals for control
purposes
Counters
Counters are a specific type of
sequential circuit.
• Like registers, the state, or
the flip-flop values
themselves, serves as the
“output.”
• The output value increases
by one on each clock cycle.
• After the largest value, the
output “wraps around” back
to 0.
• Using two bits, we’d get
something like this:
Counters
Counter is a device which stores (and sometimes displays) the number of times particular
event or process has occurred, often in relationship to a clock signal. A Digital counter is a
set of flip flops whose state change in response to pulses applied at the input to the counter.
Counters may be asynchronous counters or synchronous counters. Asynchronous counters
are also called ripple counters
In electronics counters can be implemented quite easily using register-type circuits such as
the flip-flops and a wide variety of classifications exist:
 Asynchronous (ripple) counter – changing state bits are used as clocks to subsequent
state flip-flops
 Synchronous counter – all state bits change under control of a single clock
 Decade counter – counts through ten states per stage
 Up/down counter – counts both up and down, under command of a control input
 Ring counter – formed by a shift register with feedback connection in a ring
 Johnson counter – a twisted ring counter
 Cascaded counter
 Modulus counter.
Benefits of counters

• Counters can act as simple clocks to keep track of “time.”


• You may need to record how many times something has happened.
– How many bits have been sent or received?
– How many steps have been performed in some computation?

• All processors contain a program counter, or PC.


– Programs consist of a list of instructions that are to be executed one after another
(for the most part).
– The PC keeps track of the instruction currently being executed.
– The PC increments once on each clock cycle, and the next program instruction is
then executed.

You might also like