0% found this document useful (0 votes)
50 views29 pages

Memory Organization

memory oganization

Uploaded by

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

Memory Organization

memory oganization

Uploaded by

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

Memory Organization

Memory Hierarchy
Memory Hierarchy
The memory unit that communicates directly with the CPU is called main
memory.
Devices that provide backup storage are called auxiliary memory.
(magnetic disks and tapes).
Auxiliary memory are slow but with high capacity.
Programs and data currently needed by the processor reside in main
memory.
Cache memory is small in size and a special very-high speed memory.
Cache stores programs and data frequently needed by the CPU in present
calculation.
Programs are brought from auxiliary memory to the main memory for the
CPU.
Main Memory
Main memory consists of a collection of storage locations, each with a
unique identifier, called an address.
Data is transferred to and from memory in groups of bits called words.
A word can be a group of 8 bits, 16 bits, 32 bits or 64 bits (and growing).
If the word is 8 bits, it is referred to as a byte.
Main Memory
The total number of uniquely identifiable locations in memory is called the
address space.
For example, a memory with 64 kilobytes and a word size of 1 byte has an
address space that ranges from 0 to 65,535.
Two types of main memory: RAM and ROM.
RAM is used for storing programs that are permanently resident in
computer.
RAM is volatile; its contents are destroyed when the power is turned off.
ROM stores bootstrap loader program.
Bootstrap loader is a program whose function is to start the computer
software operating when power is turned on.
Main Memory
Typical RAM Chip: Block Diagram & Function Table
Main Memory
Typical ROM Chip: Block Diagram
Main Memory
Memory Address Map
Memory Address Map is a pictorial representation of assigned address space
for each chip in the system.
To demonstrate an example, assume that a computer system needs 512
bytes of RAM and 512 bytes of ROM.
The RAM have 128 byte and need seven address lines, where the ROM have
512 bytes and need 9 address lines.
Address Bus
Main Memory
Memory Address Map
Line 8 and 9 represent four distinct binary combination to specify which RAM
we chose .
When line 10 is 0, CPU selects a RAM. And when it’s 1, it selects the ROM.
Main Memory

Memory Connection to CPU


Auxiliary Memory
Commonly used auxiliary devices in computers are magnetic disks and tapes.
Access time: The average time required to reach a storage location In
memory and obtain its contents is called the access time.
The Access time consists of :
Seek time: time required to position the read-write head to a location.
Transfer time: time required to transfer data to or from the device.
Auxiliary Memory
Magnetic Disks
Is a circular plate constructed of metal or plastic coated with magnetized
material.
Bits are stored in the magnetized surface in spots along concentric
circles called tracks.
Tracks are commonly divided into sections called sectors.
Auxiliary Memory
Magnetic Disks…
Single read/write head fro each disk surface or separate read/write
heads are provided for each track in each surface.
A disk system is addressed by address bits that specify the disk number,
the disk surface, the sector number and the track with in the sector.
Disks that re permanently attached to the unit assembly and cannot be
removed by the occasional user are called hard disk.
Auxiliary Memory
Magnetic Tapes
Is a strip of plastic coated with a magnetic recording medium.
Bits are recorded as magnetic spots on the tape along several tracks.
Information is recorded in blocks, and is referred as records.
Associative Memory
A memory unit accessed by its content is called an associative memory or
Content addressable memory (CAM).
During write operation, the memory is capable of finding an empty unused
location to store the word.
When the word is to be read from an associative memory, the content of the
word, or part of the word, is specified. The memory locates all words which
match the specified content and marks them for reading.
As the associative memory has storage capability as well as logic circuits for
matching its content, it is more expensive than the random access memory.
Associative Memory
Associative Memory
Hardware Organization
Associative memory consists of a memory array and logic for m-words with
n-bits per word.
The argument register (A) and Key register (K)
each have n-bits.
The match register M has m-bits, one for each
memory word.
Each word in memory is compared in parallel
with the content of the argument register.
The words that match the bits of the argument register set a corresponding
bit in the match register.
Reading is done as sequential access to memory for those words whose
corresponding bits in the match register have been set.
Associative Memory
Hardware Organization
The entire argument is compared with each memory word if the key register
contains all 1’s.
Otherwise, only those bits in the argument that have 1’s in their
corresponding position of the key register are compared.
Read Operation
The match register bits are scanned one at a time.
The matched words are read in sequence by applying a read signal to each

