Ele Ii
Ele Ii
Ele Ii
BASICS OF COMPUTER
ORGANIZATION
[2 Credits]
Electronics Paper-II
For
First Year B.Sc. Computer Science - Semester-II
New Syllabus as per CBCS Pattern
from June 2019
Price ` 70.00
N5063
F.Y.B.Sc : Basics of Computer Organisation ISBN 978-93-89686-46-3
First Edition : November 2019
© : Authors
The text of this publication, or any part thereof, should not be reproduced or transmitted in any
form or stored in any computer storage system or device for distribution including photocopy,
recording, taping or information retrieval system or reproduced on any disc, tape, perforated media or
other information storage device etc., without the written permission of Authors with whom the rights
are reserved. Breach of this condition is liable for legal action.
Every effort has been made to avoid errors or omissions in this publication. In spite of this, errors
may have crept in. Any mistake, error or discrepancy so noted and shall be brought to our notice shall
be taken care of in the next edition. It is notified that neither the publisher nor the authors or seller shall
be responsible for any damage or loss of action to any one, of any kind, in any manner, therefrom.
DISTRIBUTION CENTRES
PUNE
Nirali Prakashan : 119, Budhwar Peth, Jogeshwari Mandir Lane, Pune 411002,
(For orders within Pune) Maharashtra, Tel : (020) 2445 2044, Mobile : 9657703145
Email : [email protected]
Nirali Prakashan : S. No. 28/27, Dhayari, Near Asian College Pune 411041
(For orders outside Pune) Tel : (020) 24690204; Mobile : 9657703143
Email : [email protected]
MUMBAI
Nirali Prakashan : 385, S.V.P. Road, Rasdhara Co-op. Hsg. Society Ltd.,
Girgaum, Mumbai 400004, Maharashtra;
Mobile : 9320129587 Tel : (022) 2385 6339 / 2386 9976,
Fax : (022) 2386 9976
Email : [email protected]
DISTRIBUTION BRANCHES
JALGAON
Nirali Prakashan : 34, V. V. Golani Market, Navi Peth, Jalgaon 425001,
Maharashtra, Tel : (0257) 222 0395, Mob : 94234 91860;
Email : [email protected]
KOLHAPUR
Nirali Prakashan : New Mahadvar Road, Kedar Plaza, 1st Floor Opp. IDBI Bank,
Kolhapur 416 012, Maharashtra. Mob : 9850046155;
Email : [email protected]
NAGPUR
Nirali Prakashan : Above Maratha Mandir, Shop No. 3, First Floor,
Rani Jhanshi Square, Sitabuldi, Nagpur 440012, Maharashtra
Tel : (0712) 254 7129;
Email : [email protected]
DELHI
Nirali Prakashan : 4593/15, Basement, Agarwal Lane, Ansari Road, Daryaganj
Near Times of India Building, New Delhi 110002
Mob : 08505972553, Email : [email protected]
BENGALURU
Nirali Prakashan : Maitri Ground Floor, Jaya Apartments, No. 99, 6th Cross,
6th Main, Malleswaram, Bengaluru 560003, Karnataka;
Mob : 9449043034
Email: [email protected]
Other Branches : Hyderabad, Chennai
[email protected] | www.pragationline.com
Also find us on www.facebook.com/niralibooks
Preface …
We have great pleasure to present this book on ‘Basics of Computer
Organization’ which is written as per the revised syllabus of Savitribai
Phule Pune University for F.Y.B.Sc. (Computer Science), semester II course
ELC 122 in the subject of Electronics. The authors have sincerely put their
efforts to give complete information of the subject as prescribed in the
syllabus in a simplified manner.
Electronics and computer science go hand in hand. In fact, electronics
is a backbone for understanding computer operations.
This text book has been prepared keeping in mind the need of
subject and syllabus specified by SPPU.
The First Chapter describes Flip-flops, their types, working principles
and their application.
Second chapter gives details of shift registers and counters, basics of
shift registers and counters, their functioning with timing diagram are
elaborated.
Basics of computer system are discussed in detail in chapter three. In
this chapter computer organization, various kinds of bus structures used
in computer, CPU organization, execution of system, stack concept and
input / output interface organization is elaborated.
Chapter four describes memory organization. In this chapter memory
architecture, memory hierarchy, types of memories and management of
memory space is discussed in detail.
After studying all this, students will get a clear understanding of
computer organization. To give something extra to think and to explore
the topic, ‘Think over It’ element is added in this book. As per new choice
based credit based system syllabus of Savitribai Phule Pune University
questions like multiple choice, true/false, short answer, long answer type
questions are included at the end of each unit. Also two sample question
papers as per university guidelines are provided.
We are thankful to the publishers Shri Dineshbhai Furia and Shri
Jignesh Furia and the staff of Nirali Prakashan specially Mr. Ilyas Shaikh,
Mrs. Manasi Pingle, Ms. Chaitali Takle, Mr Ravindra Walodare for the
great efforts they have taken to publish this book in time.
All valuable suggestions from the readers of this book are always
welcome.
AUTHORS
Syllabus …
Unit 1 : Flip-Flops (5 L)
RS Flip-Flop using NAND gate, Clocked RS Flip-Flop, D Latch, J K
Flip-Flop, T Flip-Flop
Unit 2 : Shift Registers and Counters (9 L)
Shift registers - SISO, SIPO, PISO, PIPO shift registers, Ring counter
using D Flip-flop. Counters - Synchronous and Asynchronous type,
3-bit Up, Down and Up-Down counter, Concept of Modulus counters
(Timing Diagram of all above are expected)
Unit 3 : Basics of Computer System (12 L)
Basic Computer organization, Concept of address bus, Data bus,
Control bus. CPU block diagram and explanation of each block,
Register based CPU organization, Concept of Stack and its
organization, I/O organization: Need of interface, Block diagram of
general I/O interface
Unit 4 : Memory Organization (10 L)
Memory architecture, Memory hierarchy, Types of Memories, Data
Read/ Write process, Vertical and Horizontal Memory Expansion, Role
of Cache memory, Virtual memory.
Contents …
✍✍✍
BASICS OF COMPUTER
ORGANIZATION
Electronics (For Computer Science) : Paper-II
N5063
1. Title
2. Pressline
3. Preface
4. Blank
5. Syllabus
6. Blank
7. Contents
8. Blank
Contents …
1. Flip-Flops 1.1 − 1.18
2. Shift Registers and Counters 2.1 − 2.32
3. Basics of Computer System 3.1 − 3.46
4. Memory Organization 4.1 − 4.36
Model Question Papers P.1 - P.2
Note 1
Add 1
✍✍✍
Unit 1…
Flip-Flops
The first electronic flip-flop was invented in 1918
by the British physicists William Eccles and F. W.
Jordan. It was initially called the Eccles–Jordan
trigger circuit and consists of two vacuum tubes
as an electronic component available in that
period. The design was used in 1943 in British
Colossus code breaking computer. Afterwards it
was designed with transistors and were common
in computers even after the introduction of
William Eccles integrated circuits, though flip-flops are made
from logic gates.
Early flip-flops were known as trigger circuits or multivibrators, then
were progressed to clocked flip-flops and counters, then shift registers
were developed.
William Henry Eccles FRS (23 August 1875 – 29 April 1966) was a
British physicist and a pioneer in the development of radio
communication. He was born in Barrow-in-Furness, Lancashire, England.
He was an assistant to Guglielmo Marconi, the Italian radio entrepreneur.
In 1901, he received his doctorate from the Royal College of Science.
Eccles was an advocate of Oliver Heaviside's theory that a conducting
layer of the upper atmosphere could reflect radio waves around the
curvature of the Earth.
Frank Wilfred Jordan (6 October 1881 – 12 January 1941) was a
British physicist who together with William Henry Eccles invented the so-
called "flip-flop" circuit in 1918. This circuit became the basis of electronic
memory as a major part in computers.
1.1 Introduction
• After reading this unit, you will be able to use logic gates to construct
basic latches and can recognize the difference between a latch and a
flip-flop. You can also explain how R-S and J-K flip-flops differ and
know how to apply flip-flops in basic applications.
1.1
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.2 Flip-Flops
• The cross-coupled gates used to store binary data are known as flip-
flops. There are different types of flip-flops. Flip-flops are basic
building blocks of counters, shift registers and memory devices.
• A flip-flop can store 1-bit of digital information. It is also referred to
as a 1-bit register. A register contains a group of flip-flops, the
number of flip-flops in a register being equal to the number of bits
present in the data. Flip-flops are connected in such a way that binary
number can be entered into the register and retrieved from the same.
1.2 RS Flip-Flop using NAND Gate
• Flip-flop can be obtained using any type of gates, but since NAND
and NOR are the universal gates, we will see flip-flop using NAND
gate.
• Fig. 1.1 shows S-R flip-flop using NAND gates.
S N3 R S Q
N1 Q
0 0 NC
0 1 1
1 0 0
1 1 Forbidden
N2 Q
R N4
clock pulses simultaneously to N3 and N4. Fig. 1.3 (a) shows the
clocked S-R flip-flop.
S
N3
N1 Q Sn Rn Qn + 1
0 0 Qn S Q
CLK 1 0 1 CK
0 1 0
R Q
N2 Q 1 1 Forbidden
R N4
(a) Clocked S-R flip-flop (b) Truth table (c) Logic symbol
Fig. 1.3
• If the clock pulse is absent CLK = 0, whatever may be S and R,
outputs of N3 and N4 are 1. If Q = 1 it remains 1 whereas if Q = 0 it
remains 0. The flip-flop does not change the state. The circuit is
equivalent to a latch.
• If the clock pulse is present, CLK = 1. If S = 0, R = 0 then outputs of
N3 and N4 are 1 and the output of the flip-flop does not change.
Hence, after the pulse, output remains same as before the pulse. If we
denote the inputs Sn and Rn before the pulse then output after the
pulse is Qn+1 = Qn and this is indicated in the first row of the truth
table.
• If CLK = 1, Sn = 1 and Rn = 0 then output of N3 is 0, output of N4 is 1,
which make Q = 1. Hence, after the clock pulse, we find Qn+1 = 1.
• If CLK = 1, Sn = 0 and Rn = 1 then we find Qn+1 = 0. This confirms
second and third rows of the truth table.
• If CLK = 1, Sn = 1 and Rn = 1 then outputs of NAND gates N3 and N4
are both 0. Hence, whatever may be previous output one input of N1
and N2 is 0, so that outputs of both N1 and N2 must be 1, but
−
according to our definition, Q and Q must be complement. In
practice, whether N1 input or N2 input rises faster from 0 to 1 and
depending upon circuit parameter we get asymmetric output either
the state Q = 0 or Q = 1. This state is said to be indeterminate,
ambiguous or undefined, and the condition Sn = 1, Rn = 1 is
forbidden and should not be applied. This ambiguity present in the
truth table is overcome by J-K flip-flop.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.5 Flip-Flops
1.3 JK Flip-Flop
• J-K flip-flop can be obtained from S-R flip-flop along with two AND
−
gates G1 and G2. Data input J and the output Q are applied to G1.
−
Since its output generates S, then S = JQ. Similarly, data input K and
the output Q are applied to G2 and hence R = KQ. Fig. 1.4 shows S-R
flip-flop converted into J-K and its truth table.
Row Jn Kn Qn – Sn Rn Qn+1
Qn
1 0 0 0 1 0 0 Qn
Qn
2 0 0 1 0 0 0 Qn
3 1 0 0 1 1 0 1
1
4 1 0 1 0 0 0 Qn
5 0 1 0 1 0 0
Qn
6 0 1 1 0 0 1 0
0
7 1 1 0 1 1 0
1 –
8 1 1 1 0 0 1 Qn
0
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.6 Flip-Flops
• Thus, we see that the first three rows of J-K flip-flop truth table are
same as that of S-R flip-flop truth table. When the data inputs J and K
are high, the output gets complemented by the clock pulse. In case of
S-R flip-flop, we cannot apply S = 1, R = 1 but in case of J-K flip-flop,
we can apply J = 1, K = 1.
1.4.1 J-K Flip-Flop With Only NAND Gates
• Fig. 1.4 (a) shows J-K flip-flop which uses AND gates. However, we
can also obtain J-K flip-flop only using NAND gates. Fig. 1.5 shows
J-K flip-flop using only NAND gates. N1 and N2 are two input NAND
gates whereas N3 and N4 are three input NAND gates.
• If J = 0, K = 0, outputs of N3 and N4 are one since one input of N3 and
N4 is 0.
−
• If Q = 0 and Q = 1, for N2 one input is 0, so its output remains 1 and
for N1 both inputs are 1 so gives same output 0 as assumed. Thus,
output remains in the previous state.
J N3
N1 Q
CLK
N2 Q
N4
K
Fig. 1.5 : J-K flip-flop using only NAND gates
• If J = 0, K = 1 and CLK = 1 for N3 one input is 0, so output is 1. For N4
−
if Q = 1 all inputs are 1, so output is 0 then for N2 one input is 0, so Q
becomes 1. For N1 both inputs are 1, so output Q becomes 0. So
output becomes same as J input even if J = 1 and K = 0.
• If J = 1, K = 1 and CLK = 1. If Q = 1 for N4 all inputs are 1, so output
of N4 is 0. For N3 one input is 0 so output is 1. For N2, one input is 0.
−
So Q becomes 1. For N1 both inputs are 1 so output becomes 0 i.e. if
we assume Q = 0 it becomes 1. If we assume Q = 1, it becomes 0.
Thus, when J = 1, K = 1, output becomes complement of previous
state.
• Thus, for all possible values of J and K, the circuit follows the truth
table of J-K flip-flop.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.7 Flip-Flops
Pr
J
N3 N1 Q
J Q
CLK
CK
N4 N2 Q K Q
K
Cr
Cr
(a) J-K flip-flop with preset and clear (b) The logic symbol
Fig. 1.6
• If we want to clear the flip-flop, apply Pr = 1, Cr = 0 and CLK = 0.
−
Since Cr is 0 the output of N2 is Q = 1. Since CLK = 0, the output of
N3 is 1 and hence all inputs to N1 are 1 which give Q = 0 as required.
• Similarly, if we want to preset the latch or flip-flop, apply Pr = 0,
Cr = 1, CLK = 0. The preset and clear inputs are called direct or
asynchronous input since they are not in synchronous with the clock
and may be applied before the clock or in between the clock pulses.
Once the state to the flip-flop is assigned, Pr = 1, Cr = 1 must be
maintained, that is for the normal operation of the flip-flop, Pr = 0
and Cr = 0 must not be used since it leads to ambiguous state at the
output.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.8 Flip-Flops
• The square pulse can be converted into positive and negative going
spikes using R-C differentiator circuit. Fig. 1.7 shows such circuit.
J Q
C
CLK CK
R
K Q
J Q J Q
CK CK
K Q K Q
Cr Cr
(a) Positive edge triggering (b) Negative edge triggering
Fig. 1.8 : Edge triggering
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.10 Flip-Flops
Qm S
J Q
CLK
Qm R
K Q
Cr CK
Master Slave
Fig. 1.9 : A master slave J-K flip-flop
• As seen previously for normal operation, Pr = 1, Cr = 1 must be held.
For Pr = 1, Cr = 1 and CK = 1, the master is enabled and its operation
––
follows the J-K truth table. At the same time, since CK = 0, the slave
remains disabled or cannot change the state. So output Qn does not
change the state during tp and hence the race around difficulty is
removed, after the pulse passes CK = 0, so that the master is inhibited
––
and CK = 1, which causes slave to be enabled.
• If S = 1 and R = 0 then Q = 1 or if S = 0 and R = 1 then Q = 0. Thus,
in case of Master Slave J-K flip-flop, during a clock pulse output Q
does not change but Qm follows J-K logic and at the end of the pulse,
the value of Qm is transferred to Q.
1.4 D Latch
• J-K flip-flop is modified into D (delay) flip-flop by adding an inverter
between J and K input, so that K is always the complement of J. The
input is named as D input.
• Fig. 1.10 shows logic circuit, logic symbol and the truth table of D
type flip-flop.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.11 Flip-Flops
Pr Pr
D J Q D Q Dn Qn + 1
1 1
CLK CK CK
0 0
K Q Q
Cr Cr
(a) Logic diagram of J-K (b) Logic symbol (c) Truth table converted
into D flip-flop
Fig. 1.10 : D flip-flop
• If Dn is 1 then Jn = 1, Kn = 0 and hence Qn+1 = 1.
• If Dn is 0 then Jn = 0, Kn = 1 and then Qn+1 = 0.
• The output Qn+1 after the pulse equals the input Dn before the pulse
and therefore D flip-flop is used to provide delay. The bit on the D
line is transferred to the output at the next clock pulse and hence
flip-flop functions as 1-bit delay device.
• The S-R flip-flop can also be converted into D type by adding an
inverter between S and R and then there is no ambiguous state since
S = R is not possible.
1.5 T Flip-Flop
• The J-K flip-flop is modified into T by connecting J and K together.
This unit changes the state with each clock pulse, acts as a toggle
switch and hence the name. Fig. 1.11 shows the T-flip-flop.
Pr Pr
T J Q T Q
Tn Qn + 1
CLK CK CK 0 Qn
1 Qn
K Q Q
Cr Cr
(a) J-K converted into T flip-flop (b) Logic symbol (c) Truth table
Fig. 1.11 : J-K flop-flop
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.12 Flip-Flops
−
• When J = K = 1 then Qn+1 = Qn and when J = K = 0, then Qn+1 = Qn.
According to the truth table of J-K flip-flop, T flip-flop is also known
as complementing flip-flop. If T = 1 and the clock pulses as shown in
Fig. 1.12 are applied, the flip-flop behaves as divide by 2 circuit
because it gives 0 to 1 transition at first clock pulse and 1 to 0 at the
next clock pulse i.e. two input pules are required to have one output
pulse. If the clock input square wave has frequency of 10 kHz, the
output at T flip-flop will have frequency 5 kHz. Thus, one flip-flop
does the operation of frequency division by two.
Think Over It
Summary
1. A latch is a type of memory storage device that has two stable states.
2. The latch stores 1-bit information.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.13 Flip-Flops
Exercise
[A] True or False :
1. Flip-Flop can be used as memory device.
2. Race around condition is overcome in J-K flip-flop.
3. PRESET input is used to directly reset the Q output to 1 in the JK flip-
flop.
4. D flip-flop is also known as direct flip-flop.
5. In counters T flip-flop is used.
6. In Master Slave JK flip-flop, Slave copies state of Master.
7. When J = 1, K = 1 , J-K flip-flop is in toggle mode.
8. It is necessary to store the input of flip-flop instantaneously and for
that we need wide range clock pulse.
9. Trigger pulse is defined as, a pulse that starts a cycle of operation.
−
10. The term CLEAR always means that Q = 0, Q = 1.
11. The J-K flip-flop eliminates the invalid state by toggling when both
inputs are high and the clock transitions.
12. A positive edge-triggered flip-flop changes states with a HIGH-to-
LOW transition on the clock input.
[B] Multiple Choice Questions :
1. The invalid state of an S-R latch occurs when ……
(a) S = 1, R = 0 (b) S = 0, R = 1
(c) S = 1, R = 1 (d) S = 0, R = 0
2. The purpose of the clock input to a flip-flop is to ……
(a) clear the device
(b) set the device
(c) always cause the output to change states
(d) cause the output to assume a state dependent on the controlling
inputs
3. For an edge-triggered D flip-flop, ……
(a) a change in the state of an flip-flop occurs only at a clock pulse
edge
(b) the state that the flip-flop goes to depends on the D inputs
(c) the output follows the input at each clock pulse
(d all the above
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.15 Flip-Flops
7. Draw a master slave J-K flip-flop system. Explain its operation and
show that it eliminates the race around condition.
8. Show how to convert a J-K flip-flop into D-type. Give its truth table.
9. Draw the logic diagram of S-R flip-flop converted into D-type. Give
its truth table.
10. Draw the logic diagram to convert J-K into T-type. Give its truth table.
11. Explain with suitable waveform that one flip-flop does the frequency
division by 2.
12. Define the terms positive edge triggered flip-flop and negative edge
triggered flip-flop.
13. Draw the circuit symbol of J-K flip-flop with positive edge triggering
and with negative edge triggering.
14. State the function of PRESET and CLEAR input to the flip-flop. Draw
logic diagram of J-K flip-flop with preset and clear inputs.
15. Define the terms positive edge triggered and negative edge triggered
flip-flop. Draw the circuit symbol of J-K flip-flop with negative edge
triggered clock input.
16. What is flip-flop ? What is limitation of S-R flip-flop ?
17. Draw the circuit diagram of J-K flip-flop using NAND gates. Explain
the race condition. How to resolve this problem ?
18. How will you get D and T flip-flops from J-K flip-flop ? Draw logic
diagram and truth table of each.
[D] Short Answer Questions:
1. What is flip-flop?
2. List different types of flip-flop.
3. Define role of R and S inputs in RS flip-flop.
4. Explain truth table of RS flip-flop.
5. What do you mean by SET and RESET output of flip-flop.
6. What is race around condition in RS flip-flop.
7. State major drawback of RS flip-flop.
8. ‘D flip-flop can be used as memory device’, elaborate.
9. How we can convert JK flip-flop into T flip-flop?
10. How D flip-flop can be obtained by using RS flip-flop.
11. Draw logic diagram, symbol and write truth table for T flip-flop.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.17 Flip-Flops
Answers
[A] True or False :
(1) True (2) True (3) False
(4) False (5) True (6) True
(7) True (8) False (9) True
(10) True (11) True (12) False
[B] Multiple Choice Questions :
1. (a) 2. (c) 3. (a) 4. (b) 5. (c) 6. (b) 7. (a)
8. (b) 9. (d) 10. (a)
University Questions
March 2015
1. Draw the logic diagram of R-S flip-flop using four NAND gates and
explain its working.
2. Show a block diagram representation to obtain T flip-flop using J-K
flip-flop.
3. Explain the working of J-K master-slave flip-flop with the help of
block diagram.
March 2016
1. Explain the working of JK flip-flop using NAND gates.
2. What do you understand by edge triggered flip-flop?
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 1.18 Flip-Flops
March 2017
1. Draw the logic symbol for positive edge triggered D-Flip-Flop and
negative level triggered RS-Flip-Flop.
2. Explain the working of the following circuit.
A
X
Y
B
Fig. 1.13
3. What is race around condition ? Which Flip-Flop exhibits this
condition ? How can race around condition be eliminated ?
October 2017
1. Show the connections required to convert JK flip-flop to D flip-flop
and T flip-flop. Write the truth table for the same.
March 2018
1. With a neat logic diagram explain the working of clocked R-S flip-
flop.
✍✍✍
Unit 2…
Shift Registers and Counters
Charles Eryl Wynn-Williams (5 March 1903 – 30
August 1979), was a Welsh physicist, noted for his
research on electronic instrumentation for use in
nuclear physics. His work on the scale-of-two
counter contributed to the development of the
modern computer. In 1926, he applied his
electronics skills to construct an amplifier using
thermionic valves (vacuum tubes) for very small
electrical currents. It was realized that such
Charles Eryl Wynn- devices could be used in the detection and
Williams counting of Alpha particles in the nuclear
disintegration experiments then being undertaken
by Rutherford, who encouraged him to devote his attention to the
construction of a reliable valve amplifier and methods of registering and
counting particles.
In 1932, Wynn-Williams published details of his thyratron-based
scale-of-two counter, which allowed particles to be counted at much
higher rates than previously. His devices became crucial unifying elements
in the hardware of the emergent discipline of nuclear physics. 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. The most common type is a sequential
digital logic circuit with an input line called the clock and multiple output
lines. The values on the output lines represent a number in the binary or
BCD number system. Each pulse applied to the clock input increments or
decrements the number in the counter.
2.1 Introduction
• A flip-flop can store 1-bit of digital information. It is also referred to
as a 1-bit register. A register contains a group of flip-flops, the
number of flip-flops in a register being equal to the number of bits
present in the data.
2.1
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.2 Shift Registers & Counters
• The data in the register can be loaded serially or in parallel and can
be shifted out either serially or in parallel, which leads to four basic
types of registers.
• Fig. 2.1 shows symbolically the types of data movement in shift
register operation. The block represents an arbitrary four-bit register
and the arrow indicates the direction and type of data movement.
Serial Serial Serial
data data data
input output input
Serial
data
output
Parallel data output
(c) Parallel in serial out (d) Parallel in parallel out
shift register shift register
Fig. 2.1
2.2.1 Serial In Serial Out Shift Register
• This type of shift register accepts digital data serially that is one-bit at
a time on a single line. It produces the stored information on its
output also in serial form.
• Serial in serial out shift registers can be implemented either by using
J-K or D flip-flop. Fig. 2.2 shows a 4-bit serial in serial out shift
register using D flip-flop.
QA QB QC QD
Data D D D D Data
input output
FFA FFB FFC FFD
CLK
• Initially, all flip-flops are reset then the data to be entered can be
applied to the D input starting with LSB or MSB.
• Let the data to be entered is 1001 beginning with LSB. The 1 is put on
st
to the data input line, making D = 1 for FFA. When the 1 clock pulse
is applied, FFA is set thus storing 1. Next 0 is applied to the data
input, making D = 0 for FFA and D = 1 for FFB since QA is connected
to D of FFB.
• When the second clock pulse is applied, the 0 on the data input is
shifted into FFA and 1 that was in FFA is shifted into FFB.
• The next 0 in the binary number is now put on to the data line and a
clock pulse is applied. The 0 is entered into FFA. The 0 stored in FFA is
shifted into FFB and 1 stored in FFB is shifted into FFC.
• The last bit in the binary number is 1, which is now applied to the
data input and a clock pulse is applied. This time, the 1 is entered into
FFA, the 0 stored in FFA is shifted into FFB, the 0 stored in FFB is shifted
into FFC and the 1 stored in FFC is shifted into FFD.
• This completes the serial entry of the four-bit number into the shift
register.
QA QB QC QD = 0000
it becomes
• Timing diagram for this serial in serial out shift register function is as
shown in Fig. 2.3 below.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.5 Shift Registers & Counters
1
Data 0 0
input
1 2 3 4 5
Clk
1
0 0 0 0 0
QA
1
0 0 0 0 0
QB
1
0 0 0 0 0
QC
1
0 0 0 0 0
QD
Fig 2.3 : Timing diagram
• Thus, to shift 4-bit data into 4 flip-flop requires four clock pulses.
• If we want to get the data out of the register, they can be shifted out
serially and taken out at the QD output. After CLK4, in the data entry
operation described above, the right most 1 in the number appears
on the QD outputs.
• When CLK5 is applied, the second bit appears on the QD output. CLK6
shifts the third bit to the output and CLK7 shifts the fourth bit to the
output.
• When the stored bits are being shifted out, a new four-bit number
can be shifted in.
• The shift registers are also available in IC forms. The 7491A is an
example of an IC serial in serial out shift register.
2.2.2 Serial In Parallel Out Shift Register
• In this type of register, data bits are shifted in serially but shifted out
in parallel.
• In order to take parallel output, the output of each stage must be
available.
• Once the data is stored, each bit appears on its respective output line
and all bits are available simultaneously.
• Fig. 2.4 shows the 4-bit serial in parallel out shift register.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.6 Shift Registers & Counters
Data D QA D QB D QC D QD
input
FFA FFB FFC FFD
CLK
QA QB QC QD
CLK
Data 1 0 1 1
input
QA 1 0 1 1
QB 1 0 1
QC 1 0
QD 1
Fig. 2.5
• As shown in timing diagram data input is serially at first flip-flop FFA,
1011, which appears at output at same time i.e. parallel output after
clock cycle t4.
• The IC 74164 is eight-bit serial in parallel out shift register.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.7 Shift Registers & Counters
DA = 1 DB = 0 DC = 0 DD = 1
Enable
PE
G1 G2 G3 G4
S S S S
Logic 0 DIN QA DIN QB DIN QC DIN QD Serial
output
Q Q Q Q
R R R R
Reset
Clock
Fig. 2.6 : A four-bit parallel in serial out shift register
• There are four data inputs DA, DB, DC, DD and a parallel enable line
which allows four bits of data to be entered in parallel into the
register.
• When PE line is high, gates G1 through G4 are enabled which allow
each data bits to be applied to the D inputs of respective flip-flops.
• When a clock pulse is applied, the flip-flops with a 1 data bit will set
and those with 0 data bit will reset.
• Thus, it stores the data word in one clock cycle i.e. storing all four bits
simultaneously.
• When the PE line is low, parallel data input gates G1 through G4 are
disabled.
• Fig. 2.7 shows timing diagram for parallel in serial output shift
register.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.8 Shift Registers & Counters
CLK
0 0 1 1 1
Parallel input DA
data DB 0 1 0 1 0
DC 1 1 1 0 1
DD
1 0 0 1 1
PE
output
Serial
0 1 1 0 0 1
QD
Fig. 2.7
• At next clock pulse parallel in data 1001 is at output QD.
• As shown in timing diagram parallel data input is 1100 which appears
as serial output at QD, as soon as the parallel data is uploaded then
for each clock cycle serial data is out.
• The IC 74165 is an example of parallel in serial out on an IC shift
register.
2.2.4 Parallel In Parallel Out Register
• In parallel in parallel out shift register, data bits are entered
simultaneously as well as taken out simultaneously.
• Fig. 2.8 shows parallel in parallel out shift register.
D3 D2 D1 D0
D Q
Q33 D Q
Q32 D Q
Q31 D Q
Q30
CK CK CK CK
CLK
Q3 Q2 Q1 Q0
Fig. 2.8 : Parallel in parallel out shift register
• The data to be entered is applied to the data inputs of the respective
flip-flop.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.9 Shift Registers & Counters
• After applying the clock pulse data gets stored in the respective flip-
flop and also appears at the output from where it can be read
simultaneously.
• Fig. 2.9 shows timing diagram for parallel in parallel output shift
register.
CLK
D3 0
1 1 1 1
D2
Input
0 1 0 1 0
D1 1 1 1 0 1
D0 0
0 0 0 1
Q3 0 1 0
Output
Q2 0 0 1
Q1 0 1 1
Q0 0 0 0
Fig. 2.9
• As shown in timing diagram parallel input data is at D3, D2, D1, D0 i.e.
1010 and corresponding parallel output data is at Q3, Q2, Q1, Q0 at
the end of third clock pulse.
• The IC 74195/198 is an example of parallel in parallel out shift
register.
2.3 Ring Counter Using D Flip-Flop
• A shift register can be modified into a counter by connecting the
serial output back to the serial input. It is known as the ring counter
because it exhibits a specified sequence of states.
• A logic diagram for a four-bit ring counter is shown in Fig. 2.10.
Pr
D QA D QB D QC D QD
FFA FFB FFC FFD
CLK
Cr
Fig. 2.10 : 4-bit ring counter
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.10 Shift Registers & Counters
• Instead of counting in binary mode, the ring counter rotates the bit
among the flip-flop.
•
st
To begin with, a 1 is preset into the 1 flip-flop and the remaining
flip-flops are cleared.
•
st
When 1 clock pulse is applied, 1 is shifted from QA to QB.
•
nd
When 2 clock pulse is applied, 1 is further transferred from QB to QC
and so on.
• 1 is always retained in the counter and simply shifted around the ring
advancing one stage for each clock pulse.
• Table 2.1 shows the ring counter sequence.
Table 2.1 : Ring counter sequence
Clock
QA QB QC QD
pulse
0 1 0 0 0
1 0 1 0 0
2 0 0 1 0
3 0 0 0 1
4 1 0 0 0
Fig. 2.11 shows the waveforms for 4-bit ring counter.
+ VCC
J QA J QB J QC J QD
FFA FFB FFC FFD
CLK
K K K K
CLR
QA QB QC QD
• The counters in which output of one flip-flop drives the another are
called as ripple counters or asynchronous counters.
Table 2.2
Clock pulses D C B A
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
16 0 0 0 0 ← Reset
17 0 0 0 1 ← Recounting
• Since the circuit gives the output which is binary equivalent of
number of clock pulses applied at its input, it is known as binary
counter.
•
th
At the end of 15 clock pulse, flip-flop's output is DCBA = 1111 and
th
the circuit counts upto maximum of 15. When 16 clock pulse is
applied, A goes from 1 to 0, a negative going change. This causes B
to go from 1 to 0, another negative going change, this forces C to go
from 1 to 0. This negative going change causes D to go from 1 to 0,
so the entire counter resets and the output condition of flip-flop
th
becomes DCBA = 0000. When 17 clock pulse is applied, counter
starts recounting. Fig. 2.13 shows the waveforms associated with 4-bit
binary counter of Fig. 2.12.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.14 Shift Registers & Counters
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Clock
1 2 3 4 5 6 7 8
QA
QB
QC
QD
Fig. 2.13 : Waveforms of 4-bit binary counter
• From the waveforms, we see that the waveform at QA is one half the
frequency of clock, at QB frequency is one fourth of the clock
frequency, at QC one eighth of the clock frequency and at QD one
sixteenth of the clock frequency. Thus, counter is also a frequency
divider.
2.4.2 Synchronous Counter
• The ripple counters are simple to build, but they cannot be operated
by high frequency signal.
• Since each flip-flop has a delay time, in a ripple counter these delay
times are additive and the total settling time for the counter is
approximately the delay time of the total number of flip-flops. If each
flip-flop has a propagation delay of 10 ns, overall delay for 4-bit
counter becomes 40 ns.
• This speed limitation can be overcome by the use of synchronous or
parallel counter.
• Here every flip-flop is triggered by the clock and hence they all make
their transitions simultaneously and hence known as synchronous or
parallel counter.
• Fig. 2.14 shows the logic diagram, truth table and the timing diagram
of mod 8 synchronous counter.
+ VCC
J QA J QB J QC
Clock
FFA G0 FFB G1 FFC
K K K
QA QB QC
(a) Logic diagram
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.15 Shift Registers & Counters
C B A Count
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
0 0 0 0
(b) Truth table
J QA X J QB Y J QC
Clock
FFA FFB FFC
K K K
(c) Waveforms
Fig. 2.15 : Mod 7 synchronous counter
• For the logic diagram shown in Fig. 2.15 (a), counter advances by its
natural sequence upto count 7.
• During the count, output of all flip-flops is high and since they are
connected to input of NAND, it will generate low output which in
turn holds K low.
• When the next clock pulse is applied, since J = 1, K = 0 which does
not changes the stage of flip-flop A and hence output of the counter
goes from 111 to 001 state skipping 000 state. In turn the circuit
becomes the mod 7 counter.
• Thus, basically two types of counters can be designed and are also
available in the market. Depending upon the requirement and the
physibility, user has to select the type of the counter.
• The points of difference between synchronous and asynchronous
counters are as given below.
Synchronous (parallel) counter Asynchronous (ripple) counter
1. Every flip-flop is triggered by 1. The clock pulse is applied to
the clock in synchronism. the clock input of first flip-
Therefore, they make their flop only. Each flip-flop is
transitions simultaneously. triggered by the output of
previous flip-flop.
2. Setting time is less and is equal 2. Setting time is more and is
to the delay time of the single equal to the sum of
flip-flop. propagation delay times of
total number of flip-flops.
… (Contd.)
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.18 Shift Registers & Counters
J Pr Q Q0 J Pr Q Q1 J Pr Q Q2
CLK
K Q K Q K Q
Cr Cr Cr
FF0 FF1 FF2
Fig. 2.16 : 3-bit up counter
• In asynchronous up counter, a clock pulse drives FF0. Output of FF0
drives FF1 which then drives the FF2 flip-flop. All J and K inputs are
connected to Logic 1. Therefore, each flip-flop will toggle with
negative transition at its clock input.
• When the first clock pulse is applied, the FF0 changes state on its
negative edge. Therefore, Q2Q1Q0 = 001.
• On the negative edge of second clock pulse flip-flop FF0 toggles. Its
output changes from 1 to 0. This being negative change, FF1 changes
state. Therefore, Q2Q1Q0 = 010.
• Similarly, the output of flip-flop FF2 changes only when there is
negative transition at its input when fourth clock pulse is applied.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.19 Shift Registers & Counters
1
Q0 0
1
Q1
0
1
Q2 0
0 1 2 3 4 5 6 7 8
Fig. 2.17 : Timing diagram
2.5.1.2 Down Counter
• It is sometimes useful to have counter which can count in downward
sequence i.e. the count sequence is n, n − 1, n – 2, …, 1, 0. Upon
receiving the next clock pulse if the content of counter decreases
then it is known as down counter.
+ VCC
Pr Pr Pr
J QA J QB J QC
CLK FFA FFB FFC
K QA K QB K QC
Cr Cr Cr
Fig. 2.18 : 3-bit down counter
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.20 Shift Registers & Counters
Fig. 2.19 shows the waveforms associated with 3-bit down counter.
1 2 3 4 5 6 7 8
Clock
1 2 3 4
QA
QB
QC
J QA J QB J QC
Clock
FFA FFB FFC
K QA K QB K QC
Count
down
J QA J QB J QC
CLK
FFA FFB FFC
K K K
QC
QB
QA
QC QB QA Count
0 0 0 1
0 0 1 2
0 1 0 3
0 1 1 4
1 0 0 5
1 0 1 6
1 1 0 7
0 0 0 Reset
(b) Truth table
1 2 3 4 5 6 7
CLK
QA
QB
QC
CLR
(c) Waveforms
Fig. 2.21
• From the truth table of natural 3-bit counter, we know that count 7
(111) occurs only once.
• If QA, QB and QC outputs are connected to 3 input of 3 input NAND
gate, the output of NAND gate goes low only when QA = QB = QC =
1.
• If the output of the NAND gate is connected to the CLR input of each
flip-flop all the flip-flops will be cleared to zero's immediately as the
counter advances to count 7.
• The counter remains in state 7 only momentarily, therefore, it is a
mod 7 counter.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.25 Shift Registers & Counters
Think Over It
Summary
1. The group of flip-flop that is used to store binary number is called a
register.
2. The flip-flops must be connected such that the binary number can be
entered (shifted) into the register and can be shifted out. A group of
flip-flops connected to provide these functions is called a shift
register.
3. A register is normally used for storing and shifting data (1s and 0s)
entered into it from an external source and possesses no
characteristic internal sequence of states like that of a counter.
4. Serial-in to Serial-out (SISO) - the data is shifted serially “IN” and
“OUT” of the register, one bit at a time in either a left or right
direction under clock control.
5. Serial-in to Parallel-out (SIPO) - the register is loaded with serial
data, one bit at a time, with the stored data being available at the
output in parallel form.
6. Parallel-in to Serial-out (PISO) - the parallel data is loaded into the
register simultaneously and is shifted out of the register serially one
bit at a time under clock control.
7. Parallel-in to Parallel-out (PIPO) - the parallel data is loaded
simultaneously into the register, and transferred together to their
respective outputs by the same clock pulse.
8. Asynchronous counter : A type of counter in which each stage is
clocked from the output of the preceding stage.
9. Synchronous counter : A type of counter in which each stage is
clocked by the same pulse.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.26 Shift Registers & Counters
Exercise
[A] True or False :
1. A counter circuit is usually constructed of a number of flip-flops
connected in cascade.
2. In, parallel in to parallel out register the parallel data is loaded
simultaneously into the register, and transferred together to their
respective outputs by the same clock pulse.
3. Ripple counters are also called synchronous counter.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.27 Shift Registers & Counters
Answers
[A] True or False :
(1) True (2) True (3) False
(4) True (5) True (6) True
(7) True (8) False (9) False
(10) True (11) True (12) False
[B] Multiple Choice Questions :
1. (d) 2. (b) 3. (a) 4. (b) 5. (a) 6. (d) 7. (a) 8. (a)
9. (b) 10. (c) 11. (a) 12. (b) 13. (b) 14. (a) 15. (b) 16. (a)
17. (a) 18. (c) 19. (b) 20. (d) 21. (b) 22. (c) 23. (b) 24. (b)
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 2.32 Shift Registers & Counters
University Questions
March 2015
1. Define counter.
2. What is a shift register? List the types of shift registers. Explain the
working of 3 bit serial in serial out register for shifting the data to the
right.
March 2016
1. Explain the working of 3-bit ring counter.
2. Explain the working of 3-bit asynchronous up counter. Draw the
timing diagram.
3. Find the time required to shift 4-bit data through a 4-bit PISO shift
register if the clock frequency is 1 MHz.
March 2017
1. What do you mean by modulus of a counter ?
2. With neat diagram explain working of 3-bit left shift serial in serial
out shift register.
3. Explain working of 3-bit asynchronous down counter.
October 2017
1. Mention why synchronous counters are faster than asynchronous
counter?
2. With neat logic diagram explain the working of 3-bit parallel in
parallel out shift register.
3. Explain the working of 3-bit synchronous up counter with suitable
logic diagram. Draw the timing diagram for the same.
March 2018
1. Mention any two applications of shift registers.
2. Find the time required to load 8-bit data serially in a register if the
duration of clock pulse is 10 sec.
3. Explain the working of 3-bit asynchronous up counter with suitable
logic diagram. Draw the timing diagram for the same.
4. With the help of neat logic diagram explain the working of 3-bit
serial-in-serial out right shift operation.
✍✍✍
Unit 3…
Basics of Computer System
Frederick Phillips "Fred" Brooks Jr. (born April
19, 1931) is an American computer architect,
software engineer, and computer scientist, best
known for managing the development of IBM's
System/360 family of computers and the OS/360
software support package. He born in Durham,
North Carolina, attended Duke University,
graduating in 1953 with a Bachelor of Science
degree in physics, and he received a Ph.D. in
Fredrick Phillips applied mathematics (computer science) from
“Fred” Brooks Jr. Harvard University in 1956.
He served as the graduate teaching assistant for Ken Iverson at
Harvard's graduate program in "automatic data processing", the first such
program in the world. Few years after leaving IBM he wrote ‘The Mythical
Man-Month’. The seed for the book was planted by IBM's then-CEO
Thomas Watson Jr., who asked in Brooks's exit interview why it was so
much harder to manage software projects than hardware projects. In this
book Brooks made the now-famous statement, "Adding manpower to a
late software project makes it later." This has since come to be known as
Brooks's law. In 2004 in a talk at the Computer History Museum and also
in 2010 interview in Wired magazine, Brooks was asked "What do you
consider your greatest technological achievement?" According to him the
great decision was that to change the IBM 360 series from a 6-bit byte to
an 8-bit byte, thereby enabling the use of lowercase letters. His
contributions to human–computer interaction are described in Ben
Shneiderman's HCI pioneers website.
3.1 Introduction
• Nowadays computer is very essential tool in every applications,
Computer technology made several important impacts on our society
and life. This includes Home applications in personal use, Business,
Education, Health, Medicine, Science and technology, Banking sector,
Entertainment, Industrial applications, Engineering, Defense, Desk top
3.1
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.2 Basics of Computer System
• The first method uses state table and state diagrams for the control
unit. This method minimises the number of gates and flips-flops
used. The second and third method derive a logic circuit from the
flowchart or description of control unit behaviour. This approach is
much easier, but the number of gates and flip-flops may not be
minimum. We will discuss all the three methods below.
3.3.1.1 State Table
• The control unit designed by this method is normally consist of
sequential circuit. A sequential circuit is an interconnection of flip-
flops and gates. A combinational circuits consists of a combination of
gates.
• When a combinational circuit is combined with flip-flops, the circuit is
classified as sequential circuit. The Fig. 3.1 shows a block diagram of a
clocked sequential circuit. The combinational circuit receives the
binary signals from external inputs and from the outputs of flip-flops.
• The outputs of combinational circuits goes to external outputs and to
inputs of the flip-flops. The outputs of flip-flops are applied to
combinational circuit input and determine's the circuit behaviour.
Inputs Combinational
Outputs
logic circuit
Flip-Flops
Clock
x=0
00
x=1
x=0 01 11 x=0
x=1 x=1
10
x=0
Fig. 3.2 : State diagram for binary counter
• The diagram shows that the circuit follows a binary count when x = 1.
The state remains unchanged when x = 0. The state following 11 is
00, which causes the count to be repeated.
• The excitation table of a sequential circuit is an extention of state
table. This consists of a list of flip-flop input excitation that will cause
the desired state transition. If we use JK flip-flops, the J and K inputs
are the columns in table.
• Let A and B be two flip-flop outputs and X be input variable. The
table for the required output is derived from JK flip-flop state table.
We denote the inputs of flip-flop A by JA and KA and that of flip-flop
B by JB and KB.
• The Table 3.1 indicates the excitation table. An excitation table is an
extension of state table. The first five columns constitute the state
Table 3.1.
• In the first row, we have a transition for flip-flop A from 0 in the
present state to 0 in the next state. For Q(t) = 0 to Q(t + 1) = 0, it
requires that J = 0 and K = X. Hence JA = 0 and KA = X for first row.
• Similarly, for B from 0 in the present state to 0 in the next state, JB = 0
and KB = X. In second row, the transition of flip-flop B is from 0 in
present state to 1 in next state. It requires JB = 1 and KB = X. This
process continues for each row of the table and for each flip-flop.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.6 Basics of Computer System
0 0 0 1 0 x x x x
A 1 x x x x A 0 0 1 0
JA = Bx KA = Bx
B B
0 1 x x x x 1 0
A 0 1 x x A x x 1 0
JB = x KB = x
Fig. 3.3 : K-maps for combinational circuit of counter
• The Boolean equation obtained is :
JA = Bx KA = Bx
JB = x KB = x
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.7 Basics of Computer System
• The logic diagram is shown in Fig. 3.4 and consists of two JK flip-flops
and a AND gate. The J and K input determine the next state of the
counter.
x
J Q A
C
K
J Q B
c
Clock
Fig. 3.4 : Logic diagram of a 2-bit binary counter
• The state table method is best suited for small control units only. If
the state table is very large, it is very difficult to design a control unit.
The state table does not give information about behaviour of the
circuit, for example, existence of repeated pattern or loops. It also
tends to have random structure due to which maintaining and
debugging of the circuit is difficult.
3.3.1.2 Delay Element Method
• In this method, the control unit is designed using delay elements and
sequence initiation signals. Let us consider an example of generating
the following sequence of control signals at time t1, t2, …, tn using
hardwired control unit.
t1 : Activate {C1, j}
t2 : Activate {C2, j}
t3 : Activate {C3, j}
!
tn : Activate {Cn, j}
• The control signals must be generated in sequence and hence a
proper delay element needs to be used. At time t1, control signal
(C1, j) must be activated to perform the corresponding micro-
operation. Let the initiation signal called START (t1) be available at
time t1. The START (t1) signal activates control signal {C1, j}.
• If START (t1) is also given to a delay element of delay t2 − t1, the
output of delay element can work as START (t2), the control signal
{C2, j} can be activated.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.8 Basics of Computer System
{C1, j}
Delay C2
element
{C2, j} {C2, j}
C3
(a)
k inputs k inputs x x
No
Is x = 1 ?
Yes
(b) (c)
Fig. 3.5 : Flow chart to control circuit transformation
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.9 Basics of Computer System
Is No
x=1?
Yes {C4, j}
{C3, j}
{C5, j}
{C1, j}
Delay
element
{C2, j}
C1
Delay
element C2
x x
Ck
{C3, j} {C4, j}
Delay
element
{C5, j}
Fig. 3.7 : Control unit using delay element for the flowchart in
Fig. 3.6
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.10 Basics of Computer System
• The decoder generates k pulse signals on its output lines say (φi).
The consecutive pulses are separated by a clock period as shown in
Fig. 3.8 (a).
• The (φi) effectively divides the time required for one complete cycle
by the counter into k equal parts. The (φi) is called a phase signal.
• The Begin and End are the controls for the counter to start or stop
the count. If the Begin is activated, one of the input to AND gate
becomes 1 and when clock is high the counter is enabled. This
commence the counting which cycles until its reset input goes high.
The End or Reset if activated, resets the modulo-k counter and
disconnects the clock input. The symbol used to represent is shown in
Fig. 3.8 (b).
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.11 Basics of Computer System
Begin S J Count
Enable
Modulo - k
End R O Reset counter
Clock
Reset
Enable
1 / k Decoder
Begin
Modulo - k
End
sequence
Clock Clock counter
period Reset
f1 f2 fk f1 f2 fk
f1
Modulo - k f2
sequence Logic Count
counter circuit
fk
Cin
Fig. 3.9 : A control unit based on sequence counter
• The state table method is a more systematic approach, that minimises
the number of flip-flops used. The delay element method and
sequence counter method are less formal, but derive the circuit
directly from the behaviour of control unit. Therefore, it is much more
easier, although the number of flip-flops may not be minimised.
3.3.2 Micro-Program Control
• The principle of microprogramming is an elegant and systematic
method for controlling the sequence of micro-operations. The
control function that specifies a micro-operation is binary variable.
This variable is also known as control variable.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.12 Basics of Computer System
X1 3
0 D
4
MUX
External E1
address 1 5
Decoder
3.13
D X0
0
E0 MUX 6
1
7
External
condition '
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.14 Basics of Computer System
• The ROM contents are retrieved by the address in the CMAR. For
example, if X2 X1 X0 = 011, then the control lines C1 and C2 are
activated and the next ROM address 100 is feedback to CMAR at the
same time. The CMAR can be also loaded with an external address by
activating the external load input (i.e. E = 1).
• Many micro-programs can be loaded into the control memory and
any of these can be executed by specifying the starting address as an
external address.
• The length of micro-instruction is an important factor while designing
the control unit. This affects the memory-needed to store the micro-
programs in the control memory.
• The micro-instruction length is determined by :
1. The degree of parallelism required at micro-operation.
2. The way the control information is encoded or represented.
3. The method by which the address of next instruction is specified.
3.3.2.1 Micro-Instruction Sequencing and
Interpretation
• A micro-instruction consists of two fields : a control field used to
indicate the control lines to be activated and an address field for the
next micro-instruction in the control memory.
• The instruction in a micro-program follows a specific sequence. Each
instruction has a unique successor. The control sometimes might be
transferred depending on a condition or unconditionally, for example
in JUMP or JUMPZ.
• To control the proper sequencing of micro-instruction special
sequencer's are available.
• For example, AMD 2909 is a micro-program sequencer. AMD 2909 is
so called because it contains all the logic needed to generate next
address. It contains a micro-program program counter, a multiplexer
alongwith stack, so that subroutine calls are possible at micro-
program level.
3.4 Concept of Address Bus, Data Bus,
Control Bus
• A computer basically consists of a processor (CPU), different type of
memory devices and input-output devices. These devices are
connected to CPU by groups of lines. These lines, a communication
pathway, connecting two or more devices, are called buses.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.15 Basics of Computer System
Output
Memory
device
Control bus
Micro-
Address bus
processor
Data bus
DMA Input
controller device
Central
Processing
Unit
Input Output
device device
Memory
Register
set
Control
Arithmetic
Logic Unit (ALU)
Clock Input
R1
R2
R3
R4
R5
R6
R7
Load SELA SELB
(7 lines) MULTIPLEXER MULTIPLEXER
Output
Fig. 3.15 : Register set with common ALU
• The control unit controls the information flow through the registers
and ALU. The control unit enables or selects the appropriate units or
components in the system.
• For example, to perform the following operation
R1 ← R2 + R3
the control unit provides binary selection variables for the following
selector inputs:
1. MUX A selector (SELA) : This selection places the contents of
register R2 into bus A.
2. MUX B selector (SELB) : This selection places the contents of
register R3 into bus B.
3. ALU operation selector (OPR) : The operation to be performed
is selected i.e. in this case the operation selected is addition
A + B.
4. Decoder destination selector (SELD) : This selection is used to
transfer the content of output bus to register R1.
• The control unit generates the control variables at the beginning of
the clock cycle. The SELA and SELB variables select the registers R2
and R3. The contents of the register transfers through the
multiplexers to the ALU, where the operation is performed on the
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.21 Basics of Computer System
• The ALU performs all the arithmetic and logic operations. In addition,
the CPU also provides shift operations. The Table 3.3 shows the
various operations for the CPU.
Table 3.3 : Encoding of ALU Operations
OPR Select Operation Symbol
00000 Transfer A TSFA
00001 Increment A INCA
00010 Add A + B ADD
00101 Subtract A − B SUB
00110 Decrement A DECA
01000 AND A and B AND
01010 OR A and B OR
01100 XOR A and B XOR
01110 Complement A COMA
10000 Shift right A SHRA
11000 Shift left A SHLA
Examples of Micro-operations :
• The control word consists of 14 bits and specifies the micro-
operation needed for the CPU. The control word can be derived from
the selection variable.
• Consider the example,
R4 = R5 − R6
• It specifies R5 for A input and R6 for B input of the ALU, R4 is the
destination register and ALU operation is to subtract A − B. The
control word can be obtained from the corresponding binary value of
the each field from Table 3.2 and 3.3 respectively. The binary control
word for the subtract micro-operation is as follows 101 110 100
00101 and obtained as
Field SELA SELB SELD OPR
Symbol R5 R6 R4 SUB
Control Word 101 110 100 00101
• The control words for some of the other micro-operations are shown
in Table 3.4. The increment and transfer do not require B input and
hence it is indicated by a – (dash) in the table. Unused fields are 000
in the control word. Such many other micro-operations can be
generated.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.23 Basics of Computer System
FULL EMTY
4
SP R 3
Q 2
P 1
0
DR
• The 1-bit register FULL is set to 1 when the stack is full, and the 1-bit
register EMPTY is set to 1 when the stack is empty. The DR register is
used as data register to read from or write into data to the stack.
Push Operation :
• The initial condition is SP = 0, EMPTY = 1 and FULL = 0. The stack
pointer register points to the word at address 0, and the stack is
empty. A new item can be inserted if the stack is not full.
• The insertion of an item or data is implemented by the following set
of micro-operations :
SP ← SP + 1 Increment stack pointer to point to empty location
M[SP] ← DR Write the item on top of the stack
If (SP = 0) then (FULL ← 1) Check if the stack is full
EMPTY ← 0 Mark the stack not empty
• The stack pointer is incremented by 1 so that it points to the next
address location of the stack. Writing the data from the data register
DR onto the top of the stack indicates a push operation. The stack
pointer register SP holds the address of the top of the stack. M[SP] is
the data stored in the memory location pointed by the stack pointer
SP.
• The first item stored in the stack is at the address location 1 and the
last item is stored at the address 0. If SP = 0 means that the stack is
full and the FULL register is set to 1. If an item is written onto the
stack, then stack is not empty and hence EMTPY = 0.
Pop Operation :
• A new item is read from the stack using a pop operation. This item is
deleted from the stack if the stack is not empty (i.e. EMPTY = 0).
• The following sequence of micro-operations indicates the pop
operation:
DR ← M[SP] Read the item from the stack to the data register
SP ← SP − 1 Decrement the stack pointer
if (SP = 0) then EMPTY ← 1 Check if the stack is empty
FULL ← 0 Mark the stack not full
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.26 Basics of Computer System
• The top item of the stack is copied into the data register DR. The
stack pointer is decremented by 1. If the value of SP becomes 0 then
the stack is empty and EMPTY register is set to 1. This condition is
reached when the item that is read or deleted is at the address 0, the
initial value of the stack pointer register.
• If pop operation is executed when SP = 0, then decrementing SP
results in the address 111111 to be stored in SP. In this condition, the
word at address 0 receives the last item from the stack. The
erroneous condition occurs when the data is popped from an empty
stack (EMPTY = 1) or pushed onto the stack that is full (FULL = 1).
3.7.2 Implementation of Memory Stack
• A stack is implemented in a Random Access Memory (RAM) that is
attached to the CPU. The stack can also exit as mentioned in the
previous paragraph. When the stack is implemented in RAM by
setting aside a part of memory for all the stack operations. A
processor register is used as a stack pointer.
• The Fig. 3.18 shows that part of memory that is divided into three
segments viz. text or programme, data and stack. The text segment
contains the actual programme that is under execution.
• The data segment contains the array data that is used by the
programme and the stack segment is the stack used for various
operations on stack. The programme counter (PC) is used to point
the next instruction to be executed in the program.
• The address register (AR) is used to traverse in the data segment. The
stack pointer points to the top of the stack. All the three registers use
a common bus to address the memory and can provide address that
points to the respective memory i.e. text, stack or data.
• The three registers are used during the different phases of an
execution cycle. The PC register is used during the fetch phase of the
read instruction. The AR register is used during the execution phase
of the read. The SP register is used while using the stack to push or
pop items from the stack.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.27 Basics of Computer System
Address
Memory unit
5000
PC
Program/Text
6000
AR
Data
(Operands)
7000
Stack
7996
SP 7997
7998
7999
8000
DR
Fig. 3.18 : Computer memory with program/text, data and stack
• The Fig. 3.18 has the initial value of the stack pointer as 8001. The
stack grows with the decreasing value of the stack pointer. The SP
points to the topmost element that is filled. Therefore, if an item is to
be pushed on to the stack, then decrement the stack and add the
item.
• In the figure, the first item is stored at the address 8000, the second
item is stored at the address 7999 and the last item is stored at the
address 7000. Thus, the stack can contain 1000 items. There is no
facility available to check the limits of the stack.
• The items are added and removed from the stack using the data
register (DR). A new item is added to the stack by pushing the item
on to the stack as follows :
SPA ← SP − 1
M[SP] ← DR
• As mentioned in the previous paragraph the stack pointer is
decremented to point to the empty location. A memory write
operation inserts the word onto the stack.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.28 Basics of Computer System
• The Fig. 3.19 shows the stack operation. Each box represents stack
storage and the pointer points to the topmost element of the stack.
The RPN expression is scanned from left to right.
• The first two operands 1 and 2 read and pushed onto the stack. The
next symbol is an operator +. Therefore, the stack is popped twice to
get the operands for the operator and evaluated (1 + 2). The result is
again pushed onto the stack replacing the original two operands.
• Next we encounter two operands 4 and 5, so they are pushed onto
the stack. The stack operation that results (4 + 5) from the next +
replaces these operands. The last operation multiplies the topmost
numbers in the stack and produces the result 27. The computers that
use stack organized CPU provides a system program to perform the
conversion for the user.
5
2 4 4 9
1 1 3 3 3 3 27
• The CPU speed is very high in comparison with the typing speed of
even a fastest typist. Therefore, the CPU remains idle for most of the
time when a person is entering the information directly into the
computer memory using a keyboard.
• To make the efficient utilization of the computer, a large amount of
program and data is prepared in advance and stored on a storage
media like floppy disk or tapes.
• The information on the disk is then transferred into the computer
memory at a much faster rate. Similarly, the results of a program are
also transferred onto the high-speed storage like disks. Later, this can
be transferred to the printer to provide the printout of the results.
• The devices that are under the direct control of the computer are
called connected online. These devices are part of the computer
system and read information into or out of the memory unit on the
command of the CPU.
3.9 REVIEW OF PERIPHERALS
• In the following two sections we review the two most common
peripheral devices Keyboard/Monitor and Disk drive.
3.9.1 Keyboard/Monitor
• The most common means of computer/user interaction is a
Keyboard/Monitor arrangement. The user provides input through the
keyboard. This input is sent to the computer in binary code form and
may also be displayed on the monitor.
• Some additional information may be displayed on the monitor
provided to it by the computer.
• The unit of exchange is character. Each character is represented in
binary by using a 7-bit or 8-bit code. Some of the most commonly
used code is a 7-bit code known as ASCII (American Standard Code
for Information Interchange) and CCITT Alphabet Number 5
internationally.
• Each character is represented by 7-bit binary code. Therefore, 128
characters can be represented.
• There are two types of character sets : Printable and Control. The
printable characters are alphabetic, numeric and special characters,
that can be printed on paper or displayed on a screen.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.33 Basics of Computer System
I/O bus
Data
Address
Processor
Control
Keyboard
and Magnetic Magnetic
Printer tape
display disk
terminal
Central
Processing
Unit (CPU)
Peripheral devices
Memory Bus
Memory PD PD PD PD
Input/
Output
Processor I/O Bus
I/O Memory
(a)
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.38 Basics of Computer System
Data
Address
Processor
Memory control
I/O control
I/O Memory
(b)
Fig. 3.22 : Block diagram of I/O interface unit
3.10.2 ‘I/O Mapped I/O’ Versus ‘Memory Mapped I/O’
• As mentioned above, a common bus can be used to transfer
information between I/O or memory and CPU: The read and write
control a line specifies whether the address on address line is of
memory or I/O. The I/O read or I/O write control lines are enabled
during an I/O transfer.
• Similarly, memory read or memory write control lines are enabled
during memory transfer. In this configuration, the address space of
I/O and memory are distinct or isolated and hence referred to as
isolated I/O method for assigning addresses on common bus.
• In isolated I/O, the CPU has distinct input and output instruction, and
each of these instructions is associated with the address of an
interface register. The CPU fetches and decodes every instruction in
the program. If the operation code is I/O instruction, it places address
associated from the instruction on to the common address lines.
• Simultaneously, CPU enables I/O read or I/O write control lines. This
informs the external components that are attached to common bus
that the address on the address lines is for interface register and not
for memory word.
• If the CPU is fetching an instruction or operand from memory, CPU
places the memory address on the address lines. Simultaneously, it
enables the read memory or writes memory control lines. The
external component recognises that the address is of memory and
ignores it.
• The isolated I/O has separate memory and I/O addresses. Therefore,
any interface address assignment does not affect memory address
values. Each one has its own address space. In the other method, the
memory and I/O share or use the same address space. The computer
has only one set of read and write signals and does not distinguish
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.39 Basics of Computer System
Internal bus
RS1
Register select Control Control
RS0 Timing register
and
I/O read Control
RD
Status Status
I/O write
WR register
CPU I/O
Fig. 3.23 : I/O Interface example
CS RS1 RS0 Register Selected
0 X X None (Chip not selected)
1 0 0 Port A
1 0 1 Port B
1 1 0 Control
1 1 1 Status
• The control information is given by the CPU using control register.
The bits of control register are set to place the CPU and I/O in
different operating modes.
• For example, port A can be defined as ‘input port’ and port B as
‘output port’. The status register bits are used for indicating the
status, possibly an error occurring during data transfer. The status
may indicate that, port A has received data.
• The interface registers and CPU communicate using bi-directional
data bus. As shown in Fig. 3.23 the address bus line selects the
interface unit using chip select and the two register select inputs. A
decoder is used to enable the Chip Select (CS) when interface is
selected.
• The inputs RS1 and RS0 are two significant lines of the address bus.
These are used to select one of the four registers in the interface. The
information from register is read into the CPU when I/O read is
enabled. The CPU writes the data to the interface when I/O write is
enabled.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.41 Basics of Computer System
Think Over It
Summary
1. A computer basically consists of a processor (CPU), different type of
memory devices and input-output devices.
2. In computer organization architectural attributes include the
instruction set, the number of bits used to represent various data
types (e.g., numbers, characters), I/O mechanisms, and techniques for
addressing memory.
3. In computer organization, organizational attributes include those
hardware details transparent to the programmer, such as control
signals; interfaces between the computer and peripherals and the
memory technology used.
4. CPU consists of register set, ALU and control unit.
5. There are two types of control organization : Hardwired control and
Micro-programmed control.
6. In the micro-programmed organization, control information is stored
in the control memory.
7. There are three methods of designing the control units : The State
table method, Sequence counter method and Delay element method.
8. A state table relates outputs and next states as a function of inputs
and present state.
9. A state diagram represents graphically the behaviour of a sequential
circuit.
10. The state table method is best suited for small control units only.
11. The control unit using delay elements can be derived from flowchart
that specifies control signal sequence required.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.42 Basics of Computer System
12. Delay element method is more expensive than state table method
due to greater complexity.
13. The principle of microprogramming is an elegant and systematic
method for controlling the sequence of micro-operations.
14. A micro-program is a sequence of microinstructions.
15. A memory that is a part of control memory is referred to as control
memory.
16. The main advantage of micro-programmed control is that, once the
hardware configuration is established, there is no need to change the
hardware.
17. The length of micro-instruction is an important factor while designing
the control unit.
18. A bus is shared medium of communication and multiple devices can
be connected to it.
19. A bus consists of a set of lines, each line capable of transmitting
signal representing 0 and 1.
20. A CPU with large number of registers works most efficiently if a
common bus connects these registers.
21. A stack is normally implemented as a contiguous memory.
22. The stack pointer stores the address of the topmost element.
23. The insertion of a word onto a stack is called push.
24. The operation of deletion of an item from the stack is called pop.
25. A stack is used to evaluate any mathematical expression most easily.
26. The RPN expression is evaluated from left to right.
27. The devices that are under the direct control of the computer are
called connected online.
28. Disk drive contains electronics for exchanging data, control and
status signals with an I/O module and electronics for controlling the
disk read-write mechanism.
29. The most common means of computer/user interaction is a
Keyboard/Monitor arrangement.
30. The processor communicates with the peripheral by placing the
address of the peripheral on the address lines.
31. The key depression on a keyboard generates an electrical signal
interpreted by a transducer and translates to the bit pattern of the
corresponding ASCII code.
32. The I/O bus consists of data lines, address lines and control lines.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.43 Basics of Computer System
33. A control command activates the peripheral device and inform about
the action to be performed by the peripheral.
34. A status command is used to test various status conditions in the
interface and the peripherals.
35. A data output causes the interface to respond by transferring the
data from data bus to one of its registers.
36. The interface register is a part of memory system.
Exercise
[A] True or False :
1. Architectural attributes include the instruction set.
2. The RPN expression is evaluated from right to left .
3. The stack pointer stores the address of the topmost element .
4. A micro-program is a sequence of microinstructions.
5. A CPU with minimum number of registers works most efficiently
if a common bus connects these registers.
6. The state table method is best suited for large control units.
7. A stack is normally implemented as a contiguous memory.
8. The interface registers and CPU communicate using uni-
directional data bus.
9. All the read and write signals do not distinguish between
memory and I/O addresses.
10. Computer organization refers to the operational units and their
interconnections that realize the architectural specifications.
11. The control bus carries the address of a memory location or I/O
device that the CPU wants to access.
12. Delay element method is more expensive than state table
method.
[B] Multiple Choice Questions :
1. Which memory device is generally made of semiconductors?
(a) RAM (b) Hard-disk
(c) Floppy disk (d) CD
2. The control unit controls other units by generating ……
(a) Control signals (b) Timing signals
(c) Transfer signals (d) Command Signals
3. …… bus structure is usually used to connect I/O devices.
(a) Single bus (b) Multiple bus
(c) Star bus (d) Rambus
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.44 Basics of Computer System
4. The I/O interface required to connect the I/O device to the bus
consists of ……
(a) Address decoder and registers
(b) Control circuits
(c) Address decoder, registers and control circuits
(d) Only control circuits
5. During the execution of a program which gets initialized first?
(a) MDR (b) IR
(c) PC (d) MAR
6. The main advantage of multiple bus organization over a single bus is
……
(a) Reduction in the number of cycles for execution
(b) Increase in size of the registers
(c) Better connectivity
(d) None of the above
7. The clock rate of the processor can be improved by ……
(a) Improving the IC technology of the logic circuits
(b) Reducing the amount of processing done in one step
(c) By using the overclocking method
(d) All of the mentioned
8. When performing a looping operation, the instruction gets stored in
the ……
(a) Registers (b) Cache
(c) System heap (d) System stack
9. …… is an extension of the processor BUS.
(a) SCSI BUS (b) USB
(c) PCI BUS (d) None of the these
10. …… are the different type/s of generating control signals.
(a) Micro-programmed
(b) Hardwired
(c) Micro-instruction
(d) Both micro-programmed and hardwired
11. What does the end instruction do?
(a) It ends the generation of a signal
(b) It ends the complete generation process
(c) It starts a new instruction fetch cycle and resets the counter
(d) It is used to shift the control to the processor
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 3.45 Basics of Computer System
Answers
[A] True or False :
(1) True (2) False (3) True
(4) True (5) False (6) False
(7) True (8) False (9) True
(10) True (11) False (12) True
[B] Multiple Choice Questions :
1. (a) 2. (b) 3. (a) 4. (c) 5. (c) 6. (a) 7. (d)
8. (b) 9. (c) 10. (d) 11. (c) 12. (a) 13. (a) 14. (a)
✍✍✍
Unit 4…
Memory Organization
Tom Kilburn CBE FRS (11 August 1921 – 17
January 2001) was an English mathematician and
computer scientist. Over the course of a
productive 30-year career, he was involved in the
development of five computers of great historical
significance. The Williams tube, or the Williams–
Kilburn tube after inventors Freddie Williams and
Tom Kilburn, is an early form of computer
memory. It was the first random-access digital
Tom Kilburn storage device and used in the world's first
(CBE FRS) electronic stored-program computer.
In computing, memory refers to a device that is used to store
information for immediate use in a computer or related computer
hardware device. A memory unit is the collection of storage units or
devices together. The memory unit stores the binary information in the
form of bits. Generally, memory/storage is classified into two categories,
one as Volatile Memory and other Non-volatile memory. Volatile memory
loses its data, when power is switched off, whereas in non-volatile
memory there is a permanent storage and it does not lose any data when
power is switched off.
4.1 Introduction
• The memory unit that communicates directly within the CPU, Auxiliary
memory and Cache memory, is called main memory. It is the central
storage unit of the computer system. It is a large and fast memory
used to store data during computer operations.
• Devices that provide backup storage like magnetic disc, CD are called
auxiliary memory. It is not directly accessible to the CPU, and is
accessed using the Input/Output channels. The data or contents of
the main memory that are used again and again by CPU, are stored in
the cache memory so that we can easily access that data in shorter
time.
4.1
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.2 Memory Organization
Low cost and high access rates are desired memory characteristics
but in reality it is not possible. Generally, low cost memories are slower
and high access rate is achieved at higher cost. The relation can be
approximated by a straight line.
y x
If we write tA = 10 and C = 10 , then y = mx + k. The Fig. 4.1 shows
graph of access time versus cost for a memory technology.
0
10
Optical memory
Access time (tA)
-5 Magnetic
10 disks MOS RAMs
-11
Bipolar RAMs
10
-9 -6 -3
10 10 10
Cost (C)
Fig. 4.1
(iii) Access Modes : A desired location on memory device can be
accessed in many ways. Firstly, a memory location can be accessed in any
order. This type of memory is called Random Access Memory (RAM). In
RAMs, any memory location can be accessed directly, the access time is
independent of memory location. Best example is semiconductor
memory.
Secondly, a memory location can be accessed by only a
predetermined order. This type of memory is called serial-access memory.
In this, the access time depends on the location of the information, hence
increasing overall access time. Magnetic-tape, magnetic disk and optical
memories use serial access methods.
In random-access memory, a separate access mechanism or a read
write head is used for every location. The Fig. 4.2 shows schematic
diagram for R random access memories.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.5 Memory Organization
Read-write
heads
memory
location
Read - write
head
Memory
location
increase due to high storage density and high data-transfer rate. The
reliability can be increased by using error detecting and error correcting
codes.
(v) Power Consumption : The power consumption of a memory is
an important character while designing a memory system. The power
consumption decides the running cost of the computer system. A
memory having large capacity and high power consumption generates
heat. This requires proper cooling for avoiding memory failure.
(vi) Package Density : The package density is the bits of data stored
per unit area or volume. The package density determines the physical size
of the memory. A portable computer system needs smaller physical size
with high package density.
(vii) Alterability : Sometimes the method used to write information
into a memory may be irreversible i.e. once the data has written, cannot
be altered or atleast difficult to alter. The memories whose contents
cannot be altered are called Read Only Memories (ROMs). ROMs are
most widely used for storing control programme. The memories whose
contents can be (with difficulty and off-line) changed are called
Programmable Read-Only Memories (PROMS).
(viii) Permanence of Storage : There are three important
characteristics that can destroy the information :
(a) Destructive read-out
(b) Dynamic storage
(c) Volatility
(a) Destructive read out : Some memories have property that the
data is destroyed while reading the memory, this is called
Destructive Readout (DRO). But sometimes reading does not
affect the stored data, is called Non-destructive Read-Out
(NDRO). In DRO memories, each read operation must be
followed by write operation that restores the original data. This
restoration is done automatically by buffer register.
(b) Dynamic storage : In some memories, the data is lost due to
leakage of stored charge. In this, the data is restored by
refreshing it. Such type of memory is called dynamic memory. On
the other hand static memories do not decay with time.
(c) Volatility : In some memories data is lost by power failure. Such
memories are called volatile memories. Semiconductor memories
are volatile memories. The magnetic or optical memories do not
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.7 Memory Organization
loose data even after power failure and are termed as non-
volatile.
(ix) Cycle time and data transfer rate : In dynamic of DRO
memories, it is not possible to have second memory access until a restore
or refresh operation has been carried out. Thus, the time taken between
two accesses is greater than access time. This delayed time is called the
cycle time (tm).
So, time needed to complete read or write operation is tm, hence the
1
maximum amount of data transferred every second is . This is called
tm
the data transfer rate or bandwidth bm. The bandwidth is limited by
memory bus width w.
w
bm =
tm
(x) Physical characteristics : The physical properties used for
memories are electronic, magnetic, mechanical and optical. A storage
medium must have two well defined physical states, that can be used to
represent the logic 0 and 1. The access rate also depends on the rate of
reading physical 0 and 1 state.
Characteristics of Memory Technologies:
Technology Access Access Alterability Permanence Physical
time tA ‘S’ mode storage
medium
CD-ROM 1 Semi- ROM Non-volatile Optical
random
Magnetic 10−1 Serial R/W Non-volatile Magnetic
tape
Magnetic disk 10−2 Semi- R/W Non-volatile Magnetic
random
MOS 10−8 Random R/W Volatile Electronic
Bipolar Semi- 10−9 Random R/W Volatile Electronic
conductor
4.4 Memory Hierarchy
• The main constraints while designing a memory are size, speed and
cost. But memory with smaller access time is costly, with greater
capacity have low cost per bit and with greater capacity have greater
access time.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.8 Memory Organization
Cache
Main Secondary
CPU Memory Memory
(a)
Registers
Cache
Main memory
Magnetic disk
(b)
Fig. 4.4
• As one goes down the hierarchy, the following occur
(i) Decreasing cost/bit [Ci > Ci + 1]
(ii) Increasing capacity [Si < Si + 1]
(iii) Increasing access time [tAi < tAi + 1]
(iv) Decreasing frequency of access by processor.
• Thus, smaller, expensive, faster memories are supplemented by larger,
cheaper, slower memories.
• Suppose (M1, M2 … M3) are memory system forming a memory
hierarchy in which each member Mi is subordinate to next higher
member Mi − 1 of the hierarchy. In general, all the information stored
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.9 Memory Organization
Mask Register
Key
Match
Storage Cell Select
Circuit
Select
Output
Fig. 4.5
• The advances in semiconductor technology has made it economically
feasible. But, still high prices limit to applications where relatively
small amount of data is to be accessed very rapidly.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.13 Memory Organization
Head
window Locating notches
Fig. 4.6
Disk Formats :
• In order to locate a data for reading or data location for writing,
it is necessary to organize the disk into tracks and tracks into
sectors. The tracks are concentric set of rings separated by gaps
for proper data storage.
• The width of tracks is same as that of head. The data is recorded,
in the disk, in form of blocks. Typically, the block is smaller than
the capacity of a track. The region storing a block of data is
known as sector. The Fig. 4.7 show disk data layout.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.15 Memory Organization
Tracks
Direction of
arm motion
Recording
surface
Fig. 4.8 : Multiple platter disk
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.16 Memory Organization
Head
Capstans
Fig. 4.9 : Magnetic tape drive
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.17 Memory Organization
• The data transfer takes place only when the tape is moving at
constant velocity, hence the data transfer rate is determined by the
storage density and the tape speed. The information stored in tape, is
in the form of block. This permits the tape to start and stop between
blocks.
4.6 Data Read/Write Process
• The basic element of memory is memory cell. A memory of large
capacity is realized interconnecting small memory cells. Most
commonly, the cell has three functional terminals capable of carrying
an electrical signal. The select terminal, selects a memory cell for
read-write operation. The control terminal indicates read or write. For
reading the signal, third terminal is provided.
Control
Data in / out
Select
Input /
Output ROM RAM Processor
I/O
Control bus
Data bus
Fig. 4.11 : Main memory organization
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.18 Memory Organization
y2 Word 2
y3 Word 3
Address Decoder
A
Word 4
Address
y4
B
y5 Word 5
C
y6 Word 6
Word 7
y7
81 82 83 84 Word 8
y8
Output Buffer
D C B A
Fig. 4.12 : ROM organization
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.19 Memory Organization
y1 1 16 + VCC A 10 16 + VCC
y2 2 15 G (Enable) B 11 1
y3 C 2
3 14 E Input 12
3
y4 4 13 D D 13
7488 A 4
y5 5 12 C E 14 5
y6 6 11 B G 15 6
(Enable)
y7 A 7
7 10
Gnd 8 9 y8 Gnd 8 9
11 12 13 14 Word 1
Word 2
Address decoder
A0 1
Address
A1 15
14
A2
13
A3
CE
2
161 162 163 164 Word 16
Memory
enable
Write 3
Raed / Write Raed / Write Raed / Write Raed / Write
enable WE Bit 1 Bit 2 Bit 3 Bit 4
4 5 6 7 10 9 12 11
Output O1 O2 O3 O4
Input D1 D2 D3 D4
1 VCC 16 + 5 V
A0 1 16 + VCC A0
15
Address
A1 A1
CE 2 15 14
A2 O4 11
13
Data output
WE 3 14 A2
A3 9
O3
D1 4 13 A3
7489 2 7489 O2 7
O1 5 12 D4 Memory enable CE
Write enable 3 5
WE O1
D2 6 11 12
O4 D4
10
Data Input
O2 7 10 D3 D3
6
D2 8
Gnd 8 9 O3 4
D1
8 bits
Address RAM RAM 2
bus 20 bits 20 bits
1M ´ 8 1M ´ 8
Fig. 4.15
• To obtain a memory of capacity m words, using memory chips with
M words each, the number of chips required is an integer next higher
to the value of m divided by M.
• Procedure to connect these memory chips to obtain vertical
expansion of memory is as described in following steps.
Step 1: Connect the corresponding address lines of each chip
individually.
Step 2: Connect read input (RD) of each chip together. Connect write
(WR) input together.
Step 3: Using decoder we can select chip select (CS) terminal of each
memory one by one for storing data.
Horizontal Memory Expansion:
• Word length expansion connects memory devices in parallel, so that
the address range is unchanged but the data storage wider. Word
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.22 Memory Organization
Control Control
bus bus
Data
8 bits bus
Address ROM ROM 2
bus 16 bits 16 bits
65,536
´4 Data
4 bits bus 4 bits
Control
bus
Fig. 4.16
• With available word size of memory chip N and required word length
n (n > N), we have to combine similar memory chips together for
getting the desired word size n.
• The number of memory chips required is an integer next higher to
the value n divided by N.
• Procedure to connect these memory chips to obtain horizontal
expansion of memory is as described in following steps.
Step 1: Connect the corresponding address lines of each chip
individually i.e. A0, A1, A2, A3, … address lines to be connected together.
Step 2: Connect the read input (RD) of each memory chip together
which will act as the read input for overall combined memory.
Step3: Connect Write (WR) and Chip Select (CS) inputs of all chips
together.
• Using bidirection input and output lines common to all memory chips
horizontal memory expansion is achieved.
4.8 Role of Cache Memory
• The performance of a microcomputer can be improved significantly
by introducing a small inexpensive, but fast memory between the
microprocessor and main memory. This memory is called cache
memory.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.23 Memory Organization
Cache
Main
CPU Memory
3 3
Block Block
n n
2 -1 2 -1
Word Block length
length (K-words)
Fig. 4.18 : Cache main memory structure
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.24 Memory Organization
• The Fig. 4.18 shows the structure of a cache and main memory
n
system. For n-bit address the main memory will have 2 addressable
word. For mapping, the main memory is divided into fixed length
blocks M of K-word each. The cache consists of C block of K word
each called cache pages or lines. Each of the cache page is a subblock
of main memory (C << M).
• In general, a subset of the blocks of main memory is stored in the
cache. For reading memory, a block of memory is transferred to slot
of cache. But a cache has less slots, so same slots should be used for
storing a block. Thus, the slot has a tag to indicate the block currently
stored in the cache.
• If a physical address is generated by the processor, it is compared
with the tag (Address tag) of the cache. If it matches, there is cache
hit. On the other hand if it does not matches, there is cache miss,
then the blocks are copied into the cache from main memory. In this
process, Last Recently Used (LRU) method is employed for replacing
the data.
• The relationship between the cache and main memory block is
established using mapping technique : (i) Direct mapping (ii) Fully
associative mapping (iii) Set-associative mapping.
(i) Direct Mapping:
• One of the simplest memory mapping is direct mapping. In this, the
main memory address is divided into two fields an index field and a
tag field. The number of bits in the index field is equal to the number
of bits required to access the cache.
• If the main memory address is m-bit wide and the cache memory
address is n-bit wide, then index field is n-bit wide and tag field is
(m − n) bit wide. The each word in the cache includes data and its
associated tag.
• When address is generated by processor, first index address is used
for addressing cache. The tag field in the word read from cache is
compared with the tag field of main memory, If this matches, a cache
hit occurs. If a miss occurs, the data with new tag is written in the
cache from main memory.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.25 Memory Organization
• The main disadvantage of direct mapping is that, the cache hit ratio
drops sharply if two or more frequently used blocks happen to have
same index but different tags. This possibility is minimised by placing
such blocks far apart in the logical address space.
• The general mechanism for direct mapping is shown in Fig. 4.19.
Bn LM
n
2 -1
Word
length
(a) Main memory (b) Cache
Fig. 4.19 : Direct mapping
• For cache access, the main memory can be viewed as consisting of
three fields. The lowest bits identify the word or byte in the block of
main memory. The last part specifies the block of the main memory.
The middle part identifies the line of the cache.
Memory address
MSB LSB
Memory address
Tag Word
MSB LSB
Start
Process
Compute physical
address A of next
word required
Fetch
the data
Is
A in memory
Yes
Program execution
No suspended
Is
there a page No Select page
frame in to be thrashed
memory
Yes
No Is
it altered
Yes
Transfer to
secondary memory
Transfer page
containing A from
secondary memory
Think Over It
Summary
1. The memory unit that communicates directly within the CPU, Auxiliary
memory and Cache memory, is called main memory. Main memory is
also called as core memory.
2. The main memory of computer consists of RAM, ROM, EPROM,
EEPROM.
3. The performance of a microcomputer can be improved significantly
by introducing a small inexpensive, but fast memory between the
microprocessor and main memory. This memory is called cache
memory.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.31 Memory Organization
4. Devices that provide backup storage like magnetic disc, CD are called
auxiliary memory.
5. The basic element of memory is memory cell.
6. The data or contents of the main memory that are used again and
again by CPU, are stored in the cache memory.
7. Virtual memory is a system where all physical memory is controlled
by the operating system.
8. Memory is an essential part of computer which stores data and
instructions required for its operation.
9. A processor is a semiconductor device and operates at very high
speed.
10. Semiconductor memories are faster, smaller in size and light in
weight, but relatively costly, whereas magnetic or optical memories
are cheaper but are slow in comparison with semiconductor
memories.
11. The memory can be divided into following main groups, Internal
Processor Memory, Cache Memory, Main Memory, Secondary or
Auxiliary Memory.
12. Memory Device Characteristics are cost, access time, access mode,
reliability, power consumption, package density, alterability,
permanence of storage, cycle time and data transfer rate and physical
characteristics.
13. The main constraints while designing a memory are size, speed and
cost.
14. In an associative memory any stored item can be accessed directly by
using the contents of the item in the question, generally some
specified subfield as an address.
15. The auxiliary memory is also called secondary memory or backing
memory.
16. Secondary memory is generally used for supporting the main
memory.
17. Secondary memory is a slow, low cost and larger in capacity.
18. The main memory available to processor is called real or physical
memory.
19. The 'virtual memory' means which appear to be present but actually it
is not.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.32 Memory Organization
20. The virtual memory technique allows users to use more memory for a
programme than the real memory of computer.
21. It is convenient to divide main memory into fixed size contiguous
areas, called page frames and to divide programs into pieces of the
same size, called pages.
22. The way of dividing the addressable memory is called the
segmentation.
23. The paging is invisible to the programmer, whereas segmentation is
visible to the user.
24. Segmentation provides a convenient method for organizing
programs and data.
25. The segments are dynamic i.e. variable in size.
26. There are three ways to map logical addresses to physical addresses,
paging,
27. Segmentation and Combination of paging and segmentation.
Exercise
[A] True or False :
1. Cache memory is the onboard storage.
2. Main memory is used for storing currently needed instructions and
data of program.
3. Cost of a memory unit decides the price of complete memory device.
4. In RAM we can read or write data at any given memory location.
5. ROM is used to store library subroutine, system programs and
function tables.
6. Logical address space can be larger than physical address space.
7. The auxiliary memory is also called as temporary memory.
8. The paging is invisible to the programmer, whereas segmentation is
visible to the user.
9. Secondary memory is fast and cheaper than main memory.
10. The way of dividing the addressable memory is called the paging.
11. Virtual memory is a system where all physical memory is controlled
by the processor used in a system.
12. A processor is a semiconductor device and operates at very high
speed.
F.Y.B.Sc. Electronics (Comp. Sci.) (P-II) 4.33 Memory Organization
10. Storage which stores or retains data after power off is called ……
Answers
[A] True or False :
(1) True (2) False (3) True
(4) True (5) True (6) True
(7) False (8) True (9) False
(10) False (11) False (12) True
University Questions
April 2015
April 2017
October 2017
April 2018
✍✍✍
SAMPLE QUESTION PAPER - I
Note:
(a) Q. 1 is compulsory.
(b) Solve any three questions from Q. 2 to Q. 5.
(c) Questions 2 to 5 carry equal marks.
P.1
SAMPLE QUESTION PAPER - II
Note:
(a) Q. 1 is compulsory.
(b) Solve any three questions from Q. 2 to Q. 5.
(c) Questions 2 to 5 carry equal marks.
✍✍✍
P.2