CO Module3
CO Module3
CO Module3
The maximum size of the Main Memory (MM) that can be used in any computer is determined
by its addressing scheme. For example, a 16-bit computer that generates 16-bit addresses is capable of
addressing upto 216 =64K memory locations. If a machine generates 32-bit addresses, it can access upto
232 = 4G memory locations. This number represents the size of address space of the computer.
If the smallest addressable unit of information is a memory word, the machine is called
word-addressable. If individual memory bytes are assigned distinct addresses, the computer is called
byte-addressable. Most of the commercial machines are byte-addressable. For example in a byte-
addressable 32-bit computer, each memory word contains 4 bytes. A possible word-address assignment
would be:
Word Address Byte Address
0 1 2 3
4 5 6 7
8 9 10 11
. …..
With the above structure a READ or WRITE may involve an entire memory word or it may involve
only a byte. In the case of byte read, other bytes can also be read but ignored by the CPU. However,
during a write cycle, the control circuitry of the MM must ensure that only the specified byte is altered.
In this case, the higher-order 30 bits can specify the word and the lower-order 2 bits can specify the
byte within the word.
Data transfer between CPU and MM takes place through the use of two CPU registers,
usually called MAR (Memory Address Register) and MDR (Memory Data Register). If MAR is K bits
long and MDR is „n‟ bits long, then the MM unit may contain upto 2k addressable locations and each
location will be „n‟ bits wide, while the word length is equal to „n‟ bits. During a “memory cycle”, n
bits of data may be transferred between the
MM and CPU. This transfer takes place over the processor bus, which has k address lines (address
bus), n data lines (data bus) and control lines like Read, Write, Memory Function completed (MFC),
Bytes specifiers etc (control bus). For a read operation, the CPU loads the address into MAR, set R/W
to 1 and sets other control signals if required. The data from the MM is loaded into MDR
and MFC is set to 1. For a write operation, MAR, MDR are suitably loaded by the CPU,R/W is set to
0 and other control signals are set suitably. The MM control circuitry loads the data into appropriate
locations and sets MFC to 1. This organization is shown in the following block schematic.
1
Memory Access Time: It is the time that elapses between
→ initiation of an operation &
→ completion of that operation.
Memory Cycle Time: It is the minimum time delay that required between the initiation of the two
successive memory operation.
RAM (Random Access Memory): In RAM, any location can be accessed for a Read/Write-
operation in fixed amount of time.
Cache Memory
Ø It is a small, fast memory that is inserted between
→ Larger slower main-memory and processor.
Ø It holds the currently active segments of a program and their data.
Virtual Memory
Ø The address generated by the processor is referred to as a virtual/logical address.
Ø The virtual-address-space is mapped onto the physical-memory where data are actually
stored.
Ø The mapping-function is implemented by MMU. (MMU = memory management unit).
Ø Only the active portion of the address-space is mapped into locations in the physical-
memory.
Ø The remaining virtual-addresses are mapped onto the bulk storage devices such as
magnetic disk.
Ø As the active portion of the virtual-address-space changes during program execution the
MMU.
MMU(memory management unit)
→ changes the mapping-function &
→ transfers the data between disk and memory.
Ø During every memory-cycle, MMU determines whether the addressed-page is in the
memory. If the page is in the memory. Then, the proper word is accessed and execution
proceeds. Otherwise, a page containing desired word is transferred from disk to memory.
• Memory can be classified as follows:
1) RAM which can be further classified as follows:
i) Static RAM ii) Dynamic RAM (DRAM) which can be further classified as
synchronous & asynchronous DRAM.
2) ROM which can be further classified as follows:
i) PROM ii) EPROM iii) EEPROM & iv) Flash Memory which can be
further classified as Flash Cards & Flash Drives.
2
5.2 SEMICONDUCTOR RAM MEMORIES
5.2.1 Internal Organization of Memory Chips
Memory cells are usually organized in the form of an array, in which each cell is capable of storing
on bit of information. Each row of cells constitutes a memory word, and all cells of a row are
connected to a common line referred to as the word line, which is driven by the address decoder on
the chip. The cells in each column are connected to a Sense/Write circuit by two bit lines. The
Sense/Write circuits are connected to the data I/O lines of the chip. During the read operation, these
circuits‟ sense, or read, the information stored in the cells selected by a word line and transmit this
information to the output data lines. During the write operation, the Sense/Write circuits receive the
input information and store in the cells of the selected word.
3
The memory circuit given above stores 128 and requires 14 external connections for address, data
and control lines. Of course, it also needs two lines for power supply and ground connections.
Consider now a slightly larger memory circuit, one that has a 1k (1024) memory cells. For a 1k×1
memory organization, the representation is given next. The required 10-bit address is divided into
two groups of 5 bits each to form the row and column addresses for the cell array. A row address
selects a row of 32 cells, all of which are accessed in parallel. However, according to the column
address, only one of these cells is connected to the external data line by the output multiplexer and
input demultiplexer.
Memories that consist of circuits capable of retaining their state as long as power is
applied are known as static memories.
4
Read Operation
• To read the state of the cell, the word-line is activated to close switches T1 and T2.
• If the cell is in state 1, the signal on bit-line b is high and the signal on the bit-line b’ is low.
• Thus, b and b‟ are complement of each other.
• Sense/Write circuit
→ monitors the state of b & b‟ and
→ sets the output accordingly.
Write Operation
• The state of the cell is set by
→ placing the appropriate value on bit-line b and its complement on b’ and
→ then activating the word-line. This forces the cell into the
corresponding state.
• The required signal on the bit-lines is generated by Sense/Write circuit.
• Advantages:
1) It has low power consumption „.‟ the current flows in the cell only when the cell is
active.
2) Static RAM‟s can be accessed quickly. It access time is few nanoseconds.
• Disadvantage: SRAMs are said to be volatile memories their contents are lost when power is
interrupted.
ASYNCHRONOUS DRAM
Information is stored in a dynamic memory cell in the form of a charge on a capacitor,
and this charge can be maintained for only tens of milliseconds. Since the cell is required to store
5
information for a much longer time, its contents must be periodically refreshed by restoring the
capacitor charge to its full value. An example of a dynamic memory cell that consists of a capacitor,
C, and a transistor, T, is shown below:
A sense amplifier connected to the bit line detects whether the charge stored on the capacitor is
above the threshold. If so, it drives the bit line to a full voltage that represents logic value 1. This
voltage recharges the capacitor to full charge that corresponds to logic value 1. If the sense amplifier
detects that the charge on the capacitor will have no charge, representing logic value 0.
ASYNCHRONOUS DRAM DESCRIPTION
• The 4 bit cells in each row are divided into 512 groups of 8 (Figure 5.7).
• 21 bit address is needed to access a byte in the memory. 21 bit is divided as follows:
1) 12 address bits are needed to select a row.
i.e. A8-0 → specifies row-address of a byte.
2) 9 bits are needed to specify a group of 8 bits in the selected row.
i.e. A20-9 → specifies column-address of a byte.
• During Read/Write-operation,
→ row-address is applied first.
→ row-address is loaded into row-latch in response to a signal pulse on RAS’ input of chip.
(RAS = Row-address Strobe CAS = Column-address Strobe)
• When a Read-operation is initiated, all cells on the selected row are read and refreshed.
• Shortly after the row-address is loaded, the column-address is
→ applied to the address pins & → loaded into CAS’.
• The appropriate group of 8 Sense/Write circuits is selected.
R/W’=1(read-operation) Output values of selected circuits are transferred to data-lines D0-D7.
R/W’=0(write-operation) Information on D0-D7 are transferred to the selected circuits.
• RAS‟ & CAS‟ are active-low so that they cause latching of address when they change from high
to low.
• To ensure that the contents of DRAMs are maintained, each row of cells is accessed periodically.
• A special memory-circuit provides the necessary control signals RAS‟ & CAS‟ that govern the
timing.
• The processor must take into account the delay in the response of the memory.
Fast Page Mode
Ø Transferring the bytes in sequential order is achieved by applying the consecutive
sequence of column-address under the control of successive CAS‟ signals.
Ø This scheme allows transferring a block of data at a faster rate.
Ø The block of transfer capability is called as fast page mode.
6
5.2.4 Synchronous DRAMs
In these DRAMs, operation is directly synchronized with a clock signal. The below given
figure indicates the structure of an SDRAM.
7
Ø The burst operations use the block transfer capability described before as fast page mode
feature.
Ø In SDRAMs, it is not necessary to provide externally generated pulses on the CAS line to
select successive columns. The necessary control signals are provided internally using a
column counter and the clock signal. New data can be placed on the data lines in each clock
cycles. All actions are triggered by the rising edge of the clock.
The above figure shows the timing diagram for a burst read of length 4.
Ø First, the row address is latched under control of the RAS signal.
Ø Then, the column address latched under control of the CAS signal.
Ø After a delay of one clock cycle, the first set of data bits is placed on the data lines.
Ø The SDRAM automatically increments the column address to access next three sets of the
bits in the selected row, which are placed on the data lines in the next clock cycles.
¡ Memory bandwidth is the number of bits or bytes that can be transferred in one second.
To assist the processor in accessing data at high enough rate, the cell array is organized in two
banks. Each bank can be accessed separately. Consecutive words of a given block are stored in
different banks. Such interleaving of words allows simultaneous access to two words that are
transferred on the successive edges of the clock. This type of SDRAM is called Double Data Rate
SDRAM (DDR- SDRAM).
5.2.5 Structure of larger memories
8
Ø Implementing a memory unit of 2M words of 32 bits each.
Ø Using 512x8 static memory chips. Each column consists of 4 chips. Each chip implements
one byte position.
Ø A chip is selected by setting its chip select control line to 1. Selected chip places its data on
the data output line, outputs of other chips are in high impedance state.
Ø 21 bits to address a 32-bit word. High order 2 bits are needed to select the row, by activating
the four Chip Select signals.
Ø 19 bits are used to access specific byte locations inside the selected chip.
9
5.2.6 Memory System Considerations
• To reduce the number of pins, the dynamic memory-chips use multiplexed-address inputs.
• The address is divided into 2 parts:
1) High Order Address Bit
Select a row in cell array.
It is provided first and latched into memory-chips under the control of RAS signal.
2) Low Order Address Bit
Selects a column.
They are provided on same address pins and latched using CAS signals.
• The Multiplexing of address bit is usually done by Memory Controller Circuit (Figure 5.11).
• The Controller accepts a complete address & R/W‟ signal from the processor.
• A Request signal indicates a memory access operation is needed.
• Then, the Controller
→ forwards the row & column portions of the address to the memory.
→ generates RAS & CAS signals &
→ sends R/W & CS signals to the memory.
10
• There are 3 types of packets:
1) Request 2) Acknowledge & 3) Data.
• Both SRAM and DRAM chips are volatile, i.e. They lose the stored information if power is
turned off. • Many application requires non-volatile memory which retains the stored
information if power is turned off.
• For ex:
OS software has to be loaded from disk to memory i.e. it requires non-volatile memory.
• Non-volatile memory is used in embedded system.
• Since the normal operation involves only reading of stored data, a memory of this type is called
ROM.
5.3.1 ROM
At Logic value ‘0’
Transistor(T) is connected to the ground point (P).
Transistor switch is closed & voltage on bit-line nearly drops to zero (Figure 5.12).
At Logic value ‘1’
Transistor switch is open. The bit-line remains at high voltage.
TYPES OF ROM
• Different types of non-volatile memory are
1) PROM
2) EPROM
3) EEPROM &
4) Flash Memory (Flash Cards & Flash Drives)
11
• Advantages:
1) It provides flexibility.
2) It is faster.
3) It is less expensive because they can be programmed directly by the user.
• Advantages:
1) Flash drives have greater density which leads to higher capacity & low cost per
bit.
2) It requires single power supply voltage & consumes less power.
• There are 2 methods for implementing larger memory:
1) Flash Cards & 2) Flash Drives
1) Flash Cards
Ø One way of constructing larger module is to mount flash-chips on a small card.
Ø Such flash-card have standard interface.
Ø The card is simply plugged into a conveniently accessible slot.
Ø Memory-size of the card can be 8, 32 or 64MB.
Ø Eg: A minute of music can be stored in 1MB of memory. Hence 64MB flash cards can
store an hour of music.
2) Flash Drives
12
Ø Larger flash memory can be developed by replacing the hard disk-drive.
Ø The flash drives are designed to fully emulate the hard disk.
Ø The flash drives are solid state electronic devices that have no movable parts.
Advantages:
1) They have shorter seek & access time which results in faster response.
2) They have low power consumption, they are attractive for battery driven
application.
3) They are insensitive to vibration.
Disadvantages:
1) The capacity of flash drive (<1GB) is less than hard disk (>1GB).
2) It leads to higher cost per bit.
3) Flash memory will weaken after it has been written a number of times (typically
at least 1 million times).
13
Fastest access is to the data held in processor registers. Registers are at the top of the memory
hierarchy. Relatively small amount of memory that can be implemented on the processor chip.
This is processor cache. Two levels of cache. Level 1 (L1) cache is on the processor chip. Level 2
(L2) cache is in between main memory and processor. Next level is main memory, implemented
as SIMMs. Much larger, but much slower than cache memory. Next level is magnetic disks. Huge
amount of inexpensive storage. Speed of memory access is critical, the idea is to bring instructions
and data that will be used in the near future as close to the processor as possible.
14
• The cache-line is used to refer to the cache-block
Write-Through Protocol
Ø Here the cache-location and the main-memory-locations are updated
simultaneously.
Write-Back Protocol
Ø This technique is to
→ update only the cache-location &
→ mark the cache-location with associated flag bit called Dirty/Modified
Bit.
Ø The word in memory will be updated later, when the marked-block is
removed from cache.
During Read-operation
• If the requested-word currently not exists in the cache, then read-miss will occur.
• To overcome the read miss, Load–through/Early restart protocol is used.
Load–Through Protocol
Ø The block of words that contains the requested-word is copied from the memory
into cache.
Ø After entire block is loaded into cache, the requested-word is forwarded to
processor.
During Write-operation
• If the requested-word not exists in the cache, then write-miss will occur.
1) If Write Through Protocol is used, the information is written directly into main-
memory.
2) If Write Back Protocol is used,
→ then block containing the addressed word is first brought into the cache &
→ then the desired word in the cache is over-written with the new information.
5.5.1 MAPPING-FUNCTION
• Here we discuss about 3 different mapping-function:
15
1) Direct Mapping
2) Associative Mapping
3) Set-Associative Mapping
DIRECT MAPPING
• The block-j of the main-memory maps onto block-j modulo-128 of the cache (Figure 5.16).
• When the memory-blocks 0, 128, & 256 are loaded into cache, the block is stored in cache-
block 0. Similarly, memory-blocks 1, 129, 257 are stored in cache-block 1.
• The contention may arise when
1) When the cache is full.
2) When more than one memory-block is mapped onto a given cache-block position.
• The contention is resolved by allowing the new blocks to overwrite the currently resident-block.
• Memory-address determines placement of block in the cache.
ASSOCIATIVE MAPPING
• The memory-block can be placed into any cache-block position. (Figure 5.17).
16
• 12 tag-bits will identify a memory-block when it is resolved in the cache.
• Tag-bits of an address received from processor are compared to the tag-bits of each block of
cache.
• This comparison is done to see if the desired block is present.
17
• The mapping allows a block of the main-memory to reside in any block of the specified set.
• The cache has 2 blocks per set, so the memory-blocks 0, 64, 128…….. 4032 maps into cache set
„0‟.
• The cache can occupy either of the two block position within the set.
6 bit set field
Determines which set of cache contains the desired block.
6 bit tag field
The tag field of the address is compared to the tags of the two blocks of the set.
This comparison is done to check if the desired block is present.
18
If the cache is full and if new blocks are brought into the cache, then the cache-
controller must decide which of the old blocks has to be replaced.
• When a block is to be overwritten, the block with longest time w/o being referenced is over-
written.
• This block is called Least recently Used (LRU) block & the technique is called LRU algorithm.
• The cache-controller tracks the references to all blocks with the help of block-counter.
• Advantage: Performance of LRU is improved by randomness in deciding which block is to be
over- written.
Eg:
Consider 4 blocks/set in set associative cache.
Ø 2 bit counter can be used for each block.
Ø When a ‘hit’ occurs, then block counter=0; The counter with values originally lower than
the referenced one are incremented by 1 & all others remain unchanged.
When a ‘miss’ occurs & if the set is full, the blocks with the counter value 3 is removed,
the new block is put in its place & its counter is set to “0‟ and other block counters are
incremented by 1.
5.6.1 INTERLEAVING
Divides the memory system into a number of memory modules. Each module has its own
address buffer register (ABR) and data buffer register (DBR). Arranges addressing so that
successive words in the address space are placed in different modules. When requests for memory
access involve consecutive addresses, the access will be to different modules.
Since parallel access to these modules is possible, the average rate of fetching words from the Main
Memory can be increased
1)
19
(a)Consecutive words in a module
Consecutive words are placed in a module. High-order k bits of a memory address determine the
module. Low-order m bits of a memory address determine the word within a module. When a block
of words is transferred from main memory to cache, only one module is busy at a time.
2)
20
• High hit rates well over 0.9 are essential for high-performance computers.
• Performance is adversely affected by the actions that need to be taken when a miss occurs.
• A performance penalty is incurred because of the extra time needed to bring a block of data from
a slower unit to a faster unit.
• During that period, the processor is stalled waiting for instructions or data.
• We refer to the total access time seen by the processor when a miss occurs as the miss penalty.
• Let h be the hit rate, M the miss penalty, and C the time to access information in the cache. Thus,
the average access time experienced by the processor is
tavg = hC + (1 − h)M
5.6.3 Caches on the processor chips
h1- hitrate of Cache 1, h2- hit rate of Cache 2, M – miss penalty, c1- time to access info from
cache1, c2- time to access info from cache2.
21
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
MODULE 3
Memory System
Questions Year
1 Define: Memory Latency and Memory bandwidth. (2marks) June17
2 Explain synchronous DRAMS with block diagram. Jan19(17s)
3 With a diagram, explain the internal organisation of 2M X 8 asynchronous DRAMchip. June18, Jan17
June 17
4 With diagram, describe the internal organisation of a 128 X 8 memory chip. June19
5 With a neat diagram, explain the design of 2M X 32 memory module using 1M X 8memory Jan19
chips.
6 Draw and explain the working of 16 Mega Bit DRAM chip configured as 2M X 8. Jan18
7 Describe organisation of a 2M X 32 memory using 512K X 8 memory chips. Jan18
8 With diagram of basic SRAM (Static RAM) and DRAM (Asynchronous DRAM) chip(cell), June19
explain the read and write operations on each of them.
9 Define ROM. Explain various types of ROMs. Jan19(17s)
10 Write a short note on Flash memories (4marks) June17
Jan17,19(17s)
11 Explain ‘Hit Rate and Miss Penalty’.
June17
12 Define cache memory, explain various types of it with neat block diagram. Jan19(17s)
13 Define the following with respect to cache memory: Jan18
■ Valid bit ■ Dirty data ■ Stale data ■ Flush the cache
14 Describe any 2 mapping functions in cache. (with diagram) June18, 19
Jan17
15 Explain Associative mapping technique and set associative mapping technique. June17
16 Explain in detail the working of set associative mapped cache with 2 blocks per setwith Jan18
relevant diagram.
In a given system
(i) hit rate (n) = 0.5
17 (ii) miss penalty (M) = 100 ns June19
(iii) Time to access cache memory (c) = 100 ns.
Calculate the average access time (tavg) experienced by the processor.
18 Calculate the average access time experienced by processor if miss penalty is 17clock Jan19 (4m)
cycles and Miss rate is 10% and cache access time is 1 clock cycle.
Consider a cache consisting of 256 blocks of 16 words each, for a total of 4096 words and
assume main memory is addressable by 16 bit address and it consists of 4K blocks. How
19 many bits are there in each of Tag, block/set and word fields for Jan19 (9m)
different mapping techniques?
A block-set associative cache consists of a total of 64 blocks divided into 4 blockssets. The
main memory contains 4096 blocks, each consisting of 128 words.
20 (i) How many bits are there in a main memory address? Jan18
(ii) How many bits are there in each of the TAG, SET and WORD fields?
21 Analyze the working mechanism of Asynchronous DRAMS. Sep18(5M)
22 What is Cache memory? Analyze the three mapping function of cache memory Sep18(10M)
23 Analyze how data are written into Read Only Memories(ROM). Discuss different types of Sep18(10M)
Read Only Memories
18CS34 - COMPUTER ORGANISATION | QUESTION BANK
24 What is memory interleaving? Explain. Jan18
25 Calculate the average access time experienced by a processor, if a cache hit rate is 0.88, Jan18
miss penalty is 0.015 millisecond and cache access time is 10 microsecound.
26 What is ‘Locality of Reference’? Explain Direct mapping and set-associative mapping Jan2020(17
techniques. Scheme)