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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [hwtests/] [tlbtest/] [main.c] - Diff between revs 14 and 256

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

Rev 14 Rev 256
Line 279... Line 279...
  offset = 0x123;
  offset = 0x123;
  for (i = 0; i < 100000; i++) {
  for (i = 0; i < 100000; i++) {
    /* compute pseudo-random virtual word address (page number 0..31) */
    /* compute pseudo-random virtual word address (page number 0..31) */
    page = (page * 13 + 1) & 0x1F;
    page = (page * 13 + 1) & 0x1F;
    offset = (offset * 109) & 0x00000FFF;
    offset = (offset * 109) & 0x00000FFF;
    virt = (page << 12) | (offset & ~0x3);
    virt = (page << 12) | (offset & 0xFFFFFFFC);
    /* lookup frame number in TLB and construct physical word address */
    /* lookup frame number in TLB and construct physical word address */
    index = probeTLB(virt);
    index = probeTLB(virt);
    if (index & 0x80000000) {
    if (index & 0x80000000) {
      fail = true;
      fail = true;
      break;
      break;
    }
    }
    frame = getTLB_LO(index) & 0xFFFFF000;
    frame = getTLB_LO(index) & 0xFFFFF000;
    phys = frame | (offset & ~0x3);
    phys = frame | (offset & 0xFFFFFFFC);
    /* access memory by dereferencing the virtual address */
    /* access memory by dereferencing the virtual address */
    cont = *(Word *)virt;
    cont = *(Word *)virt;
    /* word read should equal physical address */
    /* word read should equal physical address */
    if (cont != phys) {
    if (cont != phys) {
      fail = true;
      fail = true;

powered by: WebSVN 2.1.0

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