word line whose corresponding Mi bit is 1.


Write Operation
If the entire memory is loaded with new information at once prior to a
search operation then the writing can be done by addressing each location in
sequence.
Associative Memory
Write Operation……
If unwanted words have to be deleted and new words inserted one at a
time, there is a need for a special register called tag register.
For every active word in memory, the corresponding bit in the tag register is
set to 1. a word is deleted from memory by clearing its tag bit to 0.
Words are stored in memory by scanning the tag register until the first 0 bit
is encountered.
Cache Memory
A cache is a fast small memory.
If the active portions of the program and data are placed in cache memory,
the average memory access time can be reduced, thus reducing the total
execution time of the program.
Cache is the fastest component in the memory hierarchy.
The fundamental idea of cache organization is that by keeping the most
frequently accessed instructions and data in the fast cache memory.
When the CPU needs to access memory, the cache is examined. If the word
is found in the cache, it is read from the fast cache memory.
If the word addressed by cache is not found in the cache, the main memory
is accessed to read the word.
The accessed word is then transferred to cache memory from the main
memory.
Cache Memory
When the CPU finds a word in cache, it is said to produce a hit.
If the word is not found in cache, it is in main memory and it counts a miss.
The ratio of the number of hits divided by the total CPU references to
memory is said to be the hit ratio.
The transformation of data from main memory to cache memory is referred
to a mapping process.
Three types of mapping process
are considered:
Associative mapping.
Direct mapping.
Set-associative mapping.
Cache Memory
Associative Mapping
The associative memory stores both the
address and content of the memory word.

The address value of 15 bits is shown as a


five-digit octal number and its corresponding
12-bit word is shown as four-digit octal
number.
A CPU address of 15 bits is placed in the
argument register and the associative memory
is searched for a matching address.
Cache Memory
Associative Mapping…
If the address is found, the corresponding
12-bit data is read and sent to the CPU.
If no match occurs, the main memory is
accessed for the word. The address-data pair
is then transferred to the associative cache
memory.
Replacement algorithms such as round-
robin (FIFO) algorithm is used to make room
for new words while the cache is full.
Associative memories are expensive
compared to random-access memories.
Cache Memory
Direct Mapping…
The CPU address of 15-bits is divided into 2
fields.
Index field – 9 least significant bits
Tag field – remaining 6 bits
The number of bits in the index field is equal
to the number of address bits required to
access the cache memory.
The direct mapping cache organization uses
the n-bit address to access the main memory
and the k-bit index to access the cache.
Cache Memory
Direct Mapping…
6 bits 9 bits

Tag Index

00 000 000
32K X 12 512 X 12

Octal Main Memory Cache Memory


Octal
Address Address
Address = 15 bits Address = 9 bits

Data = 12 bits Data = 12 bits


77 777 777

Fig: Addressing relationships between main and cache memories


Cache Memory
Direct Mapping…

Memory Memory Data


Index Tag Data
Address
Address
00000 1220 000 00 1220

777 02 6710
00777 2340
01000 3450 (b) Cache Memory

01777 4560
02000 5670

02777 6710

(a) Main Memory

Fig: Direct Mapping cache organization


Cache Memory
Direct Mapping…
When a new word is first brought into the
cache, the tag bits are stored alongside the
data bits.
On memory request, the index field is used
for the address to access the cache.
The tag field of the CPU address is compared
with the tag in the word read from the cache.
If the two tags match, there is a hit and the
desired data word is in cache. If there is no
match, there is a miss and the required word
is read from main memory.
Cache Memory
Direct Mapping…
The disadvantage of direct mapping is that
the hit ratio can drop considerably if two or
more words whose addresses have the same
index but different tags are accessed
repeatedly.
Cache Memory
Set-associative Mapping…

Index Tag Data Tag Data


000 01 3450 02 5670

777 02 6710 00 2340

You might also like