All Unit CAO
All Unit CAO
Architecture(COA)
BCA-203
Unit-1
Digital Electronics
• Digital electronics is the branch of electronics that deals with the study of
digital signals and the components that use or create them.
Computer Architecture Vs Computer Organization
• Computer architecture refers to the design of the internal workings of a
computer system, including the CPU, memory, and other hardware
components.
• There are two main types of signals: Analog signal and Digital signal.
Analog Signals
• Analog signals were used in many systems to produce signals to carry
information.
• These signals are continuous in both values and time.
• The use of analog signals has declined with the arrival of digital signals.
• In short, to understand analog signals – all signals that are natural or
come naturally are analog signals.
Digital Signals
• Unlike analog signals, digital signals are not continuous, but signals are
discrete in value and time.
• These signals are represented by binary numbers and consist of different
voltage values.
Boolean Algebra
• Boolean algebra is the category of algebra in which the variable’s values
are the truth values, true and false, ordinarily denoted 1 and 0
respectively.
• Boolean algebra was invented by George Boole in 1854.
• It is used to analyze and simplify digital circuits or digital gates.
• It is also called Binary Algebra or logical Algebra.
• It has been fundamental in the development of digital electronics.
• The important operations performed in Boolean algebra are: conjunction
(∧), disjunction (∨) and negation (¬).
• Hence, this algebra is far way different from elementary algebra where
the values of variables are numerical and arithmetic operations like
addition, subtraction is been performed on them.
Boolean Algebra Operations
The basic operations of Boolean algebra are as follows:
• Conjunction or AND operation
• Disjunction or OR operation
• Negation or Not operation
Boolean Expression
• A logical statement that results in a Boolean value, either be True or
False, is a Boolean expression.
• Boolean expressions are the statements that use logical operators, i.e.,
AND, OR, XOR and NOT. Thus, if we write X AND Y = True, then it is a
Boolean expression.
Truth Table
• The truth table is a table that gives all the possible values of logical
variables and the combination of the variables.
• It is possible to convert the Boolean equation into a truth table. The
number of rows in the truth table should be equal to 2n, where “n” is the
number of variables in the equation.
• For example, if a Boolean equation consists of 3 variables, then the
number of rows in the truth table is 8. (i.e.,) 23 = 8.
Boolean Algebra Truth Table
Boolean Algebra Rules
• Variable used can have only two values. Binary 1 for HIGH and Binary 0 for
LOW.
• The complement of a variable is represented by an overbar.
• OR-ing of the variables is represented by a plus (+) sign between them.
For example, the OR-ing of A, B, and C is represented as A + B + C.
• Logical AND-ing of the two or more variables is represented by writing a
dot between them, such as A.B.C. Sometimes, the dot may be omitted like
ABC.
Laws of Boolean Algebra
• Commutative law
• Associative law
• Distributive law
• AND law
• OR law
• Inversion law
• De Morgan’s Law/Theorem
• Absorption Law
Commutative Law
This law states that no matter in which order we use the variables. It means
that the order of variables doesn't matter. The order of the input variables
does not matter at all.
Solution:
AB + A (B+C) + B (B+C)
AB + AB + AC + BB + BC {Distributive law; A (B+C) = AB+AC, B (B+C) =
BB+BC}
AB + AB + AC + B + BC {Idempotent law; BB = B}
AB + AC + B + BC {Idempotent law; AB+AB = AB}
AB + AC +B {Absorption law; B+BC = B}
B + AC {Absorption law; AB+B = B}
Hence, the simplified Boolean function will be B + AC.
Logic Gates
• A logic gate is a digital gate that allows data to be transferred. Logic gates,
use logic to determine whether or not to pass a signal.
• A logic gate is a device that acts as a building block for digital circuits.
• Logic Gates are important digital devices that are mainly based on the
Boolean function.
• Logic gates are used to carry out logical operations on single or multiple
binary inputs and give one binary output.
• In simple terms, logic gates are the electronic circuits in a digital system.
Types of Logic Gates
Logic
Gates
OR NOR XNOR
NOT
OR Gate
• An OR gate is a digital circuit that has two or more inputs and produces an
output, which is the logical OR of all those inputs.
• In an OR gate, the output of an OR gate attains state 1 if one or more
inputs attain state 1.
• This logical OR is represented with the symbol ‘+’.
• The Boolean expression of the OR gate is Y = A + B, read as Y equals A ‘OR’
B.
AND Gate
• An AND gate is a digital circuit that has two or more inputs and produces
an output, which is the logical AND of all those inputs.
• In the AND gate, the output of an AND gate attains state 1 if and only if all
the inputs are in state 1.
• The Boolean expression of AND gate is Y = A.B
NOT Gate
• A NOT gate is a digital circuit that has single input and single output.
• The output of NOT gate is the logical inversion of input.
• Hence, the NOT gate is also called as inverter.
• In a NOT gate, the output of a NOT gate attains state 1 if and only if the
input does not attain state 1.
• The Boolean expression is Y= A’
• It is read as Y equals NOT A.
Universal Gates
• A universal gate is a gate which can implement any Boolean function
without need to use any other gate type.
• The NAND and NOR gates are universal gates.
• In practice, this is advantageous since NAND and NOR gates are
economical and easier to fabricate and are the basic gates used in all IC
digital logic families.
NAND Gate
• The NAND gate represents the complement of the AND operation.
• Its name is an abbreviation of NOT AND.
• The graphic symbol for the NAND gate consists of an AND symbol with a
bubble on the output, denoting that a complement operation is
performed on the output of the AND gate.
• The Boolean expression of the NAND gate is
NOR Gate
• The NOR gate represents the complement of the OR operation.
• Its name is an abbreviation of NOT OR.
• The graphic symbol for the NOR gate consists of an OR symbol with a
bubble on the output, denoting that a complement operation is
performed on the output of the OR gate.
• The Boolean expression of the NOR gate is:
Exclusive-OR Gate
• XOR gate (sometimes EOR, or EXOR and pronounced as Exclusive OR) is a
digital logic gate that gives a true (1 or HIGH) output when the number of
true inputs is odd.
• An XOR gate implements an exclusive or ( ) from mathematical logic; that
is, a true output results if one, and only one, of the inputs to the gate is
true.
• The Boolean expression of the XOR gate is:
Exclusive-NOR Gate
• Exclusive-NOR gate or XNOR gate is formed by combining the
Exclusive-OR gate (XOR gate) and the NOT gate.
• The output of Ex-NOR gate is ‘1’, when both inputs are same.
• The Boolean expression of the XNOR gate:
NAND Gate is a Universal Gate
• To prove that any Boolean function can be implemented using only NAND
gates, we will show that the AND, OR, and NOT operations can be
performed using only these gates.
Implementing NOT gate using NAND only
Implementing AND gate using NAND only
Implementing OR gate using NAND only
Implementing NOT Gate using NAND Gate
(A.A)'=A' (Idempotent Law)
Implementing AND Gate using NAND Gate
((AB)' (AB)')'= ((AB)')' (By Idempotent Law)
= AB (Involution Law)
Implementing OR Gate using NAND Gate
((AA)'(BB)')'= (A'B')’ (By Idempotent Law)
= A''+B'' (By De Morgan’s Law)
= A+B (By involution Law)
Implementing NOT Gate using NOR Gate
(A+A)'=A' (By Idempotent Law)
Implementing AND Gate using NOR Gate
((A+A)'(B+B)')'= (A'+B')' (By Idempotent Law)
= A’’.B’’ (By De Morgan’s Law)
= A.B (By involution Law)
Implementing OR Gate using NOR Gate
((A+A)'+(B+B)')'= (A’.B’)’ (By Idempotent Law)
= A’’+B’’ (By De Morgan’s Law)
= A+B (By involution Law)
Equivalent Gates
• NAND gate is equivalent to the inverted input OR gate:
• AND gate is equivalent to the inverted input NOR gate
• NOR gate is equivalent to the inverted input AND gate.
• OR gate is equivalent to the inverted input NAND gate:
Applications of Logic Gates
• Logic gates are used in microcontrollers, microprocessors,
electronic and electrical project circuits, and embedded system
applications. The basic logic gates are categorized into seven types
as AND, OR, XOR, NAND, NOR, XNOR, and NOT.
• These are used in circuits where various power sources are
available to perform the similar action. Implemented in alarm
systems and intrusion detection equipment's. Used in industrial
plants for some protective measures.
Minterm and Maxterm
• There are two ways in which we can put the Boolean function.
• These ways are the minterm canonical form and maxterm canonical form.
• The product of all literals, either with complement or without
complement, is known as minterm.
• The sum of all literals, either with complement or without complement, is
known as maxterm.
Minterm
• A minterm is a specific type of Boolean expression that represents
a unique combination of variables in a truth table for which the
output is TRUE (or '1’).
• Each minterm is an AND (product) of all the input variables of a
function, where each variable is either in its original
(uncomplemented) form or in its complemented (negated) form.
• For a Boolean function with n variables, there will be 2n minterms
since each variable can be in one of two states (0 or 1) and there
are n variables.
• Example:
• Consider a function with 2 variables A and B. The possible
minterms are:
1. A′B′: Corresponds to A=0,B=0
2. A′B: Corresponds to A=0,B=1
3. AB′: Corresponds to A=1,B=0
4. AB: Corresponds to A=1,B=1
• For a 3-variable function with A,B, and C as inputs, there would be
8 minterms:
1. A′B′C′
2. A′B′C
3. A′BC′
4. A′BC
5. AB′C′
6. AB′C
7. ABC′
8. ABC
Each minterm corresponds to a unique row in the truth table of the
function.
Maxterm
• A maxterm is a specific type of Boolean expression that represents
a unique combination of variables in a truth table for which the
output is FALSE (or '0'). Each maxterm is an OR (sum) of all the
input variables of a function, where each variable is either in its
original (uncomplemented) form or in its complemented (negated)
form.
• For a Boolean function with n variables, there will be 2n maxterms,
just like minterms, since each variable can be in one of two states
(0 or 1) and there are n variables.
• Example:
• Consider a function with 2 variables A and B. The possible
maxterms are:
1.(A+B): Corresponds to A=0,B=0
2.(A+B′): Corresponds to A=0,B=1
3.(A′+B): Corresponds to A=1,B=0
4.(A′+B′): Corresponds to A=1,B=1
• For a 3-variable function with A,B, and C as inputs, the possible
maxterms are:
1. (A+B+C)
2. (A+B+C′)
3. (A+B′+C)
4. (A+B′+C′)
5. (A′+B+C)
6. (A′+B+C′)
7. (A′+B′+C)
8. (A′+B′+C′)
This is the PoS expression for the given truth table. It should be
noted that in the PoS form, the product expression will be '0' if any of
the OR expressions inside the parentheses evaluate to '0'.
Karnaugh Map
• K-Map was developed by Maurice Karnaugh in the year of 1953.
• A Karnaugh map or a K-map refers to a pictorial method that is utilised to
minimise various Boolean expressions without using the Boolean algebra
theorems along with the equation manipulations.
• A Karnaugh map can be a special version of the truth table.
• We can easily minimise various expressions that have 2 to 4 variables
using a K-map.
Rules for creating groups in K-map
• Groups can be vertical or Horizontal but can’t be diagonal.
• Overlapping Allowed.
• Groups should be as large as possible.
• Group must contain 2n cells.
Solving an Expression Using K-Map
• Here are the steps that are used to solve an expression using the
K-map method:
1. Select a K-map according to the total number of variables.
2. Identify maxterms or minterms as given in the problem.
3. For SOP, put the 1’s in the blocks of the K-map with respect to the
minterms (elsewhere 0’s).
4. For POS, putting 0’s in the blocks of the K-map with respect to the
maxterms (elsewhere 1’s).
5. Making rectangular groups that contain the total terms in the power
of two, such as 2,4,8 ..(except 1) and trying to cover as many
numbers of elements as we can in a single group.
6. From the groups that have been created in step 5, find the product
terms and then sum them up for the SOP form.
SoP FORM
• 3 variables K-map:
Z = ∑A, B, C (1, 3, 6, 7)
• From the red group, the product term would be — A’C
• From the purple group, the product term would be — AB
• If we sum these product terms, then we will get this final
expression (A’C+AB)
2. 4 variables K-map:
F (P, Q, R, S) = ∑(0, 2, 5, 7, 8, 10, 13, 15)
• From the red group, the product term would be — QS
• From the purple group, the product term would be — Q’S’
• If we sum these product terms, then we will get this final
expression (QS + Q’S’)
• Minimize the following boolean function-
• F(A, B, C, D) = Σm(0, 1, 2, 5, 7, 8, 9, 10, 13, 15)
F(A, B, C, D)= BD + C’D + B’D’
• Minimize the following boolean function-
• F(A, B, C, D) = Σm(0, 1, 3, 5, 7, 8, 9, 11, 13, 15)
F(A, B, C, D)= D + B’C’
• Simplify the following 4-variable Boolean function in SOP form to obtain the
minimal SOP expression.
• F(A,B,C,D)= Σm(0,1,3,5,6,7,10,13,14,15)
• F=A’D+BD+BC+ACD’+A’B’C’
• Minimize: A’B’C’D’+A’B’CD’+AB’C’D’+AB’CD’
• Minimize: A’B’C’D’+A’B’C’D+A’B’CD+A’B’CD’+AB’C’D’+AB’C’D+AB’CD+AB’CD’
• Minimize: A’B’C’D’+A’B’C’D+A’B’CD+A’B’CD’+BC’D’+BCD’+AB’C’D’+AB’D+AB’CD’
• Minimize: A’B’C’D’+AB’CD’+AB’C’D’+ABCD
• Minimize: A’B’C’D’+A’B’C’D+A’BC’D+A’BCD+ABCD+ABCD’+AB’C’D’+AB’CD’
• Minimize: A’B’C’D’+A’B’C’D+A’B’CD+A’BC’D’+A’BC’D+A’BCD+ABC’D’+ABC’D+ABCD
• Minimize: A’B’C’D’+A’B’CD+A’BC’D’+A’BCD+ABC’D’+ABC’D+ABCD+AB’C’D’+AB’CD
• Minimize: C’+ABCD
PoS FORM
1. 3 variables K-map
F (A, B, C) = π(0,3,6,7)
• From the purple group, the terms would be- AB
• If we take the complement of these two A’B’
• And then sum up them (A’ + B’)
• From the blue group, the terms would be- BC
• When we take the complement of these terms- B’C’
• And then sum them up (B’ + C’)
• From the red group, the terms would be A’ B’ C’
• If we take the complement of the two terms A B C
• And then sum them up (A + B + C)
• If we take the product of these three terms, then we will get this
final expression – (A’ + B’) (B’ + C’) (A + B + C)
2. 4 variables K-map
F (A, B, C, D) = π (3, 5, 7, 8, 10, 11, 12, 13)
• From the blue group, the terms would be BC’D
• We take their complement and then sum them (B’ + C+ D’)
• From the purple group, the terms would be AB’C
• We take their complement and then sum them (A’+B+C’)
• From the red group, the terms would be AC’D’
• We take their complement and then sum them (A’+C+D)
• From the pink group, the terms would be A’CD
• We take their complement and then sum them (A+C’+D’)
• Finally, we will express these in the form of the product –
(B’+C+D’).(A’+B+C’).(A’+C+D).(A+C’+D’)
Don’t Care Condition
• One of the very significant and useful concepts in simplifying the output
expression using K-Map is the concept of “Don’t Care”.
• The “Don’t Care” conditions allow us to replace the empty cell of a K-
Map to form a grouping of the variables which is larger than that of
forming groups without don’t care.
• A Don’t Care cell can be represented by a cross(X) or minus(-) or phi(Φ)
in K-Maps representing an invalid combination.
• A Don’t Care cell can be represented by a cross(X) or minus(-) or
phi(Φ) in K-Maps representing an invalid combination.
Minimize the following function in SOP minimal form using K-
Maps: F(A, B, C, D) = m(1, 2, 6, 7, 8, 13, 14, 15) + d(3, 5, 12)
• Therefore,
f = AC'D' + A'D + A'C + AB
• SOP Form: BC’+A’C’D+ABD+A’CD’
Take Complement
Take Complement
• Clock Signal: Many sequential circuits are synchronized by a clock signal, which
controls when the circuit can transition from one state to another.
Types of Sequential Logic Circuits
• Flip-Flops: The simplest memory elements, storing a single bit of information.
Types include SR, JK, D, and T flip-flops.
• Registers: Groups of flip-flops used to store multi-bit values.
• Counters: Sequential circuits that increment or decrement a number stored in
a register, often in response to a clock signal.
• Shift Registers: A series of flip-flops where the output of one flip-flop is the
input of the next.
Adder
• An adder is a digital circuit that performs addition of numbers.
• In many computers and other types of processors, adders are used not
only in the arithmetic logic units but also in other parts of the processor,
where they compute addresses, table indices, and similar operations.
• There are several types of adder designs, including:
Half Adder
Full Adder
Ripple Carry Adder
Carry Lookahead Adder (CLA)
Carry Select Adder
Carry Skip Adder
Binary Coded Decimal (BCD) Adder
Half Adder
• The half adder is a basic building block for more complex adder circuits such as
full adders and multiple-bit adders.
• It performs binary addition of two single-bit inputs, A and B, and provides two
outputs, SUM and CARRY.
• The SUM output is the least significant bit (LSB) of the result, which is the XOR
of the two inputs A and B.
• The CARRY output is the most significant bit (MSB) of the result, indicating
whether there was a carry-over from the addition of the two inputs. The
CARRY output is the AND of the two inputs A and B.
• Sum = A XOR B
• Carry = A AND B
Advantages of Half Adder
• The half adder, while simple on its own, forms a fundamental
building block for designing more complex digital addition circuits.
• For example, two half adders can be combined with an OR gate to
create a full adder, which can then be used to construct multi-bit
binary adders like the ripple-carry adder.
Limitations of Half Adder
• The half adder cannot accept a carry input from a previous stage.
Hence, it's only useful for adding the least significant bits in a multi-
bit binary addition where there is no carry input. For all other bits, a
full adder, which can handle a carry input, is used.
Half Adder using NAND Gates only
Half Adder using NOR Gates only
Full Adder
• The half adder is used to add only two numbers. To overcome this
problem, the full adder was developed. The full adder is used to add three
1-bit binary numbers A, B and Carry C. The full adder has three input
states and two output states i.e., Sum and Carry.
• Sum=x’y’z+xy’z’+x’yz’+xyz = x y z
• Carry=xy+xz+yz = (x y)z+xy
Half Subtractor
• The half subtractor is also a building block for subtracting two
binary numbers.
• It has two inputs and two outputs. This circuit is used to subtract
two single bit binary numbers A and B. The 'diff' and 'borrow' are
two output states of the half subtractor.. In the subtraction (A-B), A is
called a Minuend bit and B is called as Subtrahend bit.
The Boolean expression of the Half Subtractor circuit is given
below:
• Diff= A XOR B (A⊕B)
• Borrow= not-A AND B (A'.B)
Half Subtractor using NAND Gates only
Half Subtractor using NOR Gates only
Full Subtractor
• The Half Subtractor is used to subtract only two numbers. To overcome
this problem, a full subtractor was designed. The full subtractor is used to
subtract three 1-bit numbers A, B, and C, which are minuend, subtrahend,
and borrow, respectively. The full subtractor has three input states and
two output states i.e., diff and borrow.
Diff(D) = x ⊕ y ⊕ z
A 0 =A.0’ + A’.0 = A
A 1=A.1’ + A’.1 = A’
8x1
Multiplexer
2x1 Multiplexer
• In 2×1 multiplexer, there are only two inputs, i.e., A0 and A1, 1 selection
line, i.e., S0 and single outputs, i.e., Y.
• On the basis of the combination of inputs which are present at the
selection line S0, one of these 2 inputs will be connected to the output.
4x1 Multiplexer
• In the 4×1 multiplexer, there is a total of four inputs, i.e., A0, A1, A2, and
A3, 2 selection lines, i.e., S0 and S1 and single output, i.e., Y.
• On the basis of the combination of inputs that are present at the
selection lines S0 and S1, one of these 4 inputs are connected to the
output.
8x1 Multiplexer
• In the 8 to 1 multiplexer, there are total eight inputs, i.e., A0, A1, A2, A3,
A4, A5, A6, and A7, 3 selection lines, i.e., S0, S1and S2 and single output,
i.e., Y.
• On the basis of the combination of inputs that are present at the
selection lines S0, S1 and S2, one of these 8 inputs are connected to the
output.
16x1 Multiplexer
• In the 16 to 1 multiplexer, there are total of 16 inputs, i.e., A0, A1 , …,
A16, 4 selection lines, i.e., S0, S1, S2, and S3 and single output, i.e., Y.
• On the basis of the combination of inputs that are present at the
selection lines S0, S1, S2 and S3 one of these 16 inputs will be connected
to the output.
8 ×1 Multiplexer using 4×1 and 2×1 Multiplexer
• We can implement the 8×1 multiplexer using a lower order multiplexer.
• To implement the 8×1 multiplexer, we need two 4×1 multiplexers and
one 2×1 multiplexer.
• The 4×1 multiplexer has 2 selection lines, 4 inputs, and 1 output.
• The 2×1 multiplexer has only 1 selection line, 2 inputs and 1 output.
16×1 Multiplexer using 8×1 and 2×1 Multiplexer
• We can implement the 16×1 multiplexer using a lower order multiplexer.
• To implement the 8×1 multiplexer, we need two 8×1 multiplexers and one
2×1 multiplexer.
• The 8×1 multiplexer has 3 selection lines, 4 inputs, and 1 output.
• The 2×1 multiplexer has only 1 selection line, 2 inputs and 1 output.
Applications of Multiplexer
• Data Routing
• Logic Function Generator
• Control Sequencer
• Parallel to Serial Converter
Demultiplexer
• A De-multiplexer is a combinational circuit that has only 1 input line and
2N output lines.
• Simply, the multiplexer is a single-input and multi-output combinational
circuit.
• The information is received from the single input lines and directed to the
output line.
• On the basis of the values of the selection lines, the input will be
connected to one of these outputs.
• De-multiplexer is opposite to the multiplexer.
1x2 De-
Multiplexer
1x8 De-
Multiplexer
1x2 Demultiplexer
• In the 1 to 2 De-multiplexer, there are only two outputs, i.e., Y0, and Y1, 1
selection lines, i.e., S0, and single input, i.e., A.
• On the basis of the selection value, the input will be connected to one of
the outputs.
1x4 Demultiplexer
• In 1 to 4 De-multiplexer, there are total of four outputs, i.e., Y0, Y1, Y2,
and Y3, 2 selection lines, i.e., S0 and S1 and single input, i.e., A.
• On the basis of the combination of inputs which are present at the
selection lines S0 and S1, the input be connected to one of the outputs.
1x8 Demultiplexer
• In 1 to 8 De-multiplexer, there are total of eight outputs, i.e., Y0, Y1, Y2, Y3,
Y4, Y5, Y6, and Y7, 3 selection lines, i.e., S0, S1and S2 and single input, i.e.,
A.
• On the basis of the combination of inputs which are present at the
selection lines S0, S1 and S2, the input will be connected to one of these
outputs.
1x16 Demultiplexer
• In 1×16 de-multiplexer, there are total of 16 outputs, i.e., Y0, Y1, …, Y16,
4 selection lines, i.e., S0, S1, S2, and S3 and single input, i.e., A.
• On the basis of the combination of inputs which are present at the
selection lines S0, S1, and S2, the input will be connected to one of
these outputs.
1×8 De-multiplexer using 1×4 and 1×2 de-multiplexer
• We can implement the 1×8 de-multiplexer using a lower order de-
multiplexer.
• To implement the 1×8 de-multiplexer, we need two 1×4 de-
multiplexer and one 1×2 de-multiplexer.
• The 1×4 multiplexer has 2 selection lines, 4 outputs and 1 input.
• The 1×2 de-multiplexer has only 1 selection line, 2 outputs and 1
input.
1×16 De-multiplexer using 1×8 and 1×2 De-multiplexer
• We can implement the 1×16 de-multiplexer using a lower order de-
multiplexer.
• To implement the 1×16 de-multiplexer, we need two 1×8 de-multiplexer
and one 1×2 de-multiplexer.
• The 1×8 multiplexer has 3 selection lines, 1 input, and 8 outputs.
• The 1×2 de-multiplexer has only 1 selection line, 1 input and 2 outputs.
Decoder
• It is a Multi-input & Multi-output device.
• Decoder is a combinational circuit that converts n lines of input into 2n
lines of output.
• Applications of decoders are converting binary code to other codes.
• Binary to Octal (3x8)
• Binary to Hexadecimal (4x16)
• Binary to Decimal (4x10)
Encoder
• It is a Multi-input & Multi-output device.
• Encoder is a combinational circuit that converts 2n lines of input into n
lines of output.
• Applications of encoders are converting other codes to Binary codes.
• Octal to Binary (8x3)
• Hexadecimal to Binary (16x4)
• Decimal to Binary (10x4)
Latch
• Latches are digital circuits that store a single bit of information and hold its value until
it is updated by new input signals.
• They are used in digital systems as temporary storage elements to store binary
information. Latches can be implemented using various digital logic gates, such as
AND, OR, NOT, NAND, and NOR gates.
There are two types of latches:
1. S-R (Set-Reset) Latches: S-R latches are the simplest form of latches and are
implemented using two inputs: S (Set) and R (Reset). The S input sets the output to 1,
while the R input resets the output to 0. When both S and R are at 1, the latch is said
to be in an “undefined” state.
2. D (Data) Latches: D latches are also known as transparent latches and are
implemented using two inputs: D (Data) and a clock signal. The output of the latch
follows the input at the D terminal as long as the clock signal is high. When the clock
signal goes low, the output of the latch is stored and held until the next rising edge of
the clock.
• Latches are widely used in digital systems for various applications, including data
storage, control circuits, and flip-flop circuits.
• They are often used in combination with other digital circuits to implement
sequential circuits, such as state machines and memory elements.
• In summary, latches are digital circuits that store a single bit of information and hold
its value until it is updated by new input signals.
• There are two types of latches: S-R (Set-Reset) Latches and D (Data) Latches, and
they are widely used in digital systems for various applications.
• Latches are basic storage elements that operate with signal levels (rather than signal
transitions).
• Latches controlled by a clock transition are flip-flops.
• Latches are level-sensitive devices. Latches are useful for the design of asynchronous
sequential circuit.
SR (Set-Reset) Latch
• They are also known as preset and clear states. The SR latch forms the basic building
blocks of all other types of flip-flops.
• SR Latch is a circuit with:
(i) 2 cross-coupled NOR gate or 2 cross-coupled NAND gate.
(ii) 2 input S for SET and R for RESET.
(iii) 2 output Q, Q’.
SR Latch Truth Table
Advantages of Latches
1. Easy to Implement: Latches are simple digital circuits that can be easily implemented
using basic digital logic gates.
2. Low Power Consumption: Latches consume less power compared to other sequential
circuits such as flip-flops.
3. High Speed: Latches can operate at high speeds, making them suitable for use in high-
speed digital systems.
4. Low Cost: Latches are inexpensive to manufacture and can be used in low-cost digital
systems.
5. Versatility: Latches can be used for various applications, such as data storage, control
circuits, and flip-flop circuits.
Disadvantages of Latches
1. No Clock: Latches do not have a clock signal to synchronize their operations, making
their behavior unpredictable.
2. Unstable State: Latches can sometimes enter into an unstable state when both
inputs are at 1. This can result in unexpected behavior in the digital system.
3. Complex Timing: The timing of latches can be complex and difficult to specify,
making them less suitable for real-time control applications.
Flip Flops
• Flip-flops and Latches are circuits that have two stable states that can store state
information – a bistable multivibrator.
• The circuit can be made to change state by signals applied to one or more control
inputs and will output its state (often along with its logical complement too). It is the
basic storage element in sequential logic.
• Flip-flops and latches are fundamental building blocks of digital electronics systems
used in computers, communications, and many other types of systems.
Types of Flip Flops
• SR Flip Flop
• JK Flip Flop
• D Flip Flop
• T Flip Flop
S R Flip Flop
• It is a Flip Flop with two inputs, one is S and other is R. S here stands for
Set and R here stands for Reset.
• Set basically indicates set the flip flop which means output 1 and reset
indicates resetting the flip flop which means output 0.
• Here clock pulse is supplied to operate this flop flop, hence it is clocked
flip flop.
Block Diagram of SR Flip Flop
Working of SR Flip Flop
• Case 1: Let’s say, S=0 and R=0, then output of both AND gates will be 0
and the value of Q and Q’ will be same as their previous value, i.e, Hold
state.
• Case 2: Let’s say, S=0 and R=1, then output of both AND gates will be 1
and 0, correspondingly the value of Q will be 0 as one of input is 1 and
it is a NOR gate so it will ultimately gives 0, hence Q gets 0 value,
similarly Q’ will be 1.
• Case 3: Let’s say, S=1 and R=0, then output of both AND gates will be 0
and 1, correspondingly the value of Q’ will be 0 as one of input to NOR
gate is 1, so output will be 0 ultimately and this 0 value will go as input
to upper NOR gate, and hence Q will become 1.
• Case 4: Let’s say, S=1 and R=1, then output of both AND gates will be 1
and 1 which is invalid, as the outputs should be complement of each
other.
Applications of SR Flip Flop
• Register: SR Flip Flop used to create register. Designer can create any
size of register by combining SR Flip Flops.
• Counters: SR Flip Flops used in counters. Counters counts the number
of events that occurs in a digital system.
• Memory: SR Flip Flops used to create memory which are used to
store data, when the power is turned off.
• Synchronous System: SR Flip Flop are used in synchronous system
which are used to synchronise the operation of different component.
JK Flip Flop
• The “JK flip flop,” also known as the Jack Kilby flip flop, is a sequential
logic circuit designed by Jack Kilby during his tenure at Texas Instruments
in the 1950s.
• This flip flop serves the purpose of storing and manipulating binary
information within digital systems.
• JK flip flop operates on sequential logic principle, where the output is
dependent not only on the current inputs but also on the previous state.
• There are two inputs in JK Flip Flop Set and Reset denoted by J and K. It
also has two outputs Output and complement of Output denoted by Q
and Q̅.
• The internal circuitry of a JK Flip Flop consists of a combination of logic
gates, usually NAND gates.
• JK flip flop comprises four possible combinations of inputs: J=0, K=0; J=0,
K=1; J=1, K=0; and J=1, K=1. These input combinations determine the
behavior of flip flop and its output.
• J=0, K=0: In this state, flip flop retains its preceding state. It neither sets
nor resets itself, making it stable.
• J=0, K=1: This input combination forces flip flop to reset, resulting in Q=0
and Q̅=1. It is often referred to as the “reset” state.
• J=1, K=0: Here, flip flop resides in the set mode, causing Q=1 and Q̅=0. It
is known as the “set” state.
• J=1, K=1: This combination toggles flip flop. If the previous state is Q=0, it
switches to Q=1 and vice versa. This makes it valuable for frequency
division and data storage applications.
JK Flip Flop Truth Table
JK Flip Flop Characteristic Table
Excitation Table of JK Flip Flop
Advantages of JK Flip Flop
• Versatility: As discussed above, JK-flipflops can be used as a basic memory element or
a primary building block of further complex memory design. It is very much adaptive as
it can be operated in both synchronous and asynchronous modes.
• Toggle Functionality: The application which are required to get output as its
complement of input that also can be developed by JK-flipflops as when J=K=1 it
triggers toggle state which gives output which is complement with it’s each clock pulse.
• Error Detection and Correction: We can use a complex circuit built by JK-flipflops
which can detect and correct information during data-transmission.
Disadvantages of JK Flip-Flop
• Complexity: Compared to other types of flipflops(D,T, SR), JK flipflop requires
additional logic gates to implement which consumes extra memory resources and
increases complexity to operate.
• Propagation Delay: This is the major problem present in JK-FF. Propagation delay
results a timing delay in certain application which are time-flow sensitive.
• Race Problem: This issue arises when the clock input’s timing pulse isn’t given enough
time to turn “Off” before the output Q’s state is altered.
Applications of JK Flip Flop
• Counters: The JK flip-flop can be used in conjunction with other digital logic
gates to create a binary counter. This makes it useful in real-time applications
such as timers and clocks.
• Data storage: The JK flip-flop can be used to store temporary data in digital
systems.
• Synchronization: The JK flip-flop can be used to synchronize data signals
between two digital circuits, ensuring that they are operating on the same clock
cycle. This makes it useful in applications where timing is critical.
• Frequency Division: The JK flip-flop can be used to create a frequency divider,
which is a circuit that divides the frequency of an input signal by a fixed
amount. This makes it useful in real-time applications such as audio and video
processing.
Race Around Condition in JK Flip Flop
• For J-K flip-flop, if J=K=1, and if clk=1 for a long period of time, then
output Q will toggle as long as CLK remains high which makes the output
unstable or uncertain.
• This is called a race around condition in J-K flip-flop.
• We can overcome this problem by making the clock =1 for very less
duration.
• The circuit used to overcome race around conditions is called the
Master Slave JK flip flop.
Master Slave JK Flip Flop
• Here two JK flip flops are connected in series.
• The first JK flip flop is called the “master” and the other is a “slave”.
• The output from the master is connected to the two inputs of the slave
whose output is fed back to inputs of the master.
• The circuit also has an inverter other than the two flip flops.
• The Clock Pulse and inverter are connected because of which the flip
flops get an inverted clock pulse.
• In other words, if CP=0 for a master flip-flop, then CP=1 for a slave flip-
flop and vice versa.
Working of Master Slave JK Flip Flop
• When the clock pulse goes high, the slave is isolated; J and K inputs can affect
the state of the system. The slave flip-flop is isolated when the CP goes low.
• When the CP goes back to 0, information is transmitted from the master flip-
flop to the slave flip-flop and output is obtained.
• As the master flip flop is positive triggered it responds first and the slave later
(it is negative edge triggered).
• The master goes to the K input of the slave when both inputs J=0 and K=1, and
also Q’ = 1. In this case the slave copies the master as the clock forces the
slave to reset.
• The master goes to the J input of the slave when both J=1 and K=0, Q = 1. The
clock is set due to the negative transition of the clock.
• There is a state of toggle when both J=1 and K=1. On the negative transition
of clock slave toggles and the master toggles on the positive transition of the
clock.
• Both the flip flops are disabled when both J=0 and K=0 and Q is unchanged.
D Flip Flop
• D flip flop is an electronic devices that is known as “delay flip flop” or
“data flip flop” which is used to store single bit of data.
• D flip flops are synchronous or asynchronous. The clock single required for
the synchronous version of D flip flops but not for the asynchronous one.
• The D flip flop has two inputs, data and clock input which controls the flip
flop. when clock input is high, the data is transferred to the output of the
flip flop and when the clock input is low, the output of the flip flop is held
in its previous state.
• D flip flop consist of a single input D and two outputs (Q and Q’). The basic working of
D Flip Flop is as follows:
• When the clock signal is low, the flip flop holds its current state and ignores the D
input.
• When the clock signal is high, the flip flop samples and stores D input.
• The value that was previously fed into the D input is reflected at the flip flop’s Q
output.
• If D = 0 then Q will be 0.
• If D = 1 then Q will be 1.
• The Q’ output of the flip flop is complemented by the Q output.
• If Q = 0 then Q’ will be 1.
• If Q = 1 then Q’ will be 0.
D Flip Flop Excitation Table
Advantages of D Flip Flop
• D flip flop is very simple to design.
• The computation speed of D flip flop is very fast compared to other flip
flops.
• D flip flop requires very few components to design which makes it simple
to understand.
Disadvantages of D Flip Flop
• D flip flops are glitch prone. When input varies fast, flip flop output may
glitch. Digital circuit glitches are hard to identify and fix.
Applications of D Flip Flops
• Memory: D flip flop is used to create memory circuit for holding the data.
• Registers: D flip flop is used to create register, which can hold data in digital system. By
using the D flip flop the designer can built any size of register as per the requirement.
• Counters: D flip flops are used to create the counters which counts the number of
event occurred in the digital system.
• Synchronous System: D flip flop is having in developing the synchronous system.
T Flip Flop
• T flip flop or to be precise is known as Toggle Flip Flop because it can able to toggle its
output depending upon on the input.
• T here stands for Toggle.
• Toggle basically indicates that the bit will be flipped i.e., either from 1 to 0 or from 0 to
1.
• Here, a clock pulse is supplied to operate this flop, hence it is a clocked flip-flop.
• T flip flop or to be precise is known as Toggle Flip Flop because it can able to toggle its
output depending upon on the input.
• T here stands for Toggle.
• Toggle basically indicates that the bit will be flipped i.e., either from 1 to 0 or from 0
to 1.
• Here, a clock pulse is supplied to operate this flop, hence it is a clocked flip-flop.
Characteristic Table of T Flip Flop
Applications of T Flip Flop
• Counters: T Flip Flops used in counters. Counters counts the number of events that
occurs in a digital system.
• Data Storage: T Flip Flops used to create memory which are used to store data, when
the power is turned off.
• Synchronous logic circuits: T flip-flops can be used to implement synchronous logic
circuits, which are circuits that perform operations on binary data based on a clock
signal. By synchronizing the logic circuit’s operations to the clock signal using T flip-
flops, the circuit’s behavior can be made predictable and reliable.
• Frequency division: It is used to divide the frequency of a clock signal by 2. Flip-flop
will toggle its output every time the clock signal transitions from high to low or low
to high, hence dividing the clock frequency by 2.
• Shift registers: T flip-flops can be used in shift registers which are used to shift binary
data in one direction.
Counters
• Counter is a device that stores (and sometimes displays) the number of
times a particular event or process has occurred, often in relationship to a
clock.
• A counter is usually constructed by a number of flip flops connected in
cascade.
• Counters are used to count the clock pulse.
• We use Edge triggered flip flops in Counters because by using level
triggered flip flops Race around condition can occur.
Synchronous Vs Asynchronous Counter
• In synchronous counter we use a • In asynchronous counter main clock is
universal clock that is common to all only applied to the first flip flop and
flip flops through out the circuit. then for rest of flip flops the output of
previous flip flop is taken as a clock.
3. The numbering of bits in a register can be marked on the top of the box
as shown in (c).
These three registers are connected to a common address bus and either
one of them can provide an address for memory.
• Stack Pointer is first going to point at the address 3001, and then the
stack will grow with the decreasing addresses. It means that the first item
is going to be stored at address 3001, the second item at address 3000,
and the items can keep getting stored in the stack until it reaches the last
address 2000 where the last item will be held.
• Here the data which is getting inserted into the Stack is obtained from
the Data Register and the data retrieved from the Stack is also read by
the Data Register.
PUSH & POP operations in Memory Stack
Organization
PUSH Operation:
• This operation is used to insert a new data item into the top of the Stack.
The new item can be inserted as follows:-
SP ←SP-1
M[SP]← DR
• In the first step, the Stack Pointer is decremented to point at the address
where the data item will be stored.
• Then, by using the memory write operation, the data item from Data
Register gets inserted into the top of the stack ( at the address where the
Stack Pointer is pointing).
• POP Operation
• This operation is used to delete a data item from the top of the Stack.
Data item can be deleted as follows:-
DR←M[SP]
SP←SP+1
• In the first step, the top data item is read from the Stack into the Data
Register. The Stack Pointer is then incremented to point at the next data
item in the stack.
Addressing Modes
• The term addressing modes refers to the way in which the operand of an
instruction is specified.
• The addressing mode specifies a rule for interpreting or modifying the
address field of the instruction before the operand is actually executed.
• An assembly language program instruction consists of two parts:
Types of Addressing Modes
• Implied Mode
• Immediate Addressing Mode
• Register Mode
• Register Indirect Mode
• Autoincrement or Autodecrement Addressing Mode
• Direct Addressing Mode
• Indirect Addressing Mode
• Relative Address Mode
• Indexed Addressing Mode
• Base Register Addressing Mode
Implied Mode
• It is also known as “Inherent” or “Implicit” addressing mode.
• It is a type of addressing mode no memory location or register is
specified in the instruction.
• Also, in the implied mode, the operands are specified implicitly in the
instruction definition.
• E.g. INC AC
ACAC+1
Immediate Addressing Mode
• In this mode data is present in address field of instruction.
• Operand is directly provided as constant.
• No Computation required to calculate Effective Addresss.
ADD R1,#3
R1R1+3
Register Mode
• In register addressing the operand is placed in one of 8 bit or 16 bit
general purpose registers. The data is in the register that is specified by
the instruction.
• Register No. is present in the instruction.
• Here one register reference is required to access the data.
• E.g. LOAD R1
ACR1
Register Indirect Mode
• In this addressing the operand’s address is placed in any one of the
registers as specified in the instruction.
• Register contains address of operand rather than operand itself.
• Here two register reference is required to access the data.
Autoincrement Addressing Mode
• The auto increment mode is very similar to the register indirect mode.
• The auto increment addressing mode is just the opposite of the auto
decrement mode.
• In the case of auto increment mode, the content present in the register is
initially incremented, and then the content that is incremented in the
register is used in the form of an effective address.
• Once the content present in the register in the auto-increment addressing
mode is accessed by its instruction, the content of the register is
incremented to refer to the next operand.
• Symbolically, we can represent it as follows:
(R)+
Autodecrement Addressing Mode
• The auto decrement addressing mode is just the opposite of the auto
increment mode.
• In the case of auto decrement mode, the content present in the register is
initially decremented, and then the content that is decremented in the
register is used in the form of an effective address.
• It is presented symbolically as follows:
-(R)
Direct Addressing Mode
• Direct Addressing Mode is also known as absolute addressing
mode.
• In this mode, the instruction contains the address of the actual
memory location where the operand's value is stored.
• The address of this memory location is referred to as the effective
address.
Indirect Addressing Mode
• This is the mode of addressing where the instruction contains the
address of the location where the target address is stored.
• Used to implement pointers.
• So in this way, it is Indirectly storing the address of the target
location in another memory location. So it is called Indirect
Addressing mode.
• In this mode address field of instruction contains the address of
effective address.
• Here two references are required.
1st reference to get effective address.
2nd reference to access the data.
Relative Addressing Mode
• In this mode, the Effective Address (EA) of the operand is
calculated by adding the content of the CPU register and the
address part of the instruction word.
• The effective address is calculated by adding displacement
(immediate value given in the instruction) and the register value.
• The effective address thus calculated is relative to the address of
the next instruction.
• EA= PC+ Offset(Displacement)
Base Register Addressing Mode
• Base register addressing mode is used to implement inter
segment transfer of control.
• In this mode effective address is obtained by adding base
register value to address field value.
EA= Base Register+ Address Field Value
PC= Base Register+ Relative Value
Advantages of Addressing Modes
[Link] give programmers to facilities such as Pointers, counters for
loop controls, indexing of data and program relocation.
[Link] reduce the number bits in the addressing field of the
Instruction.
Computer Organization and
Architecture(COA)
BCA-203
Unit-4
Peripheral Devices
• A peripheral device is an internal or external device that connects directly
to a computer or other digital device but does not contribute to the
computer’s primary function, such as computing.
• It helps end users access and use the functionalities of a computer.
• Since it’s not a core device for the system, the computer can still function
without the peripheral, which simply provides extra functions. However,
some peripherals such as a mouse, keyboard, or monitor tend to be
pretty much fundamental to the interaction between the user and the
computer itself.
• A peripheral device is also called a peripheral, computer peripheral,
input-output device, or I/O device.
• A peripheral device provides input/output (I/O) functions for a computer
and serves as an auxiliary computer device without computing-intensive
functionality.
• Peripheral devices connect with a computer through several I/O
interfaces, such as communications (COM), Universal Serial Bus (USB).
Peripheral devices include the following:
• Mouse.
• Keyboard.
• Printer.
• Monitor.
• Webcam.
• Printer.
• Scanner.
• Speakers.
• External Drive.
• USB Flash Drive.
• CD-ROM.
• There are several types of peripherals, although they’re commonly
divided into three broad categories: input, output, and storage devices.
• Input devices convert incoming instructions or actions from the user into
viable information that can be interpreted by the computer. For example,
a keyboard will convert keystroke into characters that appear on the
computer’s display, while a monitor will transform hand movements into
movements of a cursor that can be used to interact with the operating
system’s programs. Other input peripherals include joysticks,
microphones, webcams, optical scanners, etc.
• Output peripherals translate digital signals into information that can be
interpreted or utilized by the end user. For example, a monitor or display
screen will show the operating system’s desktop, while a laser printer will
translate information saved in a word file into printed material. Other
output peripherals include speakers, 3D printers, and projectors.
• Some devices can provide both input and output signals, such as network
interfaces, modems, routers, and webcams.
• Storage peripherals are used to store and record data, and include
internal and external hard drives, CD-ROM and DVD drives, and flash
memory drives.
• Depending on whether the peripheral is located inside or outside the
computer system case, it can be further classified as an internal or
external peripheral device.
• An external peripheral can be connected via many different types of
cables and connections. Today, the most common connection for external
peripherals is the USB connection, both because most computers have
several ports available, and because of the simplicity of the plug-and-play
feature.
• Internal storage devices such as hard disks are usually connected with a
SATA cable, while display port and HDMI are the most popular connections
for displays and monitors.
• Today, many peripherals are built-in inside smaller computer devices such
as tablets, laptops and smartphones. For example, webcam, speakers and
microphones are integrated inside most smartphones, although the latter
cannot be considered a peripheral since it’s a core function of any phone.
Similarly, webcams and monitors are integrated into most laptops,
although it’s still possible to connect the computer to a larger monitor or
higher resolution webcam.
Input/Output Interface
• Input/Output interface is used as a method which helps in transferring of
information between the internal storage devices i.e. memory and the
external peripheral device .
• In micro-computer based system, the only purpose of peripheral devices
is just to provide special communication links for interfacing them with
the CPU.
• To resolve the differences between peripheral devices and CPU, there is a
special need for communication links.
• The major differences are as follows:
1. The nature of peripheral devices is electromagnetic and electro-
mechanical. The nature of the CPU is electronic. There is a lot of
difference in the mode of operation of both peripheral devices and CPU.
2. There is also a synchronization mechanism because the data transfer rate
of peripheral devices are slow than CPU.
3. In peripheral devices, data code and formats differ from the format in
the CPU and memory.
4. The operating mode of peripheral devices are different and each may be
controlled so as not to disturb the operation of other peripheral devices
connected to CPU.
• There is a special need of the additional hardware to resolve the
differences between CPU and peripheral devices to supervise and
synchronize all input and output devices.
• To communicate with I/O, the processor must communicate with the
memory unit. Like the I/O bus, the memory bus contains data, address
and read/write control lines.
• While the data lines convey bits from one device to another, control lines
determine the direction of data flow and when each device can access the
bus. Address lines determine the location of the source or destination of
the data.
Functions of Input/Output Interface
1. It is used to synchronize the operating speed of CPU with respect to
input-output devices.
2. It selects the input-output device which is appropriate for the
interpretation of the input-output device.
3. It is capable of providing signals like control and timing signals.
4. In this data buffering can be possible through data bus.
5. There are various error detectors.
6. It converts serial data into parallel data and vice-versa.
7. It also convert digital data into analog signal and vice-versa.
Asynchronous Data Transfer
• Asynchronous data transfer enables computers to send and receive data
without having to wait for a real-time response. With this technique, data
is conveyed in discrete units known as packets that may be handled
separately.
Sender: The machine or gadget that transfers the data.
Receiver: A device or computer that receives data.
Packet: A discrete unit of transmitted and received data.
Buffer: A short-term location for storing incoming or departing data.
Classification of Asynchronous Data Transfer
• Strobe Control Method
• Handshaking Method
Strobe Control Method For Data Transfer
• Strobe control is a method used in asynchronous data transfer that
synchronizes data flow between two devices.
• Bits are transmitted one at a time, independent of one another, and
without the aid of a clock signal in asynchronous communication.
• To properly receive the data, the receiving equipment needs to be able to
synchronize with the transmitting device.
• Strobe control involves sending data along with a different signal known
as the strobe signal.
• The strobe signal alerts the receiving device that the data is valid and
ready to be read. The receiving device waits for the strobe signal before
reading the data to ensure it is synchronized with its clock.
• The strobe signal is usually generated by the transmitting device and is
sent either before or after the data. If the strobe signal is sent before the
data, it is called a leading strobe. If it is sent after the data, it is called a
trailing strobe.
Handshaking Method For Data Transfer
• During an asynchronous data transfer, two devices manage their
communication using handshaking.
• It is guaranteed that the transmitting and receiving devices are prepared
to send and receive data.
• Handshakes are essential in asynchronous communication since there is
no clock signal to synchronize the data transfer.
• During handshaking, we use two types of signals mostly they are request-
to-send (RTS) and clear-to-send (CTS).
• The receiving device is notified by an RTS signal when the transmitting
equipment is ready to provide data.
• The receiving device responds with a CTS signal when it is ready to accept
data.
• Once data is transmitted to the receiver end, the receiver generates a
signal that it has done by sending an acknowledgment (ACK) signal.
• If the data is not successfully received, the receiving device will notify that
a new transmission is necessary via a negative acknowledgment (NAK)
signal.
Advantages of Asynchronous Data Transfer
• Because asynchronous data transfer sends data in discrete, independently
processable pieces, it enables faster data transfer speeds.
• This method is more effective than synchronous data transfer because
there is no need for the receiver to respond.
• Transmission is done by making large files or data sets into smaller packets
and sending them in parallel cuts the duration time.
Disadvantages of Asynchronous Data Transfer
• Asynchronous data transfer requires more complex programming and it
may be possible that some data may get corrupted or lose data if packets
are not received in the correct order or are lost during transmission.
• As we know there will be no real-time communication in asynchronous
data transport can be more prone to errors than synchronous data
transfer.
Modes of Transfer
• The binary information that is received from an external device is usually
stored in the memory unit. The information that is transferred from the
CPU to the external device is originated from the memory unit. CPU
merely processes the information but the source and target is always the
memory unit. Data transfer between CPU and the I/O devices may be
done in different modes. Data transfer to and from the peripherals may
be done in any of the three possible ways
[Link] I/O.
[Link]- initiated I/O.
[Link] memory access( DMA)
Programmed I/O
• In this case, the I/O device does not have direct access to the
memory unit.
• A transfer from I/O device to memory requires the execution of
several instructions by the CPU, including an input instruction to
transfer the data from device to the CPU and store instruction to
transfer the data from CPU to memory.
• In programmed I/O, the CPU stays in the program loop until the I/O
unit indicates that it is ready for data transfer. This is a time
consuming process since it needlessly keeps the CPU busy. This
situation can be avoided by using an interrupt facility.
Interrupt-Initiated I/O
• Since in the above case we saw the CPU is kept busy unnecessarily.
This situation can very well be avoided by using an interrupt driven
method for data transfer.
• By using interrupt facility and special commands to inform the interface
to issue an interrupt request signal whenever data is available from any
device.
• In the meantime the CPU can proceed for any other program execution.
The interface meanwhile keeps monitoring the device. Whenever it is
determined that the device is ready for data transfer it initiates an
interrupt request signal to the computer.
• Upon detection of an external interrupt signal the CPU stops
momentarily the task that it was already performing, branches to the
service program to process the I/O transfer, and then return to the task it
was originally performing.
Direct memory access( DMA)
• The data transfer between a fast storage media such as magnetic disk and
memory unit is limited by the speed of the CPU.
• Thus we can allow the peripherals directly communicate with each other
using the memory buses, removing the intervention of the CPU.
• This type of data transfer technique is known as DMA or direct memory
access.
• During DMA the CPU is idle and it has no control over the memory buses.
The DMA controller takes over the buses to manage the transfer directly
between the I/O devices and the memory unit.
Direct Memory Access (DMA) Controller
• Direct Memory Access uses hardware for accessing the memory, that
hardware is called a DMA Controller.
• It has the work of transferring the data between Input Output devices and
main memory with very less interaction with the processor.
• The Direct Memory Access Controller is a control unit, which has the work
of transferring data.
• DMA Controller is a type of control unit that works as an interface for the
data bus and the I/O Devices.
Types of Direct Memory Access (DMA)
• Single-Ended DMA
• Dual-Ended DMA
• Arbitrated-Ended DMA
• Interleaved DMA
• Single-Ended DMA: Single-Ended DMA Controllers operate by reading
and writing from a single memory address. They are the simplest DMA.
• Dual-Ended DMA: Dual-Ended DMA controllers can read and write from
two memory addresses. Dual-ended DMA is more advanced than single-
ended DMA.
• Arbitrated-Ended DMA: Arbitrated-Ended DMA works by reading and
writing to several memory addresses. It is more advanced than Dual-
Ended DMA.
• Interleaved DMA: Interleaved DMA are those DMA that read from one
memory address and write from another memory address.
Advantages of DMA Controller
• Data Memory Access speeds up memory operations and data transfer.
• CPU is not involved while transferring data.
• DMA requires very few clock cycles while transferring data.
• DMA distributes workload very appropriately.
• DMA helps the CPU in decreasing its load.
Disadvantages of DMA Controller
• Direct Memory Access is a costly operation because of additional
operations.
• DMA Controller increases the overall cost of the system.
• DMA Controller increases the complexity of the software.
Computer Memory
• Computer memory is just like the human brain.
• It is used to store data/information and instructions.
• It is a data storage unit or a data storage device where data is to be
processed and instructions required for processing are stored.
• It can store both the input and output can be stored here.
Primary Memory/Main Memory
• It is also known as the main memory of the computer system.
• It is used to store data and programs or instructions during computer
operations.
• It uses semiconductor technology and hence is commonly called
semiconductor memory.
• Primary memory is of two types:
RAM
ROM
RAM (Random Access Memory)
• It is a volatile memory.
• Volatile memory stores information based on the power supply.
• If the power supply fails/ interrupted/stopped, all the data and
information on this memory will be lost.
• RAM is used for booting up or start the computer. It temporarily
stores programs/data which has to be executed by the processor.
• RAM is of two types:
S RAM (Static RAM)
D RAM (Dynamic RAM)
• S RAM (Static RAM): S RAM uses transistors and the circuits of this
memory are capable of retaining their state as long as the power is
applied. This memory consists of the number of flip flops with each flip
flop storing 1 bit. It has less access time and hence, it is faster.
• D RAM (Dynamic RAM): D RAM uses capacitors and transistors and
stores the data as a charge on the capacitors. They contain thousands of
memory cells. It needs refreshing of charge on capacitor after a few
milliseconds. This memory is slower than S RAM.
ROM (Read Only Memory)
• It is a non-volatile memory.
• Non-volatile memory stores information even when there is a power supply
failed/ interrupted/stopped.
• ROM is used to store information that is used to operate the system. As its name
refers to read-only memory, we can only read the programs and data that is
stored on it.
• It contains some electronic fuses that can be programmed for a piece of specific
information. The information stored in the ROM in binary format. It is also known
as permanent memory.
• ROM is of four types:
MROM(Masked ROM)
PROM (Programmable Read Only Memory)
EPROM (Erasable Programmable Read Only Memory)
EEPROM (Electrically Erasable Programmable Read Only Memory)
• MROM(Masked ROM): Hard-wired devices with a pre-programmed
collection of data or instructions were the first ROMs. Masked ROMs are a
type of low-cost ROM that works in this way.
• PROM (Programmable Read Only Memory): This read-only memory is
modifiable once by the user. The user purchases a blank PROM and uses
a PROM program to put the required contents into the PROM. Its content
can’t be erased once written.
• EPROM (Erasable Programmable Read Only Memory): EPROM is an
extension to PROM where you can erase the content of ROM by exposing
it to Ultraviolet rays for nearly 40 minutes.
• EEPROM (Electrically Erasable Programmable Read Only Memory): Here
the written contents can be erased electrically. You can delete and
reprogramme EEPROM up to 10,000 times. Erasing and programming take
very little time, i.e., nearly 4 -10 ms(milliseconds). Any area in an
EEPROM can be wiped and programmed selectively.
Secondary Memory/Auxiliary Memory
• It is also known as auxiliary memory and backup memory.
• It is a non-volatile memory and used to store a large amount of data or
information.
• The data or information stored in secondary memory is permanent, and it is
slower than primary memory.
• A CPU cannot access secondary memory directly. The data/information from
the auxiliary memory is first transferred to the main memory, and then the
CPU can access it.
• It is a slow memory but reusable.
• It is a reliable and non-volatile memory.
• It is cheaper than primary memory.
• The storage capacity of secondary memory is large.
• A computer system can run without secondary memory.
• In secondary memory, data is stored permanently even when the power is off.
Types of Auxiliary Memory
• Magnetic Tapes: Magnetic tape is a long, narrow strip of plastic film with a
thin, magnetic coating on it that is used for magnetic recording.
• Bits are recorded on tape as magnetic patches called RECORDS that run
along many tracks. Typically, 7 or 9 bits are recorded concurrently. Each
track has one read/write head, which allows data to be recorded and read
as a sequence of characters. It can be stopped, started moving forward or
backward, or rewound.
• Magnetic Disks: A magnetic disk is a circular metal or a plastic plate and
these plates are coated with magnetic material. The disc is used on both
sides. Bits are stored in magnetized surfaces in locations called tracks that
run in concentric rings. Sectors are typically used to break tracks into
pieces. Hard discs are discs that are permanently attached and cannot be
removed by a single user.
• Optical Disks: It’s a laser-based storage medium that can be written to and read.
It is reasonably priced and has a long lifespan. The optical disc can be taken out
of the computer by occasional users.
Types of Optical Disks
CD – ROM
• It’s called compact disk. Only read from memory.
• Information is written to the disc by using a controlled laser beam to burn pits
on the disc surface.
• It has a highly reflecting surface, which is usually aluminium.
• The diameter of the disc is 5.25 inches.
• 16000 tracks per inch is the track density.
• The capacity of a CD-ROM is 600 MB, with each sector storing 2048 bytes of
data.
• The data transfer rate is about 4800KB/sec. & the new access time is around 80
milliseconds.
WORM-(WRITE ONCE READ MANY)
• A user can only write data once.
• The information is written on the disc using a laser beam.
• It is possible to read the written data as many times as desired.
• They keep lasting records of information but access time is high.
• It is possible to rewrite updated or new data to another part of the disc.
• Data that has already been written cannot be changed.
• Usual size – 5.25 inch or 3.5 inch diameter.
• The usual capacity of 5.25 inch disk is 650 MB,5.2GB etc.
DVDs
• The term “DVD” stands for “Digital Versatile/Video Disc,” and there are two
sorts of DVDs:
• DVDR (writable)
• DVDRW (Re-Writable)
• DVD-ROMS (Digital Versatile Discs): These are read-only memory (ROM) discs
that can be used in a variety of ways. When compared to CD-ROMs, they can
store a lot more data. It has a thick polycarbonate plastic layer that serves as a
foundation for the other layers. It’s an optical memory that can read and write
data.
• DVD-R: DVD-R is a writable optical disc that can be used just once. It’s a DVD
that can be recorded. It’s a lot like WORM. DVD-ROMs have capacities ranging
from 4.7 to 17 GB. The capacity of 3.5 inch disk is 1.3 GB.
Cache Memory
• The data or contents of the main memory that are used frequently by CPU are
stored in the cache memory so that the processor can easily access that data in
a shorter time.
• Whenever the CPU needs to access memory, it first checks the cache memory. If
the data is not found in cache memory, then the CPU moves into the main
memory.
• Cache memory is placed between the CPU and the main memory. The block
diagram for a cache memory can be represented as:
• The cache is the fastest component in the memory hierarchy and
approaches the speed of CPU components.
• When the CPU needs to access memory, the cache is examined. If the
word is found in the cache, it is read from the fast memory.
• If the word addressed by the CPU is not found in the cache, the main
memory is accessed to read the word.
• A block of words one just accessed is then transferred from main
memory to cache memory. The block size may vary from one word (the
one just accessed) to about 16 words adjacent to the one just accessed.
• The performance of the cache memory is frequently measured in terms
of a quantity called hit ratio.
• When the CPU refers to memory and finds the word in cache, it is said to
produce a hit.
• If the word is not found in the cache, it is in main memory and it counts
as a miss.
• The ratio of the number of hits divided by the total CPU references to
memory (hits plus misses) is the hit ratio.
Advantages of Cache Memory
• It is faster than the main memory.
• When compared to the main memory, it takes less time to access it.
• It keeps the programs that can be run in a short amount of time.
• It stores data in temporary use.
Disadvantages of Cache Memory
• Because of the semiconductors used, it is very expensive.
• The size of the cache (amount of data it can store) is usually small.
Associative Memory
• Associative memory is also known as content addressable memory (CAM) or
associative storage or associative array.
• When data is accessed by data content rather than data address, then the
memory is called associative memory or content addressable memory.
• It is a special type of memory that is optimized for performing searches through
data, as opposed to providing a simple direct access to the data based on the
address.
• When a write operation is performed on associative memory, no address or
memory location is given to the word. The memory itself is capable of finding
an empty unused location to store the word.
• On the other hand, when the word is to be read from an associative memory,
the content of the word, or part of the word, is specified. The words which
match the specified content are located by the memory and are marked for
reading.
• It takes relatively less time to find an item based on content rather than
by address.
• It is very expensive.
Virtual Memory
• Virtual memory is a common technique used in a computer's operating
system (OS). Virtual memory uses both hardware and software to enable
a computer to compensate for physical memory shortages, temporarily
transferring data from random access memory (RAM) to disk storage.
• Virtual memory is a method that computers use to manage storage space
to keep systems running quickly and efficiently.
• Using the technique, operating systems can transfer data between
different types of storage, such as random access memory (RAM), also
known as main memory, and hard drive or solid-state disk storage.
• At any particular time, the computer only needs enough active memory to
support active processes. The system can move those that are dormant
into virtual memory until needed.