You are on page 1of 70

BSc IT

Digital and Computer Organization


Semester - III

Copyright@ Amity University


Boolean Algebra
• Boolean algebra (or Boolean logic) is a logical
calculus of truth values, developed by George Boole in
the 1840s.
• It resembles the algebra of real numbers, but with the
numeric operations of multiplication xy, addition x + y,
and negation −x replaced by the respective logical
operations of conjunction x∧y, disjunction x∨y,
and negation ¬x
• Boolean algebra is the algebra of two values. These are
usually taken to be 0 and 1, although F and T, false and
true, etc.

Copyright@ Amity University


Boolean Algebra
•Boolean algebra provides the operations and the rules for
working with the set {0, 1}.
•These are the rules that underlie electronic circuits, and
the methods we will discuss are fundamental to VLSI
design.
•We are going to focus on three operations:
• Boolean complementation,
• Boolean sum, and
• Boolean product

Copyright@ Amity University


Boolean Operations
•The complement is denoted by a bar (on the slides, we
will use a minus sign). It is defined by
-0 = 1 and -1 = 0.

•The Boolean sum, denoted by + or by OR, has the


following values:
1 + 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0+0=0

•The Boolean product, denoted by or by AND, has the


following values:
1 1 = 1, 1 0 = 0, 0 1 = 0, 0 0 = 0

Copyright@ Amity University


Boolean Functions and Expressions
•Definition: Boolean function is a function of the
form ƒ : Bk → B, where B = {0, 1} is a Boolean
domain and k is a nonnegative integer. In the case
where k = 0, the "function" is essentially a constant element
of B.
•Let B = {0, 1}. The variable x is called a Boolean
variable if it assumes values only from B.
•A function from Bn, the set {(x1, x2, …, xn) |xi B,
1 i n}, to B is called a Boolean function of degree n.
•Boolean functions can be represented using expressions
made up from the variables and Boolean operations.
Copyright@ Amity University
Boolean Functions and Expressions
•The Boolean expressions in the variables x1, x2, …, xn are
defined recursively as follows:
• 0, 1, x1, x2, …, xn are Boolean expressions.
• If E1 and E2 are Boolean expressions, then (-E1),
(E1E2), and (E1 + E2) are Boolean expressions.
•Each Boolean expression represents a Boolean function.
The values of this function are obtained by substituting 0
and 1 for the variables in the expression.

Copyright@ Amity University


Boolean Functions and Expressions
•For example, we can create Boolean expression in the
variables x, y, and z using the “building blocks”
0, 1, x, y, and z, and the construction rules:
•Since x and y are Boolean expressions, so is xy.
•Since z is a Boolean expression, so is (-z).
•Since xy and (-z) are expressions, so is xy + (-z).
……..… and so on.

Copyright@ Amity University


Boolean Functions and Expressions
•Example: Give a Boolean expression for the Boolean
function F(x, y) as defined by the following table:

x y F(x, y)
0 0 0
0 1 1
1 0 0
1 1 0
Possible solution: F(x, y) = (-x) y

Copyright@ Amity University


Boolean Functions and Expressions
•Another Example:
x y z F(x, y, z)

0 0 0 1 Possible solution I:
F(x, y, z) = -(xz + y)
0 0 1 1

0 1 0 0

0 1 1 0

1 0 0 1
Possible solution II:
1 0 1 0 F(x, y, z) = (-(xz))(-y)

1 1 0 0

1 1 1 0

Copyright@ Amity University


Boolean Functions and Expressions
•There is a simple method for deriving a Boolean
expression for a function that is defined by a table. This
method is based on minterms.
•Definition: A literal is a Boolean variable or its
complement. A minterm of the Boolean variables x1, x2,
…, xn is a Boolean product y1y2…yn, where yi = xi or yi = -
xi.
•Hence, a minterm is a product of n literals, with one literal
for each variable.

Copyright@ Amity University


Boolean Functions and Expressions
•Consider F(x,y,z) again:
x y z F(x, y, z)

