OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [sim/] [mmu.c] - Diff between revs 203 and 285

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 203 Rev 285
Line 187... Line 187...
  return tlbEntryLo;
  return tlbEntryLo;
}
}
 
 
 
 
void mmuSetEntryLo(Word value) {
void mmuSetEntryLo(Word value) {
  tlbEntryLo = value & (PAGE_MASK | TLB_WRITE | TLB_VALID);
  tlbEntryLo = value & (FRAME_MASK | TLB_WRITE | TLB_VALID);
}
}
 
 
 
 
Word mmuGetBadAddr(void) {
Word mmuGetBadAddr(void) {
  return mmuBadAddr;
  return mmuBadAddr;
Line 229... Line 229...
  int index;
  int index;
 
 
  /* choose a random index, but don't touch fixed entries */
  /* choose a random index, but don't touch fixed entries */
  index = randomIndex;
  index = randomIndex;
  tlb[index].page = tlbEntryHi & PAGE_MASK;
  tlb[index].page = tlbEntryHi & PAGE_MASK;
  tlb[index].frame = tlbEntryLo & PAGE_MASK;
  tlb[index].frame = tlbEntryLo & FRAME_MASK;
  tlb[index].write = tlbEntryLo & TLB_WRITE ? true : false;
  tlb[index].write = tlbEntryLo & TLB_WRITE ? true : false;
  tlb[index].valid = tlbEntryLo & TLB_VALID ? true : false;
  tlb[index].valid = tlbEntryLo & TLB_VALID ? true : false;
  if (debugWrite) {
  if (debugWrite) {
    cPrintf("**** TLB[%02d] <- 0x%08X 0x%08X %c %c ****\n",
    cPrintf("**** TLB[%02d] <- 0x%08X 0x%08X %c %c ****\n",
            index, tlb[index].page, tlb[index].frame,
            index, tlb[index].page, tlb[index].frame,
Line 261... Line 261...
void mmuTbwi(void) {
void mmuTbwi(void) {
  int index;
  int index;
 
 
  index = tlbIndex & TLB_MASK;
  index = tlbIndex & TLB_MASK;
  tlb[index].page = tlbEntryHi & PAGE_MASK;
  tlb[index].page = tlbEntryHi & PAGE_MASK;
  tlb[index].frame = tlbEntryLo & PAGE_MASK;
  tlb[index].frame = tlbEntryLo & FRAME_MASK;
  tlb[index].write = tlbEntryLo & TLB_WRITE ? true : false;
  tlb[index].write = tlbEntryLo & TLB_WRITE ? true : false;
  tlb[index].valid = tlbEntryLo & TLB_VALID ? true : false;
  tlb[index].valid = tlbEntryLo & TLB_VALID ? true : false;
  if (debugWrite) {
  if (debugWrite) {
    cPrintf("**** TLB[%02d] <- 0x%08X 0x%08X %c %c ****\n",
    cPrintf("**** TLB[%02d] <- 0x%08X 0x%08X %c %c ****\n",
            index, tlb[index].page, tlb[index].frame,
            index, tlb[index].page, tlb[index].frame,
Line 296... Line 296...
  int i;
  int i;
 
 
  cPrintf("Resetting MMU...\n");
  cPrintf("Resetting MMU...\n");
  for (i = 0; i < TLB_SIZE; i++) {
  for (i = 0; i < TLB_SIZE; i++) {
    tlb[i].page = rand() & PAGE_MASK;
    tlb[i].page = rand() & PAGE_MASK;
    tlb[i].frame = rand() & PAGE_MASK;
    tlb[i].frame = rand() & FRAME_MASK;
    tlb[i].write = rand() & 0x1000 ? true : false;
    tlb[i].write = rand() & 0x1000 ? true : false;
    tlb[i].valid = rand() & 0x1000 ? true : false;
    tlb[i].valid = rand() & 0x1000 ? true : false;
    if (debugWrite) {
    if (debugWrite) {
      cPrintf("**** TLB[%02d] <- 0x%08X 0x%08X %c %c ****\n",
      cPrintf("**** TLB[%02d] <- 0x%08X 0x%08X %c %c ****\n",
              i, tlb[i].page, tlb[i].frame,
              i, tlb[i].page, tlb[i].frame,
Line 308... Line 308...
              tlb[i].valid ? 'v' : '-');
              tlb[i].valid ? 'v' : '-');
    }
    }
  }
  }
  tlbIndex = rand() & TLB_MASK;
  tlbIndex = rand() & TLB_MASK;
  tlbEntryHi = rand() & PAGE_MASK;
  tlbEntryHi = rand() & PAGE_MASK;
  tlbEntryLo = rand() & (PAGE_MASK | TLB_WRITE | TLB_VALID);
  tlbEntryLo = rand() & (FRAME_MASK | TLB_WRITE | TLB_VALID);
  mmuBadAddr = rand();
  mmuBadAddr = rand();
  mmuBadAccs = rand() & MMU_ACCS_MASK;
  mmuBadAccs = rand() & MMU_ACCS_MASK;
  randomIndex = TLB_MASK;
  randomIndex = TLB_MASK;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.