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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [mmu/] [dmmu.c] - Diff between revs 224 and 556

Show entire file | Details | Blame | View Log

Rev 224 Rev 556
Line 42... Line 42...
#include "stats.h"
#include "stats.h"
#include "except.h"
#include "except.h"
#include "sprs.h"
#include "sprs.h"
#include "misc.h"
#include "misc.h"
#include "sim-cmd.h"
#include "sim-cmd.h"
 
#include "pcu.h"
 
 
struct dmmu *dmmu_state;
struct dmmu *dmmu_state;
 
 
/* Data MMU */
/* Data MMU */
 
 
Line 138... Line 138...
                                           (dmmu->page_offset_mask));
                                           (dmmu->page_offset_mask));
    }
    }
 
 
  /* No, we didn't. */
  /* No, we didn't. */
  dmmu_stats.loads_tlbmiss++;
  dmmu_stats.loads_tlbmiss++;
#if 0
 
  for (i = 0; i < dmmu->nways; i++)
 
    if (((cpu_state.sprs[SPR_DTLBMR_BASE (i) + set] & SPR_DTLBMR_LRU) >> 6) <
 
        minlru)
 
      minway = i;
 
 
 
  cpu_state.sprs[SPR_DTLBMR_BASE (minway) + set] &= ~SPR_DTLBMR_VPN;
 
  cpu_state.sprs[SPR_DTLBMR_BASE (minway) + set] |= vpn << 12;
 
  for (i = 0; i < dmmu->nways; i++)
 
    {
 
      uorreg_t lru = cpu_state.sprs[SPR_DTLBMR_BASE (i) + set];
 
      if (lru & SPR_DTLBMR_LRU)
 
        {
 
          lru = (lru & ~SPR_DTLBMR_LRU) | ((lru & SPR_DTLBMR_LRU) - 0x40);
 
          cpu_state.sprs[SPR_DTLBMR_BASE (i) + set] = lru;
 
        }
 
    }
 
  cpu_state.sprs[SPR_DTLBMR_BASE (way) + set] &= ~SPR_DTLBMR_LRU;
 
  cpu_state.sprs[SPR_DTLBMR_BASE (way) + set] |= (dmmu->nsets - 1) << 6;
 
 
 
  /* 1 to 1 mapping */
 
  cpu_state.sprs[SPR_DTLBTR_BASE (minway) + set] &= ~SPR_DTLBTR_PPN;
 
  cpu_state.sprs[SPR_DTLBTR_BASE (minway) + set] |= vpn << 12;
 
 
 
  cpu_state.sprs[SPR_DTLBMR_BASE (minway) + set] |= SPR_DTLBMR_V;
 
#endif
 
  runtime.sim.mem_cycles += dmmu->missdelay;
  runtime.sim.mem_cycles += dmmu->missdelay;
  /* if tlb refill implemented in HW */
  /* if tlb refill implemented in HW */
  /* return ((cpu_state.sprs[SPR_DTLBTR_BASE(minway) + set] & SPR_DTLBTR_PPN) >> 12) * dmmu->pagesize + (virtaddr % dmmu->pagesize); */
  /* return ((cpu_state.sprs[SPR_DTLBTR_BASE(minway) + set] & SPR_DTLBTR_PPN) >> 12) * dmmu->pagesize + (virtaddr % dmmu->pagesize); */
 
 
  except_handle (EXCEPT_DTLBMISS, virtaddr);
  except_handle (EXCEPT_DTLBMISS, virtaddr);
 
 
 
  if (config.pcu.enabled)
 
    pcu_count_event(SPR_PCMR_DTLBM);
 
 
  return 0;
  return 0;
}
}
 
 
/* DESC: try to find EA -> PA transaltion without changing
/* DESC: try to find EA -> PA transaltion without changing
 *       any of precessor states. if this is not passible gives up
 *       any of precessor states. if this is not passible gives up

powered by: WebSVN 2.1.0

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