0 0 0 1 F(x, y, z) = 1 if and only if:


x = y = z = 0 or
0 0 1 1 x = y = 0, z = 1 or
0 1 0 0 x = 1, y = z = 0
Therefore,
0 1 1 0 F(x, y, z) =
(-x)(-y)(-z) +
1 0 0 1
(-x)(-y)z +
1 0 1 0 x(-y)(-z)

1 1 0 0

1 1 1 0

Copyright@ Amity University


Boolean Functions and Expressions
•Definition: The Boolean functions F and G of n variables
are equal if and only if F(b1, b2, …, bn) = G(b1, b2, …, bn)
whenever b1, b2, …, bn belong to B.

•Two different Boolean expressions that represent the same


function are called equivalent.

•For example, the Boolean expressions xy, xy + 0, and xy 1


are equivalent.
Copyright@ Amity University
Boolean Functions and Expressions

•The complement of the Boolean function F is the function


–F, where –F(b1, b2, …, bn) = -(F(b1, b2, …, bn)).

•Let F and G be Boolean functions of degree n. The Boolean


Sum F+G and Boolean Product FG are then defined by
(F + G)(b1, b2, …, bn) = F(b1, b2, …, bn) + G(b1, b2, …, bn)
(FG)(b1, b2, …, bn) = F(b1, b2, …, bn) G(b1, b2, …, bn)

Copyright@ Amity University


Boolean Functions and Expressions

•Question: How many different Boolean functions of


degree 1 are there?
•Solution: There are four of them, F1, F2, F3, and F4:

x F1 F2 F3 F4

0 0 0 1 1

1 0 1 0 1

Copyright@ Amity University


Boolean Functions and Expressions
•Question: How many different Boolean functions of
degree 2 are there?
•Solution: There are 16 of them, F1, F2, …, F16:

x y F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16


0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Copyright@ Amity University


Duality
•Examples:
The dual of x(y + z) is x + yz.
The dual of -x 1 + (-y + z) is (-x + 0)((-y)z).

The dual of a Boolean function F represented by a


Boolean expression is the function represented by the dual
of this expression. This dual function, denoted by Fd, does
not depend on the particular Boolean expression used to
represent F.
The dual of a Boolean expression is obtained by interchanging Boolean sums
and Boolean products and interchanging 0s and 1s.

Copyright@ Amity University


Duality
•Therefore, an identity between functions represented by
Boolean expressions remains valid when the duals of both
sides of the identity are taken.
•We can use this fact, called the duality principle, to
derive new identities.
•For example, consider the absorption law
x(x + y) = x.
•By taking the duals of both sides of this identity, we
obtain the equation x + xy = x, which is also an identity
(and also called an absorption law).

Copyright@ Amity University


Definition of a Boolean Algebra
•All the properties of Boolean functions and expressions
that we have discovered also apply to other mathematical
structures such as propositions and sets and the operations
defined on them.
•If we can show that a particular structure is a Boolean
algebra, then we know that all results established about
Boolean algebras apply to this structure.
•For this purpose, we need an abstract definition of a
Boolean algebra.

Copyright@ Amity University


Definition of a Boolean Algebra
•Definition: A Boolean algebra is a set B with two binary
operations and , elements 0 and 1, and a unary
operation – such that the following properties hold for all x,
y, and z in B:
•x 0 = x and x 1=x (identity laws)
•x (-x) = 1 and x (-x) = 0 (domination laws)
•(x y) z=x (y z) and
(x y) z=x (y z) and (associative laws)
•x y=y x and x y=y x (commutative laws)
•x (y z) = (x y) (x z) and
x (y z) = (x y) (x z) (distributive laws)
Copyright@ Amity University
Logic Gates
• A logic gate performs a logical operation on one or
more logic inputs and produces a single logic output.
• The logic is called Boolean logic and is most
commonly found in digital circuits.
• A truth table is a table that describes the behaviour of
a logic gate or any combination of logic gates. It lists
the value of the output for every possible combination
of the inputs and can be used to simplify the number
of logic gates and level of nesting in an electronic
circuit.

