Académique Documents
Professionnel Documents
Culture Documents
EE 560 Lecture 4
MIPS Instruction Set and MMU Samuel H. Russ
EE 560 Lecture 4 - Russ 1
BLAH:
BLAH:
Most of the time the branch is taken and the delay-slot instruction is executed normally. Sometimes the branch is not taken, but the flush is no worse than the original NOP. Usually better and never worse that works!
EE 560 Lecture 4 - Russ 3 EE 560 Lecture 4 - Russ 4
2/18/2009
TLB Implementation
Different processors have different mixes of software and hardware to do virtual-tophysical translations In the MIPS, the processor has small number of TLB entries cached on-chip
Called the Micro-TLB
The rest of the TLB can reside in memory More details to follow on the MIPS TLB
EE 560 Lecture 4 - Russ 7
The kernel can select whether items are mapped in virtual memory and/or cached by mapping the address of the item
Common example: Map I/O devices (which need to be uncached) to the uncached area of the address space
EE 560 Lecture 4 - Russ 8
2/18/2009
Bit 31 0 1 1 1 1
ASID permits different tasks with the same virtual addresses to have separate TLB entries Kernel accesses can be global if desired
The ASID is ignored
EE 560 Lecture 4 - Russ 10
R6000:
16k page size, so the low 14 bits are the page offset and the most significant 18 are the VPN ASID is 8 bits
11 EE 560 Lecture 4 - Russ 12
2/18/2009
A quick picture
Programs ASID Programs Virtual Address
Micro-TLB Micro-
Physical Address
EE 560 Lecture 4 - Russ 13
Noncacheable Flag: Page is marked noncacheable Dirty Flag: Dirty actually means the page is writable (able to be dirty) Valid Flag: Indicates if the entry is valid Global Flag: If set, ignore the ASID
EE 560 Lecture 4 - Russ 14
R6000:
Micro-TLB is not on chip 3-bit CCA field cache-coherency algorithm
EE 560 Lecture 4 - Russ 15
Larger virtual memory page size shrinks the size of the page number fields C field (3 bits): Specifies if page is cacheable and, if so, which policy to use Dirty Flag: Dirty actually means the page is writable (able to be dirty) Valid Flag: Indicates if the entry is valid (that is, actually resident in RAM) Global Flag: If set, ignore the ASID
EE 560 Lecture 4 - Russ 16
2/18/2009
More details
A small number of Micro-TLB entries cannot be evicted
R2000/3000: 8 entries R4000: Controlled by a register
Wired register marks the entry number of the first entry that is allowed to be evicted Example: Wired=8 means that TLB entries 8 to 47 are allowed to be evicted
19
2/18/2009
O/S level
The O/S must have a much larger translation structure
The MIPS micro-TLBs only hold 64 pages of mapping
Two questions
What if there is not a micro-TLB entry for the page what does the O/S do? How does (or how can) the micro-TLB interact with cache?
EE 560 Lecture 4 - Russ 21
22
Add a piece of the virtual address to a base Use the sum to perform a table lookup for the next base address Repeat the process a few times
EE 560 Lecture 4 - Russ 23 EE 560 Lecture 4 - Russ 24
2/18/2009
Hashing function can cause more virtual addresses to map to the same location than the capacity of the table
Virtual page number is hashed and used to calculate an offset into a table
A hash is a non-linear function to convert one number into a different, nearly random, but repeatable, number
In example above, may have more than 4 virtual addresses map to that row Need a way to handle table overflow
25 EE 560 Lecture 4 - Russ 26
Table contains a small number of entries that must be searched for a hit
EE 560 Lecture 4 - Russ
PowerPC and IA-32 also call out an upperlevel hardware system to do the mapping
Hardware TLB miss handler
27
28
2/18/2009
Offset is always sent to cache directly (TLB does not alter the offset) D-cache contains the physical page number as well as the data TLB lookup is in parallel with cache lookup Then check to see if you had a hit Parallel cache and TLB access can be a big advantage Some MIPS family members do this
EE 560 Lecture 4 - Russ 29