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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_61/] [or1ksim/] [mmu/] [immu.c] - Diff between revs 886 and 997

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

Rev 886 Rev 997
Line 108... Line 108...
 
 
unsigned long immu_translate(unsigned long virtaddr)
unsigned long immu_translate(unsigned long virtaddr)
{
{
  unsigned long phyaddr = immu_simulate_tlb(virtaddr);
  unsigned long phyaddr = immu_simulate_tlb(virtaddr);
 
 
/*  printf("IMMU translate(%x) = %x\n", virtaddr, phyaddr);*/
/*  PRINTF("IMMU translate(%x) = %x\n", virtaddr, phyaddr);*/
  return phyaddr;
  return phyaddr;
}
}
 
 
void itlb_info()
void itlb_info()
{
{
  if (!testsprbits(SPR_UPR, SPR_UPR_IMP)) {
  if (!testsprbits(SPR_UPR, SPR_UPR_IMP)) {
    printf("IMMU not implemented. Set UPR[IMP].\n");
    PRINTF("IMMU not implemented. Set UPR[IMP].\n");
    return;
    return;
  }
  }
 
 
  printf("Insn MMU %dKB: ", config.immu.nsets * config.immu.entrysize * config.immu.nways / 1024);
  PRINTF("Insn MMU %dKB: ", config.immu.nsets * config.immu.entrysize * config.immu.nways / 1024);
  printf("%d ways, %d sets, entry size %d bytes\n", config.immu.nways, config.immu.nsets, config.immu.entrysize);
  PRINTF("%d ways, %d sets, entry size %d bytes\n", config.immu.nways, config.immu.nsets, config.immu.entrysize);
}
}
 
 
/* First check if virtual address is covered by ITLB and if it is:
/* First check if virtual address is covered by ITLB and if it is:
    - increment ITLB read hit stats,
    - increment ITLB read hit stats,
    - set 'lru' at this way to config.immu.ustates - 1 and
    - set 'lru' at this way to config.immu.ustates - 1 and
Line 143... Line 143...
  int set;
  int set;
  int way;
  int way;
  int end_set = config.immu.nsets;
  int end_set = config.immu.nsets;
 
 
  if (!testsprbits(SPR_UPR, SPR_UPR_IMP)) {
  if (!testsprbits(SPR_UPR, SPR_UPR_IMP)) {
    printf("IMMU not implemented. Set UPR[IMP].\n");
    PRINTF("IMMU not implemented. Set UPR[IMP].\n");
    return;
    return;
  }
  }
 
 
  if ((start_set >= 0) && (start_set < end_set))
  if ((start_set >= 0) && (start_set < end_set))
    end_set = start_set + 1;
    end_set = start_set + 1;
  else
  else
    start_set = 0;
    start_set = 0;
 
 
  if (start_set < end_set) printf("\nIMMU: ");
  if (start_set < end_set) PRINTF("\nIMMU: ");
  /* Scan set(s) and way(s). */
  /* Scan set(s) and way(s). */
  for (set = start_set; set < end_set; set++) {
  for (set = start_set; set < end_set; set++) {
    printf("\nSet %x: ", set);
    PRINTF("\nSet %x: ", set);
    for (way = 0; way < config.immu.nways; way++) {
    for (way = 0; way < config.immu.nways; way++) {
      printf("  way %d: ", way);
      PRINTF("  way %d: ", way);
      printf("vpn=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_VPN));
      PRINTF("vpn=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_VPN));
      printf("lru=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_LRU));
      PRINTF("lru=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_LRU));
      printf("pl1=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_PL1));
      PRINTF("pl1=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_PL1));
      printf("v=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_V));
      PRINTF("v=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_V));
 
 
      printf("a=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_A));
      PRINTF("a=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_A));
      printf("d=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_D));
      PRINTF("d=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_D));
      printf("uxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_UXE));
      PRINTF("uxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_UXE));
      printf("sxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_SXE));
      PRINTF("sxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_SXE));
      printf("ppn=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_PPN));
      PRINTF("ppn=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_PPN));
    }
    }
  }
  }
  if (start_set < end_set) printf("\n");
  if (start_set < end_set) PRINTF("\n");
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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