Copyright@ Amity University


Logic Gates
•Electronic circuits consist of so-called gates.
There are three basic types of gates:
x -x
inverter

x
x+y
OR gate
y

x
xy
AND gate
y

Copyright@ Amity University


Logic Gates

Copyright@ Amity University


Logic Gates
•Example: How can we build a circuit that computes the
function xy + (-x)y ?
x
xy

y
xy + (-x)y

x -x
(-x)y

Copyright@ Amity University


Manipulating Boolean Function
• In Boolean algebra, any Boolean function can be
expressed in a canonical form using the dual
concepts of minterms and maxterms.

• Minterms are called products because they are


thelogical AND of a set of variables.

• Maxterms are called sums because they are


the logical OR of a set of variables.

Copyright@ Amity University


Manipulating Boolean Function
• The dual canonical forms of any Boolean function are
a "sum of minterms" and a "product of maxterms."
• The term "Sum of Products" or "SoP" is widely used
for the canonical form that is a disjunction (OR) of
minterms.
• Its De Morgan dual is a "Product of Sums" or "PoS"
for the canonical form that is a conjunction (AND) of
maxterms.
• These forms allow for greater analysis into the
simplification of these functions, which is of great
importance in the minimization or other optimization
of digital circuits.
Copyright@ Amity University
Manipulating Boolean Function
Minterm:
• For a boolean function of n variables , a product
term in which each of the n variables appears once (in
either its complemented or uncomplemented form) is
called a minterm. Thus, a minterm is a logical
expression of n variables that employs only
the complement operator and the conjunction operator.
• There are 2n minterms of n variables, since a variable
in the minterm expression can be in either its direct or
its complemented form--two choices per n variables.

Copyright@ Amity University


Manipulating Boolean Function
Maxterm:
• For a boolean function of n variables , a sum term in
which each of the n variables appears once (in either its
complemented or uncomplemented form) is called a
maxterm.
• A maxterm is a logical expression of n variables that
employs only the complement operator and
the disjunction operator.
• Maxterms are a dual of the minterm idea (i.e.,
exhibiting a complementary symmetry in all respects).

Copyright@ Amity University


K - Map
• Karnaugh maps are used to facilitate the simplification
of Boolean algebra functions.

• A Karnaugh map provides a pictorial method of


grouping together expressions with common factors
and therefore eliminating unwanted variables. The
Karnaugh map can also be described as a special
arrangement of a truth table.

Copyright@ Amity University


K - Map
• The diagram below illustrates the correspondence
between the Karnaugh map and the truth table for the
general case of a two variable problem.

Copyright@ Amity University


K - Map
• The values inside the squares are copied from the
output column of the truth table, therefore there is one
square in the map for every row in the truth table.
Around the edge of the Karnaugh map are the values
of the two input variable. A is along the top and B is
down the left hand side. The diagram below explains
this:

Copyright@ Amity University


K - Map
• The Karnaugh map uses the following rules for the
simplification of expressions
by grouping together adjacent cells containing ones.

Copyright@ Amity University


K - Map
• Groups must contain 1, 2, 4, 8, or in general 2n cells.
That is if n = 1, a group will contain two 1's since 21 = 2.
If n = 2, a group will contain four 1's since 22 = 4.

Copyright@ Amity University


K - Map

Copyright@ Amity University


K - Map

Copyright@ Amity University


K - Map

Copyright@ Amity University


ADDER
• In electronics, an adder or summer is a digital
circuit that performs addition of numbers. In
modern computers adders reside in the arithmetic logic
unit (ALU) where other operations are performed.
Although adders can be constructed for many numerical
representations, such as Binary-coded decimal or excess-
3, the most common adders operate on binary numbers.

• In cases where two's complement or one's complement is


