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

Subversion Repositories or1k

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

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

Rev 886 Rev 997
Line 110... Line 110...
 
 
unsigned long dmmu_translate(unsigned long virtaddr, int write_access)
unsigned long dmmu_translate(unsigned long virtaddr, int write_access)
{
{
  unsigned long phyaddr = dmmu_simulate_tlb(virtaddr, write_access);
  unsigned long phyaddr = dmmu_simulate_tlb(virtaddr, write_access);
 
 
/*  printf("DMMU translate(%x) = %x\n", virtaddr, phyaddr);*/
/*  PRINTF("DMMU translate(%x) = %x\n", virtaddr, phyaddr);*/
  return phyaddr;
  return phyaddr;
}
}
 
 
 
 
void dtlb_info()
void dtlb_info()
{
{
  if (!testsprbits(SPR_UPR, SPR_UPR_DMP)) {
  if (!testsprbits(SPR_UPR, SPR_UPR_DMP)) {
    printf("DMMU not implemented. Set UPR[DMP].\n");
    PRINTF("DMMU not implemented. Set UPR[DMP].\n");
    return;
    return;
  }
  }
 
 
  printf("Data MMU %dKB: ", config.dmmu.nsets * config.dmmu.entrysize * config.dmmu.nways / 1024);
  PRINTF("Data MMU %dKB: ", config.dmmu.nsets * config.dmmu.entrysize * config.dmmu.nways / 1024);
  printf("%d ways, %d sets, entry size %d bytes\n", config.dmmu.nways, config.dmmu.nsets, config.dmmu.entrysize);
  PRINTF("%d ways, %d sets, entry size %d bytes\n", config.dmmu.nways, config.dmmu.nsets, config.dmmu.entrysize);
}
}
 
 
/* First check if virtual address is covered by DTLB and if it is:
/* First check if virtual address is covered by DTLB and if it is:
    - increment DTLB read hit stats,
    - increment DTLB read hit stats,
    - set 'lru' at this way to config.dmmu.ustates - 1 and
    - set 'lru' at this way to config.dmmu.ustates - 1 and
Line 146... Line 146...
  int set;
  int set;
  int way;
  int way;
  int end_set = config.dmmu.nsets;
  int end_set = config.dmmu.nsets;
 
 
  if (!testsprbits(SPR_UPR, SPR_UPR_DMP)) {
  if (!testsprbits(SPR_UPR, SPR_UPR_DMP)) {
    printf("DMMU not implemented. Set UPR[DMP].\n");
    PRINTF("DMMU not implemented. Set UPR[DMP].\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("\nDMMU: ");
  if (start_set < end_set) PRINTF("\nDMMU: ");
  /* 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.dmmu.nways; way++) {
    for (way = 0; way < config.dmmu.nways; way++) {
      printf("  way %d: ", way);
      PRINTF("  way %d: ", way);
      printf("vpn=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_VPN));
      PRINTF("vpn=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_VPN));
      printf("lru=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_LRU));
      PRINTF("lru=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_LRU));
      printf("pl1=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_PL1));
      PRINTF("pl1=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_PL1));
      printf("v=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_V));
      PRINTF("v=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_V));
 
 
      printf("a=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_A));
      PRINTF("a=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_A));
      printf("d=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_D));
      PRINTF("d=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_D));
      printf("ure=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_URE));
      PRINTF("ure=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_URE));
      printf("uwe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_UWE));
      PRINTF("uwe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_UWE));
      printf("sre=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SRE));
      PRINTF("sre=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SRE));
      printf("swe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SWE));
      PRINTF("swe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SWE));
      printf("ppn=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_PPN));
      PRINTF("ppn=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_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.