Documente Academic
Documente Profesional
Documente Cultură
TECH
Computer Science
CH04
Characteristics Location
• Location • CPU
• Capacity • Internal
• Unit of transfer • External
• Access method
• Performance
• Physical type
• Physical characteristics
• Organisation
1
Access Methods (1) Access Methods (2)
• Sequential • Random
4Start at the beginning and read through in order 4 Individual addresses identify locations exactly
4Access time depends on location of data and previous 4 Access time is independent of location or previous access
location 4 e.g. RAM
4e.g. tape • Associative
• Direct 4 Data is located by a comparison with contents of a portion of the
store
4Individual blocks have unique address 4 Access time is independent of location or previous access
4Access is by jumping to vicinity plus sequential search 4 e.g. cache
4Access time depends on location and previous location
4e.g. disk
2
Organisation The Bottom Line
• Physical arrangement of bits into words • How much?
• Not always obvious 4Capacity
• e.g. interleaved • How fast?
4Time is money
• How expensive?
3
Static RAM Read Only Memory (ROM)
• Bits stored as on/off switches • Permanent storage
• No charges to leak • Microprogramming (see later)
• No refreshing needed when powered • Library subroutines
• More complex construction • Systems programs (BIOS)
• Larger per bit • Function tables
• More expensive
• Does not need refresh circuits
• Faster
• Cache
4
Packaging Module (256KB)
Organisation
5
Cache operation - overview Cache Design
• CPU requests contents of memory location • Size
• Check cache for this data • Mapping Function
• If present, get from cache (fast) • Replacement Algorithm
• If not present, read required block from main memory • Write Policy
to cache • Block Size
• Then deliver from cache to CPU • Number of Caches
• Cache includes tags to identify which block of main
memory is in each cache slot
6
Mapping Function Direct Mapping
• Cache of 64kByte • Each block of main memory maps to only one cache
• Cache block of 4 bytes line
4i.e. cache is 16k (214) lines of 4 bytes 4i.e. if a block is in cache, it must be in one specific place
• 16MBytes main memory • Address is in two parts
• 24 bit address • Least Significant w bits identify unique word
4(224=16M) • Most Significant s bits specify one memory block
• The MSBs are split into a cache line field r and a tag
of s-r (most significant)
Direct Mapping
Address Structure Direct Mapping Cache Organization
• 24 bit address
• 2 bit word identifier (4 byte block)
• 22 bit block identifier
4 8 bit tag (=22-14)
4 14 bit slot or line
• No two blocks in the same line have the same Tag field
• Check contents of cache by finding line and checking Tag
7
Associative Mapping Example
Fully Associative Cache Organization
Associative Mapping
Address Structure Set Associative Mapping
• Cache is divided into a number of sets
• Each set contains a number of lines
Word
Tag 22 bit 2 bit • A given block maps to any line in a given set
• 22 bit tag stored with each 32 bit block of data 4e.g. Block B can be in any line of set i
• Compare tag field with tag entry in cache to check • e.g. 2 lines per set
for hit 42 way associative mapping
4A given block can be in one of 2 lines in only one set
• Least significant 2 bits of address identify which byte
(8bit) is required from 32 bit data block
• e.g. (based 16 number (4bit))
4Address Tag Data Cache line
4FFFC FFFC 24682468 3FFF
Two Way Set Associative Mapping Example Set Associative Cache Organization
8
Set Associative Mapping Replacement Algorithms (1)
Address Structure Direct mapping
• No choice
• Each block only maps to one line
Word • Replace that line
Tag 9 bit Set 13 bit 2 bit
• Use set field to determine cache set to look in
• Compare tag field to see if we have a hit
• e.g
4Address Tag Data Set number
41FF 7FFC 1FF 12345678 1FFF
4001 7FFC 001 11223344 1FFF
9
Newer RAM Technology
• Synchronous DRAM (SDRAM)
4 currently on DIMMs
4Access is synchronized with an external clock
4Address is presented to RAM
4RAM finds data (CPU waits in conventional DRAM)
4Since SDRAM moves data in time with system clock,
CPU knows when data will be ready
4CPU does not have to wait, it can do something else
4Burst mode allows SDRAM to set up stream of data and
fire it out in block
10