being used to represent negative numbers, it is trivial to
modify an adder into an adder-subtractor.
Copyright@ Amity University
ADDER

• A half adder is a logical circuit that performs an


addition operation on two one-bit binary numbers
often written as A and B. The half adder output is a
sum of the two inputs usually represented with the
signals Cout and S where .
• Following is the logic table for a half adder:

Copyright@ Amity University


ADDER

• A full adder is a logical circuit that performs an


addition operation on three one-bit binary numbers
often written as A, B, and Cin. The full adder produces
a two-bit output sum typically represented with the
signals Cout and S where Sum = 2 Cout+ S.

• A full adder can be implemented in many different


ways such as with a custom transistor-level circuit or
composed of other gates.

Copyright@ Amity University


ADDER

• The full adder's truth table & block diagram can be


shown as:

Copyright@ Amity University


ADDER

A full adder can be implemented in many different


ways such as with a custom transistor-level circuit or
composed of other gates. One example
implementation is with

A full adder can be constructed from two half adders


by connecting A and B to the input of one half adder,
connecting the sum from that to an input to the
second adder, connecting Ci to the other input and
OR the two carry outputs.

Copyright@ Amity University


Encoder

An encoder is a device, circuit, transducer, software


program, algorithm or person that converts information
from one format or code to another, for the purposes of
standardization, speed, secrecy, security, or saving space
by shrinking size.

A simple encoder circuit can receive a single active


input out of 2n input lines generate a binary code
on n parallel output lines.

Copyright@ Amity University


Encoder
• For example a single bit 4 to 2 encoder takes in 4 bits
and outputs 2 bits.

Copyright@ Amity University


Decoder
• A decoder is a device which does the reverse of
an encoder, undoing the encoding so that the original
information can be retrieved. The same method used
to encode is usually just reversed in order to decode.

• In digital electronics, a decoder can take the form of a


multiple-input, multiple-output logic circuit that
converts coded inputs into coded outputs, where the
input and output codes are different. e.g. n-to-
2n, binary-coded decimal decoders.

Copyright@ Amity University


Decoder
• A slightly more complex decoder would be the n-to-
2n type binary decoders. These type of decoders are
combinational circuits that convert binary information
from 'n' coded inputs to a maximum of 2n unique
outputs.
• We can have 2-to-4 decoder, 3-to-8 decoder or 4-to-16
decoder.
• Decoding is necessary in applications such as data
multiplexing, 7 segment display and memory address
decoding.

Copyright@ Amity University


Decoder
• Example:

Copyright@ Amity University


Multiplexer

• In electronics, a multiplexer or mux is a device that


performs multiplexing; it selects one of many analog
or digital input signals and forwards the selected
input into a single line.

• A multiplexer of 2n inputs has n select lines, which


are used to select which input line to send to the
output.

Copyright@ Amity University


Multiplexer

• A demultiplexer (or demux) is a device taking a


single input signal and selecting one of many data-
output-lines, which is connected to the single input. A
multiplexer is often used with a complementary
demultiplexer on the receiving end.

• An electronic multiplexer can be considered as


a multiple-input, single-output switch, and a
demultiplexer as a single-input, multiple-
output switch.

Copyright@ Amity University


Multiplexer
• The schematic symbol for a multiplexer is an isosceles
trapezoid with the longer parallel side containing the
input pins and the short parallel side containing the
output pin. The schematic on the right shows a 2-to-1
multiplexer on the left and an equivalent switch on the
right. The sel wire connects the desired input to the
output.

Copyright@ Amity University


Multiplexer
• In telecommunications, a multiplexer is a device that
combines several input information signals into one output
signal, which carries several communication channels, by
means of some multiplex technique. A demultiplexer is in
this context a device taking a single input signal that
carries many channels and separates those over multiple
output signals.
• In telecommunications and signal processing, an
analog time division multiplexer (TDM) may take several
samples of separate analogue signals and combine them
into one pulse amplitude modulated (PAM) wide-band
analogue signal.
Copyright@ Amity University
Memory
• Computer memory can be divided into two
parts: primary and secondary. Primary memory is
accessible directly by the processing unit. RAM is an
example of primary memory.
• As soon as the computer is switched off the contents
of the primary memory is lost. You can store and
retrieve data much faster with primary memory
compared to secondary memory.
• Secondary memory such as floppy disks, magnetic
disk, etc., is located outside the computer.

