0% found this document useful (0 votes)
21 views

COA Module5

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

COA Module5

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

YCS4001: Computer

Organization & Architecture


Module 5: Memory Unit
Design

Soumya Majumdar
What is memory unit?
● Memories are made up of registers.
● Each register in the memory is one storage location.
● Storage location is also called a memory location.
● Memory locations are identified using Address. The total number of bits a memory can
store is its capacity.
● A storage element is called a Cell.
● Each register is made up of a storage element in which one bit of data is stored. The data
in a memory are stored and retrieved by the process called writing and reading
respectively.
● A word is a group of bits where a memory unit stores binary information. A word with a
group of 8 bits is called a byte.
What is memory unit?
● A memory unit consists of data lines, address selection lines, and control lines that specify the
direction of transfer.
● Bit (Binary Units): bit is a logical representation of the electric state. It can be 1 or 0.
● Nibble: it means the group of 4 bits.
● Byte: a byte is a group of 8 bits.
● Word: it is a fixed number of bits, it is different from computer to computer, but the same for
each device. Compute store information in the form of words.
RAM: Random Access Memory
● It is also called read-write memory or the main memory or the primary memory.
● Used to temporarily store data that the computer is currently using or processing
● Programs and data that the CPU requires during the execution of a program are stored in this
memory.
● Typically used to store the operating system, application programs, and data that the computer is
currently using.
● It is a volatile memory as the data is lost when the power is turned off.
RAM classification: SRAM and DRAM

● Static RAM: SRAM stands for Static Read Only Memory.


● It is a type of semiconductor which is widely used in computing devices and
microprocessors

● .Dynamic RAM: DRAM stands for Dynamic Read Only Memory.


● It is made of Capacitors and has smaller data lifespan than Static RAM.
Differences between SRAM and DRAM
DRAM SRAM

Constructed of tiny capacitor that leaks Constructed of circuits similar to D flip-flop


electricity

Requires recharge in every few miliseconds to Holds its content as long as power is available
maintain its data

Inexpensive Expensive

Slower than SRAM Faster than DRAM

Can store many bits per chip Can’t store many bits per chip

Use less power Use more power

Generates less heat Generates more heat

Used for main memory Used for cache


RAM advantages
● Speed: RAM is much faster than other types of storage, such as a hard drive or solid-state
drive, which means that the computer can access the data stored in RAM more quickly.
● Flexibility: RAM is volatile memory, which means that the data stored in it can be easily
modified or deleted. This makes it ideal for storing data that the computer is currently using
or processing.
● Capacity: The capacity of RAM can be easily upgraded, which allows the computer to store
more data in memory and thus improve performance.
● Power Management: RAM consumes less power compared to hard drives, and solid-state
drives, which makes it an ideal memory for portable devices.
RAM disadvantages
● Volatility: RAM is volatile memory, which means that the data stored in it is lost when the
power is turned off. This can be a problem for important data that needs to be preserved,
such as unsaved work or files that have not been backed up.
● Capacity: The capacity of RAM is limited, and although it can be upgraded, it may still not
be sufficient for certain applications or tasks that require a lot of memory.
● Cost: RAM can be relatively expensive compared to other types of memory, such as hard
drives or solid-state drives, which can make upgrading the memory of a computer or device
more costly.
ROM: Read Only Memory
● Used to permanently store data that does not need to be modified.
● Non-volatile memory, which means that the data stored in it is retained even when the power is
turned off.
● Typically used to store the computer’s BIOS (basic input/output system), which contains the
instructions for booting the computer, as well as firmware for other hardware devices.
ROM classifications
● PROM (Programmable read-only memory): It can be programmed by the user. Once
programmed, the data and instructions in it cannot be changed.

● EPROM (Erasable Programmable read-only memory): It can be reprogrammed. To erase


data from it, expose it to ultraviolet light. To reprogram it, erase all the previous data.

● EEPROM (Electrically erasable programmable read-only memory): The data can be erased
by applying an electric field, with no need for ultraviolet light. We can erase only portions of the
chip.

