URL
https://opencores.org/ocsvn/eco32/eco32/trunk
[/] [eco32/] [trunk/] [sim/] [mmu.c] - Diff between revs 78 and 166
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 78 |
Rev 166 |
Line 39... |
Line 39... |
}
|
}
|
return n;
|
return n;
|
}
|
}
|
|
|
|
|
static void assocDelay(void) {
|
|
int n, i;
|
|
|
|
/* simulate delay introduced by assoc when using mapped
|
|
addresses but not experienced with unmapped addresses */
|
|
n = -1;
|
|
for (i = 0; i < TLB_SIZE; i++) {
|
|
if (tlb[i].page == 0) {
|
|
n = i;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
static Word v2p(Word vAddr, Bool userMode, Bool writing) {
|
static Word v2p(Word vAddr, Bool userMode, Bool writing) {
|
Word pAddr;
|
Word pAddr;
|
Word page, offset;
|
Word page, offset;
|
int index;
|
int index;
|
|
|
Line 68... |
Line 54... |
mmuBadAddr = vAddr;
|
mmuBadAddr = vAddr;
|
throwException(EXC_PRV_ADDRESS);
|
throwException(EXC_PRV_ADDRESS);
|
}
|
}
|
if ((vAddr & 0xC0000000) == 0xC0000000) {
|
if ((vAddr & 0xC0000000) == 0xC0000000) {
|
/* unmapped address space */
|
/* unmapped address space */
|
assocDelay();
|
/* simulate delay introduced by assoc when using mapped
|
|
addresses but not experienced with unmapped addresses */
|
|
assoc(0);
|
pAddr = vAddr & ~0xC0000000;
|
pAddr = vAddr & ~0xC0000000;
|
} else {
|
} else {
|
/* mapped address space */
|
/* mapped address space */
|
page = vAddr & PAGE_MASK;
|
page = vAddr & PAGE_MASK;
|
offset = vAddr & OFFSET_MASK;
|
offset = vAddr & OFFSET_MASK;
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.