Memory Organization
Chapter 4
Introduction
Memory system of a computer is just as important as the CPU in
determining its performance because programs and data they operate on
are stored in the memory of a computer. The execution speed of programs
is highly dependent on the speed with which instructions and data can be
transferred between the processor and memory. It is also very important
to have a large memory to enhance the execution of programs that are
large and deal with huge amount of data.
Ideally, we would like to have the memory which would be fast,
large and inexpensive. Unfortunately, it is impossible to meet all three
requirements simultaneously. If we increase the speed and capacity, then
cost will increase. We can achieve these goals at optimum level by using
several types of memories.
Memory Parameters :
There are three basic parameters in choosing a memory:
• Capacity
• Speed
• Bandwidth or Data Transfer Rate
Capacity :
The capacity of the memory is an important factor that characterizes the
size of a computer. Memory can be viewed as a storage unit containing m
number of locations (addresses), each of which stores n numbers of bits,
as shown in the figure. In other words, the memory has m addresses and
with word length of n bits. Each word is addressed uniquely by log 2 m
number of bits. All n bits of a word are read or stored in one basic
operation. The total capacity of the memory is expressed as m x n – bit or
m – word memory. n
The maximum capacity of a memory is determined by the addressing
scheme. For example, a 16 bit computer that generates 16 bit addresses is
capable of addressing up to 2 16 = 64 K memory locations.
Speed :
A useful parameter of the memory is its speed of operation, which is the
time that elapses between the initiation of an operation and the
completion of that operation. This is measured in terms of two
parameters : access time, tA and cycle time tC. Sometimes speed is
measured in terms of access time and sometimes of cycle time. For
example, to perform a read operation, first the address of the location is
send to memory followed by the ‘read’ control signal. The memory
decodes the address to select the location and read out the contents of
the location. The access time is the time taken by the memory to
complete a read operation from the moment of receiving the ‘read’
control signal. Generally, access time for read and write are equal. The
memory cycle time is the minimum time delay required between the
initiations of two successive memory operation. After one memory access
the memory remain busy for some internal operations and during this
time another memory access, read or write can not be initiated. This time
is called the recovery time tR. Actually cycle time tC = tA + tR.
Bandwidth or Data Transfer Rate :
The maximum amount of information that can be transferred to or from
the memory per unit time is called bandwidth and is expressed as
number of bytes or words per second. It depends on the speed of access
and the width of the data bus.
Memory Hierarchy :
CPU
Level - 0
Registers
Higher Capacity
Cache (SRAMs) Level - 1
Higher Cost/ bit
Main Memory Level - 2
Higher Speed
Magnetic disks Level - 3
Secondary Memory
Magnetic tape units Level - 4
Capacity
Secondary Memory :
The slow – speed and low – cost devices that provide backup storage are
called secondary memory. The most commonly used secondary memories
are magnetic disks, such as hard disk, floppy disk and magnetic tapes.
This type of memory is used for storing all programs and data, as this is
used in bulk size. When a program not residing in main memory is
needed to execute, it is transferred from secondary memory to main
memory. Programs not currently needed in main memory (in other
words, the programs are not currently executed by the processor) are
transferred into secondary memory to provide space for currently used
programs and data.
Main memory :
This is the memory that communicates directly with CPU. Only programs
and data currently needed by the CPU for execution reside in the main
memory. Main memory occupies central position in hierarchy by being
able to communicate directly with CPU and with secondary memory
devices through an I/O processor, as depicted in the figure presented in
the next slide.
Interconnection between memories and CPU
Secondary I/O Main
Memory Processor Memory
CPU
Cache
Registers Memory
Cache Memory :
This is a special high – speed main memory, sometimes used to increase
the speed of processing by making the current programs and data
available to the CPU at rapid rate. Generally, the CPU is faster than main
memory, thus resulting that processing speed is limited mainly by the
speed of main memory. So, a technique used to compensate the speed
mismatch between CPU and main memory is to use an extremely fast,
small cache between CPU and main memory, whose access time is close to
CPU cycle time. The cache is used for storing portions of programs
currently being executed in CPU and temporary data frequently needed
in the present computations. Thus, the cache memory acts as a buffer
between CPU and main memory. By making programs and data available
at rapid rate, it is possible to increase the performance of computer.
There are two types of cache memory
Level 1 cache : This type of cache are on – chip cache are placed inside
the CPU chip.
Level 2 cache : Not placed in the CPU chip but this memory placed
closer to the CPU. Placed between Main memory and CPU.
An on – chip cache is slightly faster than an off – chip cache.
Internal Memory :
This memory refers to the high – speed registers used inside the CPU.
These registers hold temporary results when a computation is in
progress. There is no speed disparity between these registers and the CPU
because they are fabricated with the same technology. However, since
registers are very expensive, only a few registers are used as internal
memory.
Access Method :
A basic characteristic of a memory is the order or sequence in which
information can be accessed. The methods of accessing include the
following :
a) Sequential or Serial access
b) Random access
c) Direct or Semi – random access
d) Associative
Sequential Access :
I this method, the memory is accessed in a specific linear sequential
manner. For example, if fourth record (collection of data) stored in a
sequential access memory needs to be accessed, the first three records
must be skipped. Thus, the access time in this type of memory depends
on the location of the data. Magnetic disks, magnetic tapes and optical
memories like CD – ROM use this method.
Random Access :
In this method of access, any location of the memory can be accessed
randomly. In other words, the access of any location is not related with its
physical location and is independent of other locations. For random
access, a separate mechanism is there for each location. Semiconductor
memories (RAM, ROM) are this type.
Direct Access :
This method is basically the combination of previous two methods.
Memory devices such as magnetic hard dicks contain many rotating
storage tracks. If each track has its own read/write head, the tracks can be
accessed randomly, but access within each track is sequential. In this case
the access is semi – random or direct. The access time depends on both
the memory organization and the characteristic of storage technology.
Associative Access :
This is a special type of random access method that enables one to make a
comparison of desired bit locations within a word for a specific match
and to do this for all words simultaneously. Thus, based on a word’s
content, word is retrieved rather than its address. Cache memory uses
this type of access method.
Main Memory
The central storage unit in a computer system is the main memory which
is directly accessible by the CPU. It is a relatively large and fairly fast
external memory used to store programs and data during the computer
operation. Most of the main memory in a general – purpose computer is
made up of RAM (Random Access Memory) integrated circuit chips,
which are volatile (i.e. if power goes off, the stored information is lost) in
nature. But a small part of the main memory is also constructed with
ROM (Read Only Memory) chips, which are non – volatile. Originally,
RAM was used to refer to a random – access memory, but now it is used to
mean a read – write memory (RWM) to distinguish it from a read – only
memory, although ROM’s access mechanism is also random.
RAM is used to store the most of the programs and data that are
modifiable. Integrated RAM chips are available in two forms : one is static
RAM (SRAM) and another is dynamic RAM (DRAM). The SRAM memories
consist of circuits capable of retaining the stored information as long as
power is applied. That means this type of memory require constant
power. SRAM memories are used to build cache memory. On the other
hand, DRAM stores the binary information in the form of electric charges
that applied to capacitors. The stored information on the capacitors tend
to loss over a period of time and thus periodically recharge is required.
The main memory is generally made up of DRAM chips.
Comparison of SRAM and DRAM
1. The SRAM has lower access time, which means it is faster compared to
the DRAM.
2. The SRAM requires constant power supply, which means this type of
memory consumes more power; whereas, the DRAM offers reduced
power consumption, due to the fact that the information is stored in
the capacitor.
3. Due to the relatively small internal circuitry in the one – bit memory
cell of DRAMs, the large storage capacity in a single DRAM memory
chip is available compared to the same physical size SRAM memory
chip. In other words, DRAM has high packaging density compared to
the SRAM.
4. SRAM is costlier than DRAM
5. SRAM is used to build cache memory but DRAM is used to made up
Main memory.
Read Only Memory(ROM)
Another part of main memory consists with ROMs (read only memories),
whose contents are not generally altered by the users/programmers. In
other words, the ROM is generally used for storing the programs and data
that are permanently resident in the computer. In this connection, it is
worth noting that the ROM portion of the main memory is needed for
storing an initial start – up program called Bootstrap Loader. The
Bootstrap Loader is a system program whose task is to load a portion of
the operating system from secondary memory (hard - disk) to main
memory (RAM).
RAM chip:
9 – bit address bus AD0 – AD8
R/W’
512 x 8
RAM
8 – bit data bus
Chip selection
lines
Con..
Most of the main memory is consisted of RAM chips, since RAM chip is
used to read and write operation on programs and data. The chip, shown
in the previous slide, has 512 locations each location capable of storing 8
bits. This requires a 9 – bit address bus and 8 – bit bidirectional data bus.
Here note that the data bus is bidirectional, since it allows the transfer of
data either from memory to CPU during read operation or from CPU to
memory during write operation. The R/W’ control line specifies either
read or write operation. When this line is high, the control line sends
read signal and when it is low, it sends write signal. Some chip selection
lines are required to enable the desired chip from multiple chips in a
large memory system before read or write operation on it.
ROM Chip :
A ROM is used to read the information from it. So, it does not have any
R/W’ line, because when a chip is selected, it will be used to read the
binary information from it. Also, the data bus is unidirectional. A ROM
chip is organized externally in a similar manner as RAM. A block diagram
for a ROM chip of size 512 x 8 is shown below.
9 – bit address bus AD0 – AD8
512 x 8
ROM 8 – bit data bus
Chip selection
lines
For the same physical size chip, it is possible to have more bits of ROM
than of RAM, because the internal binary cells in ROM occupy less space
than in RAM, which can be easily understood by their internal circuits. In
other words, ROM has high packaging density compared to the RAM.
Construction of large memory using small chips :
The large memory can be constructed by expanding some small chips in
either horizontally or vertically. In horizontal expansion, the word in
increased; whereas in vertical expansion, number of locations is
increased. For example, two RAM chips each of size 512 x 4 can be
horizontally expanded to obtain a large memory of size 512 x 8 and the
same number of 512 x 4 RAM chips can be connected vertically to
construct a large memory of size 1K x 4. sometimes large memory is
constructed using either horizontal or vertical technique or sometimes
using both techniques.
Large memory to be constructed can be of heterogeneous (i.e.
mixture of both RAM and ROM) or homogeneous (i.e. either all chips are
RAM or ROM, but not both).
RAM and ROM chips are available in variety sizes. If the memory
needed for a computer is larger than the size of a single chip, then it is
necessary to combine a number of smaller chips to form the required
memory size.
Example : Suppose, we have two sets of memories with RAM of size 128 x
8 and ROM of size 512 x 8 to design a memory of capacity 1024 x 8.
Address Lines CPU
16 - 11 10 9 8 7 to 1 R/W’ Data
DECODER R/W’
AD 1 – 7
3 2 1 0 CS1 128 x 8
CS2 RAM1
R/W’
AD 1 – 7
CS1 128 x 8
CS2 RAM2
R/W’
AD 1 – 7
CS1 128 x 8
CS2 RAM3
R/W’
AD 1 – 7
CS1 128 x 8
CS2 RAM4
AD 1 – 7
AD 8
AD9 512 x 8
CS ROM
Memory Address Map:
The interconnection between memory and CPU is established from the
size of memory needed and the type of RAM and ROM chips available.
The addressing of memory can be designed by means of a table, known as
memory addressing map, which specifies the memory address space
assigned to each chip. The address map for previous example is shown
below:
Chip selected Address space Address Bus
(in HEX)
10 9 8 7 6 5 4 3 2 1
_________________________________________________________________
RAM 1 0200 - 027F 1 0 0 x x x x x x x
RAM 2 0280 - 02FF 1 0 1 x x x x x x x
RAM 3 0300 - 037F 1 1 0 x x x x x x x
RAM 4 0380 - 03FF 1 1 1 x x x x x x x
ROM 0000 - 01FF 0 x x x x x x x x x
Example
Suppose, we have to construct a large RAM – type memory of size 1K x 8
using same size smaller RAM chips each of size 256 x 2.
The block diagram for the memory connection is shown in the next slide.
A0
A1
:
:
A7
0
D
E
A8
C
1
O
A9
D
2
E
R
3 D 7,6 D 5,4 D 3,2 D 1,0
SRAM Cell
Bit lines
b b’
T1 T2
A B
Word line
DRAM Cell
Bit line
Word line
C
A ROM memory Cell
Bit line
Word line
P
Types of ROM
PROM Memory Cell :
Some ROM designs allow the data to be loaded into the cell by users, and
then this ROM is called PROM (Programmable ROM). Inserting a fuse at
point P in the figure of previous slide achieves programmability. Before it
is programmed, the memory contains all 0s. The user can insert 1s at the
required locations by burning out the fuses of cells at these locations
using high – voltage currents. The PROM’s cells are once programmable,
i.e. the user can store the desired bits in the cells only once and these bits
cannot be altered.
EPROM :
An erasable PROM (EPROM) uses a transistor in each cell that acts as a
programmable switch. The contents of an EPROM can be erased ( set to
all 1s) by burning out the device to ultraviolet light for a few (20 to 30)
minutes. Since ROMs and PROMs are simpler and thus cheaper than
EPROMs. The EPROMS are used during system development and
debugging.
Cont….
EEPROM (Electrically Erasable PROM) :
In many applications, permanent data have to be generated in a program
application and need to be stored. For example, in a mobile phone the
telephone numbers are to be kept permanently till the user wants to erase
those data. Similarly, the user may wish to erase previously entered
information. EEPROMs have an advantage in that the information in
them can be selectively erased by writing 1s and each bit in the
information can be stored again by writing the desired bit. An EEPROM
needs two write operations at an address, one for erase and one for
writing. RAM writes the information directly without first erasing that
information at that address. But in the EEPROM, the stored information
is non – volatile.
Flash Memory :
A currently popular type of EEPROM, in which erasing is performed in
large blocks rather than bit by bit, is known as flash EPROM or flash
memory. Erasing in large blocks reduces the overhead circuitry, thus
leading to greater density and lower cost.
Secondary (Auxiliary) Memory
The largest capacity and less expensive memory in the system is
secondary memory. The following hierarchy diagram illustrates some of
the devices that are available for secondary (auxiliary) storage of data.
Tape
Floppy
Magnetic
Disk
Hard
Storage
CD – ROM
DVD - ROM
CD – R
Optical
DVD - R
CD – RW
DVD – RAM
DVD - RW
Magnetic Tape
Magnetic tapes were the first kind of secondary memory used in
computer systems. A tape is flexible polyester coated with special
magnetic material. A magnetic tape is similar to a home tape recorder.
However, a magnetic tape holds digital information, whereas a tape
recorder holds analog information. A magnetic tape divided vertically
into frames and horizontally into nine parallel tracks.
Each frame is capable of storing 9 bits of data. The first 8 bits form
a data byte and the 9th bit holds the parity. The parity bit is used for error
correction and detection. Information is stored along tracks using read –
write heads. Read – write heads are designed in such a way that they can
access all nine tracks contained in a frame simultaneously. Data is written
on the tape by varying the current through the read – write heads. Data is
read or written in contiguous records. The records are separated by gaps
referred to as inter – record gaps. The length of a magnetic tape is
typically 2400 feet and it is stored on a reel. The major difficulty with this
device is the particle contamination caused by improper manual
handling.
A part of magnetic tape
Frame 1
Frame 2
Track 1
Track 2
Track 9
First Record Second Record
Inter – Record
gap
Magnetic Disk
Disks that are permanently attached to the unit assembly and cannot be
removed by the general user are called hard disks.
Floppy Disk :
A Disk drive with removable disks is called a floppy disk drive. The disks
used with a floppy disk drive are small removable disks made of plastic
coated with magnetic recording material. There are two sizes commonly
used, with diameters of 5.25 and 3.5 inches.
Magnetic Hard Disk
A Disk Pack
Cont…
• The magnetic Disk is made of either aluminium or plastic coated with
magnetic material.
• The recording surface is divided into number of concentric circle
called tracks.
• Tracks are divided into sectors
• The innermost track has maximum storage density.
• Data can be read or write through the read write head.
• Several identical disks are staked over one another with some
separation between them form a disk pack.
• There is one read – write head per surface.
• Same radius tracks on different surfaces of disks form a logical
cylinder.
• The extra electronic circuit, disk controller, control the operations.
• The time required to position the read – write head over the desired
track is known as seek time ts.
• After positioning on track the disk controller has to wait for desired
sector come under the read write head is called rotational latency tl.
• The access time = ts + tl.
Thank You