● MROM(Mask ROM): Mask ROM is a kind of read-only memory, that is masked off at the
time of production. Like other types of ROM, mask ROM cannot enable the user to change the
data stored in it. If it can, the process would be difficult or slow.
ROM advantages
● Non-volatility: ROM is non-volatile memory, which means that the data stored in it is retained
even when the power is turned off. This makes it ideal for storing data that does not need to be
modified, such as the BIOS or firmware for other hardware devices.
● Reliability: Because the data stored in ROM is not easily modified, it is less prone to corruption
or errors than other types of memory.
● Power Management: ROM consumes less power compared to other types of memory, which
makes it an ideal memory for portable devices.
ROM disadvantages
● Limited Flexibility: ROM is read-only memory, which means that the data stored in it cannot
be modified. This can be a problem for applications or firmware that need to be updated or
modified.
● Limited Capacity: The capacity of ROM is typically limited, and upgrading it can be difficult
or expensive.
● Cost: ROM can be relatively expensive compared to other types of memory, such as hard drives
or solid-state drives, which can make upgrading the memory of a computer or device more
costly.
Differences between RAM and ROM

RAM ROM

Temporary storage Permanent Storage

Stored in MBs Stored in GBs

Volatile Non-volatile

Used in normal operation Used in startup process of computer

Writing data is faster Writing data is slower


Memory Hierarchy
Cache Memory
● Cache memory is an extremely fast memory type that acts as a buffer between RAM and the
CPU.
● Cache Memory holds frequently requested data and instructions so that they are immediately
available to the CPU when needed.
● Cache memory is costlier than main memory or disk memory but more economical than CPU
registers.
● Cache Memory is used to speed up and synchronize with a high-speed CPU.
Cache Memory
Levels of Memory
● Level 1 or Register: It is a type of memory in which data is stored and accepted that are
immediately stored in the CPU. The most commonly used register is Accumulator, Program
counter, Address Register, etc.
● Level 2 or Cache memory: It is the fastest memory that has faster access time where data is
temporarily stored for faster access.
● Level 3 or Main Memory: It is the memory on which the computer works currently. It is small
in size and once power is off data no longer stays in this memory.
● Level 4 or Secondary Memory: It is external memory that is not as fast as the main memory
but data stays permanently in this memory.
Cache Performance
● When the processor needs to read or write a location in the main memory, it first checks for a
corresponding entry in the cache.
● If the processor finds that the memory location is in the cache, a Cache Hit has occurred and data
is read from the cache.
● If the processor does not find the memory location in the cache, a cache miss has occurred. For a
cache miss, the cache allocates a new entry and copies in data from the main memory, then the
request is fulfilled from the contents of the cache.
● The performance of cache memory is frequently measured in terms of a quantity called Hit ratio.
● Hit Ratio(H) = hit / (hit + miss) = no. of hits/total accesses
● Miss Ratio = miss / (hit + miss) = no. of miss/total accesses = 1 - hit ratio(H)
● We can improve Cache performance using higher cache block size, and higher associativity,
reduce miss rate, reduce miss penalty, and reduce the time to hit in the cache.
Cache Mapping
● Direct Mapping
● Associative Mapping
● Set-Associative Mapping
Direct Mapping
● Maps each block of main memory into only one possible cache line.
● Assign each memory block to a specific line in the cache. If a line is previously taken up by a
memory block when a new block needs to be loaded, the old block is trashed.
● Address space is split into two parts index field and a tag field.
● Cache is used to store the tag field whereas the rest is stored in the main memory. Direct
mapping`s performance is directly proportional to the Hit ratio.
Direct Mapping

Direct Mapping
i = j modulo m

where

i = cache line number

j = main memory block number

m = number of lines in the cache


Direct Mapping
Associative Mapping
● Associative memory is used to store the content and addresses of the
memory word.
● Any block can go into any line of the cache. This means that the word id
bits are used to identify which word in the block is needed, but the tag
becomes all of the remaining bits. This enables the placement of any word
at any place in the cache memory.
● It is considered to be the fastest and most flexible mapping form.
● In associative mapping, the index bits are zero.
Associative Mapping
Set-associative Mapping
● This form of mapping is an enhanced form of direct mapping where the drawbacks of direct
mapping are removed.
● Set associative addresses the problem of possible thrashing in the direct mapping method. It
does this by saying that instead of having exactly one line that a block can map to in the cache,
we will group a few lines together creating a set. Then a block in memory can map to any one
of the lines of a specific set.
● Set-associative mapping allows each word that is present in the cache can have two or more
words in the main memory for the same index address.
● Set associative cache mapping combines the best of direct and associative cache mapping
techniques.
● In set associative mapping the index bits are given by the set offset bits.
● In this case, the cache consists of a number of sets, each of which consists of a number of lines.
Set-associative Mapping
Set-associative Mapping
m=v*k
i= j mod v

where
i = cache set number
j = main memory block number
v = number of sets
m = number of lines in the cache number of sets
k = number of lines in each set
Set-associative Mapping

You might also like