CS 252: Computer Organization and Architecture II: Lecture 5 - The Memory System
CS 252: Computer Organization and Architecture II: Lecture 5 - The Memory System
Memory Unit
• A memory unit stores binary information in groups of bits
called words.
• Most computer memories use words that are multiples of 8
bits.
• A block diagram of the memory unit is shown below:
Memory Unit
• The memory unit is specified by the number of
words it contains and the number of bits in each
word.
• The address lines select one particular word.
• Each word in memory is assigned an identification
number called an address.
• Addresses range from:
Timings
• The double lines used to represent the address and
data bus indicate the presence of multi-bit
information.
• These collapse to a single line when no valid
information is present on the bus.
• Note that control signals can be considered asserted
when they are 0 (active low) or when they are 1
(active high).
• Signals that are active low have a bar over their
specifiers or may have a # appended (such as the
RDY# signal or the Write signal (R/W#)
• r/w# indicates a read command when high but a write
command when low.
RDY Signal
• The access time for the memory can vary as a
function of the type of memory used.
• In the diagram below the data is available in clock
cycle T3. However, if the memory could not have
the data ready at that time, an integral number of
extra clock cycles (called wait states or wait
cycles) would have to be inserted to allow the
memory additional time to acquire the requested
data.
• Thus the RDY signal prevents the CPU from
attempting to use invalid data (i.e. the contents of
the MDR prior to the arrival of the actual requested
data).
Memory addressing
• A memory system is said to be byte-addressable if
the addresses that are used correspond to individual
byte locations.
• A word-addressable system, on the other hand,
interprets the addresses as indices that indicate which
multi-byte word is to be addressed:
• Assuming a 32-bit word size, the addresses for
adjacent words would differ by 1 on the word-
addressable system but would differ by 4 on the
byte-addressable system.
• To obtain a particular byte on a word-addressable
system it is necessary to read in the word containing
the desired byte. Most systems tend to be byte-
addressable.
Memory Addressing
Memory Maps 1
• A memory can be considered to be like a filing
cabinets with a number of folder
• Each folder can contain a single piece of data.
—Example a piece of data can be either code (part of a
program) or data (variables or constants used in the
program).
• Code and data are typically stored in the same
memory, each piece of which is stored in a unique
address or row of memory.
• Some sections of memory are dedicated to a
specific purpose which may place constraints
(restrictions) on how it is implemented.
Memory Maps 2
• For example,
—the BIOS from which the computer performs its initial
startup sequence is located at a specific address range in
non-volatile memory.
—Video memory may also be located at a specific address
range.
• Both hardware and software designers need to
have a method to describe the arrangement of
memory in a system.
• Since multiple memory devices and different types
of memory may be present in a single system,
—hardware designers need to be able to show what
addresses correspond to which memory devices.
Memory Maps 3
Memory Maps 4
Memory Maps 5
• The numbers along the left side of the memory map
represent the addresses corresponding to each
memory resource.
• The memory map should represent the full address
range of the processor
• This full address range is referred to as the
processor's memory space, and its size is
represented by the number of memory locations in
the full range,
• i.e., 2m where m equals the number of address lines
coming out of the processor.
• It is up to the designer whether the addresses go in
ascending or descending order on the memory map.
Memory Maps 6
• As an example,
let's calculate the memory space of the processor
represented by the memory map in Figure b above.
The top address for this memory map is
FFFFF16 = 1111 1111 1111 1111 11112.
• Since the processor accesses its highest address
by setting all of its address lines to 1, we know
that this particular processor has 20 address
lines.
• Therefore, its memory space is 220 = 1,048,57610
= 1 Meg.
• This means that all of the memory resources for
this processor must be able to fit into 1 Meg
without overlapping
Address decoding
• Take another example the memory range for Program A
in Figure b above.
• The lower address is 2000016 while the upper address is
27FFF16.
• If we convert these addresses to binary, we should see a
relationship.
2000016 = 0010 0000 0000 0000 00002
27FFF16 = 0010 0111 1111 1111 11112
• We can see that upper five bits of these two addresses
are identical while the remaining bits go from all zeros in
the low address to all ones in the high address.
• Converting the high and the low address of any one of
the address ranges in Figure b should reveal the same
phenomenon.
Address decoding
• Address decoding is a method for using an address to
enable a unique memory device while leaving all other
devices idle.
• All address decoding schemes have one thing in common:
the bits of the full address are divided into two groups,
—one group that is used to identify the memory device and
—one group that identifies the memory location within the
selected memory device.
• In order to determine how to divide the full address into
these two groups of bits, we need to know
—how large the memory device is and
—how large the memory space is.
• Once we know the size of the memory device, then we know
the number of bits that will be required from the full address
to point to a memory location within the memory device.
Address decoding
• The size of the memory space of a device is calculated by
raising 2 to a power equal to the number of address lines
going to that device.
• For example,
—a memory device with 28 address lines going into it has
228 = 256 Meg locations.
—This means that 28 address bits from the full address
must be used to identify a memory location within that
device.
• The division of the full address into two groups is done by
dividing the full address into a group of most significant
bits and least significant bits.
• The block diagram of an m-bit full address in Figure below
shows how this is done.
• Each bit of the full address is represented with an where n
is the bit position.
Address decoding
Example
• Example
A processor with a 256 Meg address space is
using the address 35E3C0316 to access a 16 Meg
memory device.
1. How many address lines are used to define when the
16 Meg memory space is enabled?
2. What is the bit pattern of these enable bits that
enables this particular 16 Meg memory device?
3. What is the address within the 16 Meg memory device
that this address is going to transfer data to or from?
4. What is the lowest address in the memory map of the
16 Meg memory device?
5. What is the highest address in the memory map of the
16 Meg memory device?
Example
• How many blocks of 8 words are there in a 1 Gig memory space?
Solution
—Eight words require three bits to uniquely identify their
position within a block.
—Therefore, the last three bits of the address represent the
word's offset into the block.
—Since a 1 Gig (230) address space uses 30 address lines,
there are 30 – 3 = 27 remaining bits in the address.
—These bits are used to identify the block.
—Below is a diagram of the logical organization of the
address.
Memory Characteristics
• Memory system can be characterized based on:
Location, Capacity, Access method, Performance,
Physical type, Physical characteristics and
Organisation
• Access method
—Sequential [Start at the beginning and read through in
order up to the end]
—Direct [Individual blocks have unique address, Access is
by jumping to vicinity plus sequential search]
—Random [Individual addresses identify locations exactly]
—Associative [Data is located by a comparison; content of
data requested with contents of a portion of the store]
Associative Memory
• Finding the data item in memory by:
—Reading contents of memory cells and
—Comparing the value stored with the value of the items to
be found
• An alternative way is to:
—Broadcast the value of the search item to all memory
cells simultaneously, and
—To have any memory cells that contains a matching value
respond appropriately.
• This type of memory system which allow
broadcasting is called associative memory or a
content addressable memory
Argument Register A
Match Register
Output
M1
BC BC BC BC
M2
Associative Memory
• An associative memory must also be capable of
finding an empty unused location into which a new
value can be stored
• There must also be some way of deleting unwanted
items that are no longer needed
• A special way to accomplish this is to use a tag
register, whose bits indicates whether the
corresponding memory word is active or inactive
• Tag register must have as many bits as there are
words in memory
• For every active word stored in memory, the
corresponding bit in the tag register is set to 1
Associative Memory
Key Register
• In many instances the associative memory is
searched for a match based only on a certain
fields within the word
• To facilitate such a search, the memory includes
a key register (K) that defines which bits in
the word should be matched against the
argument register A
—if bit j within the key register is a 1, then bit j within
each memory word will be compared with bit j of the
argument register
—If bit j of register K is 0, then no comparison is made
for bit j, i.e. bit j of A is considered to automatically
match the corresponding bit of each memory word
Argument Register A
Key Register K
Match Register
Output