Copyright@ Amity University


Memory
• Primary memory is more expensive than secondary
memory. Because of this the size of primary memory
is less than that of secondary memory.

• Computer memory is used to store two things:


i) instructions to execute a program and
ii) data. When the computer is doing any job, the data
that have to be processed are stored in the primary
memory. This data may come from an input device
like keyboard or from a secondary storage device like
a floppy disk.
Copyright@ Amity University
Memory
• Read Only Memory (ROM): There is another memory
in computer, which is called Read Only Memory
(ROM). Again it is the ICs inside the PC that form the
ROM. The storage of program and data in the ROM is
permanent.
• Registers: The CPU processes data and instructions
with high speed, there is also movement of data between
various units of computer. It is necessary to transfer the
processed data with high speed. So the computer uses a
number of special memory units called registers.

Copyright@ Amity University


Memory
• Registers are not part of the main memory but they
store data or information temporarily and pass it on as
directed by the control unit.
• Cache Memory: The speed of CPU is extremely high
compared to the access time of main memory.
Therefore the performance of CPU decreases due to the
slow speed of main memory. To decrease the mismatch
in operating speed, a small memory chip is attached
between CPU and Main memory whose access time is
very close to the processing speed of CPU. It is called
CACHE memory. CACHE memories are accessed
much faster than conventional RAM.
Copyright@ Amity University
Flip-Flops

• In digital circuits, a flip-flop is a term referring to


an electronic circuit that has two stable states and
thereby is capable of serving as one bit of memory.

• A flip-flop is usually controlled by one or two


control signals and/or a gate or clock signal.
The output often includes thecomplement as well as
the normal output.

Copyright@ Amity University


Flip-Flops

• Flip-flops can be either simple (transparent) or


clocked. Simple flip-flops can be built around a pair
of cross-coupled inverting elements.

• Clocked flip-flops are typically implemented as


master–slave devices where two basic flip-flops (plus
some additional logic) collaborate to make it
insensitive to spikes and noise between the short
clock transitions.

Copyright@ Amity University


Flip-Flops
• RS (Reset-Set) flip-flop: The fundamental latch is the
simple RS flip-flop (also commonly known as SR flip-
flop), where R and S stand for reset and set,
respectively. It can be constructed from a pair of cross-
coupled NOR logic gates. The stored bit is present on
the output marked Q.
• D (Delay) flip-flop: The D flip-flop is the most
common flip-flop in use today. It is better known
as delay flip-flop or data latch. It is called the Dflip-
flop for this reason, since the output takes the value of
the D input or Data input, and Delays it by one clock
cycle.
Copyright@ Amity University
Flip-Flops
• T (Toggle) flip-flop: If the T input is high, the T flip-
flop changes state ("toggles") whenever the clock input
is strobed. If the T input is low, the flip-flop holds the
previous value.

• J-K flip-flop: The JK flip-flop augments the behavior


of the SR flip-flop (J=Set, K=Reset) by interpreting
the S = R = 1 condition as a "flip" or toggle command.
Specifically, the combination J = 1, K = 0 is a
command to set the flip-flop; the combination J = 0, K
= 1 is a command to reset the flip-flop.
Copyright@ Amity University
Flip-Flops
• Master-Slave flip-flop: A master–slave flip-flop is
created by connecting two flip-flops in series, and
inverting the enable input to one of them. It is called
master–slave because the second latch in the series
only changes in response to a change in the first
(master) latch. At a time only one flip-flop works. In
other way, we can say that if one flip-flop is active
then other flip flop will be inactive state.
• A single flip-flop can be used to store one bit, or
binary digit, of data. Any one of the flip-flop type can
be used to build any of the others.
Copyright@ Amity University
Registers
• In computer architecture, a register is a processor
register (or general purpose register) which is a
small amount of storage available on the CPU whose
contents can be accessed more quickly than storage
available elsewhere.

