URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 1173 to Rev 1174
- ↔ Reverse comparison
Rev 1173 → Rev 1174
/trunk/or1ksim/cpu/or32/execute.c
494,7 → 494,11
if (config.cpu.superscalar) |
PRINTF ("\n"); |
|
dumpmemory(pc, pc + 4, 1, 0); |
if (peek_into_itlb(pc)) |
dumpmemory(pc, pc + 4, 1, 0); |
else |
PRINTF("ITLB miss follows ;)\n"); |
|
PRINTF(" (next insn) %s", (delay_insn?"(delay insn)":"")); |
for(i = 0; i < MAX_GPRS; i++) { |
if (i % 4 == 0) |
/trunk/or1ksim/mmu/immu.c
106,6 → 106,66
} |
} |
|
/* DESC: try to find EA -> PA transaltion without changing |
* any of precessor states. if this is not passible gives up |
* (without triggering exceptions) |
* |
* PRMS: virtaddr - EA for which to find translation |
* |
* RTRN: 0 - no IMMU, IMMU disabled or ITLB miss |
* else - appropriate PA (note it IMMU is not present |
* PA === EA) |
*/ |
unsigned long peek_into_itlb(unsigned long virtaddr) |
{ |
int set, way = -1; |
int i; |
unsigned long tagaddr; |
unsigned long vpn, ppn; |
|
if (!(mfspr(SPR_SR) & SPR_SR_IME) || !(testsprbits(SPR_UPR, SPR_UPR_IMP))) { |
return(virtaddr); |
} |
|
/* Which set to check out? */ |
set = (virtaddr / config.immu.pagesize) % config.immu.nsets; |
tagaddr = (virtaddr / config.immu.pagesize) / config.immu.nsets; |
vpn = virtaddr / (config.immu.pagesize * config.immu.nsets); |
|
/* Scan all ways and try to find a matching way. */ |
for (i = 0; i < config.immu.nways; i++) |
if (((mfspr(SPR_ITLBMR_BASE(i) + set) / (config.immu.pagesize * config.immu.nsets)) == vpn) && |
testsprbits(SPR_ITLBMR_BASE(i) + set, SPR_ITLBMR_V)) |
way = i; |
|
/* Did we find our tlb entry? */ |
if (way >= 0) { /* Yes, we did. */ |
|
/* Test for page fault */ |
if (mfspr (SPR_SR) & SPR_SR_SM) { |
if (!(mfspr (SPR_ITLBTR_BASE(way) + set) & SPR_ITLBTR_SXE)) { |
/* no luck, giving up */ |
return(0); |
} |
} else { |
if (!(mfspr (SPR_ITLBTR_BASE(way) + set) & SPR_ITLBTR_UXE)) { |
/* no luck, giving up */ |
return(0); |
} |
} |
|
ppn = mfspr(SPR_ITLBTR_BASE(way) + set) / config.immu.pagesize; |
return (ppn * config.immu.pagesize) + (virtaddr % config.immu.pagesize); |
} |
else { |
return(0); |
} |
|
PRINTF("ERR, should never have happened\n"); |
return(0); |
} |
|
|
unsigned long immu_translate(unsigned long virtaddr) |
{ |
unsigned long phyaddr = immu_simulate_tlb(virtaddr); |