• Processor registers are at the top of the memory


hierarchy, and provide the fastest way for a CPU to
access data. The term is often used to refer only to the
group of registers that are directly encoded as part of
an instruction, as defined by the instruction set.

Copyright@ Amity University


Registers
• Registers are normally measured by the number
of bits they can hold, for example, an "8-bit register"
or a "32-bit register". Registers are now usually
implemented as a register file, but they have also
been implemented using individual flip-flops, high
speed core memory, thin film memory, and other
ways in various machines.

• A processor often contains several kinds of registers,


that can be classified accordingly to their content or
instructions that operate on them.

Copyright@ Amity University


Registers
• User-accessible Registers - The most common
division of user-accessible registers is into data
registers and address registers.
• Data registers are used to hold numeric values such
as integer and floating-point values. In some older
and low end CPUs, a special data register, known as
the accumulator, is used implicitly for many
operations.
• Address registers hold addresses and are used by
instructions that indirectly access memory.

Copyright@ Amity University


Registers
• Conditional registers hold truth values often used to
determine whether some instruction should or should
not be executed.
• General purpose registers (GPRs) can store both
data and addresses, i.e., they are combined
Data/Address registers.
• Floating point registers (FPRs) store floating
point numbers in many architectures.
• Constant registers hold read-only values such as
zero, one, or pi.

Copyright@ Amity University


Registers
• Vector registers hold data for vector
processing done by SIMD instructions (Single
Instruction, Multiple Data).
• Special purpose registers ( SPR ) hold
program state; they usually include the program
counter (aka instruction pointer), stack pointer,
and status register (aka processor status word).
In embedded microprocessors, they can also
correspond to specialized hardware elements.

Copyright@ Amity University


Registers
• In some architectures, model-specific
registers (also called machine-specific
registers) store data and settings related to the
processor itself. Because their meanings are
attached to the design of a specific processor,
they cannot be expected to remain standard
between processor generations.
• Control and status registers - It has three
types. Program counter, instruction registers,
Program status word (PSW).
Copyright@ Amity University
Registers
• Registers related to fetching information
from RAM, a collection of storage registers
located on separate chips from the CPU
are
• Memory buffer register
• Memory data register
• Memory address register
• Memory Type Range Registers (MTRR)

Copyright@ Amity University


Counters
• In digital logic and computing, a counter is a device
which stores (and sometimes displays) the number of
times a particular event or process has occurred, often
in relationship to a clock signal.

• In practice, there are two types of counters:


 Up counters, which increase (increment) in value
 Down counters, which decrease (decrement) in value

Copyright@ Amity University


Counters
• In electronics, counters can be implemented quite
easily using register-type circuits such as the flip-
flop, and a wide variety of designs exist, e.g.:

 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

Copyright@ Amity University


Counters

• Decade counter – A decade counter is one that counts


in decimal digits, rather than binary.

• Up–down counter – A counter that can change state in


either direction, under the control of an up–down
selector input, is known as an up–down counter. When
the selector is in the up state, the counter increments its
value; when the selector is in the down state, the
counter decrements the count.

Copyright@ Amity University


Counters
• Johnson counter – A Johnson counter is a modified
ring counter, where the output from the last stage is
inverted and fed back as input to the first stage.
• Ring Counter - A ring counter is a shift register (a
cascade connection of flip-flops) with the output of
the last one connected to the input of the first, that is,
in a ring. Typically a pattern consisting of a single 1
bit is circulated, so the state repeats every N clock
cycles if N flip-flops are used. It can be used as a
cycle counter of N states.

Copyright@ Amity University


Thank You

Copyright@ Amity University

You might also like