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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [cache/] [dcache_model.c] - Diff between revs 884 and 992

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

Rev 884 Rev 992
Line 28... Line 28...
#include <errno.h>
#include <errno.h>
#include <stdarg.h>
#include <stdarg.h>
 
 
#include "dcache_model.h"
#include "dcache_model.h"
#include "abstract.h"
#include "abstract.h"
 
#include "except.h"
#include "stats.h"
#include "stats.h"
#include "spr_defs.h"
#include "spr_defs.h"
#include "sprs.h"
#include "sprs.h"
#include "sim-config.h"
#include "sim-config.h"
 
 
Line 77... Line 78...
 
 
  if ((!testsprbits(SPR_UPR, SPR_UPR_DCP)) ||
  if ((!testsprbits(SPR_UPR, SPR_UPR_DCP)) ||
      (!testsprbits(SPR_SR, SPR_SR_DCE))   ||
      (!testsprbits(SPR_SR, SPR_SR_DCE))   ||
      data_ci) {
      data_ci) {
    if (width == 4)
    if (width == 4)
      return evalsim_mem32(dataaddr);
      tmp = evalsim_mem32(dataaddr);
    else if (width == 2)
    else if (width == 2)
      return (unsigned long)evalsim_mem16(dataaddr);
      tmp = (unsigned long)evalsim_mem16(dataaddr);
    else if (width == 1)
    else if (width == 1)
      return (unsigned long)evalsim_mem8(dataaddr);
      tmp = (unsigned long)evalsim_mem8(dataaddr);
 
 
 
    if(!cur_area) {
 
      if (width == 4)
 
        printf("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", dataaddr);
 
      else if (width == 2)
 
        printf("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", dataaddr);
 
      else if (width == 1)
 
        printf("EXCEPTION: read out of memory (8-bit access to %.8lx)\n", dataaddr);
 
      except_handle(EXCEPT_BUSERR, cur_vadd);
 
      return 0;
 
    }
 
 
 
    if (!pending.valid && cur_area->log)
 
      fprintf (cur_area->log, "[%08x] -> read %08x\n", dataaddr, tmp);
 
 
 
    return tmp;
  }
  }
 
 
  /* Which set to check out? */
  /* Which set to check out? */
  set = (dataaddr / config.dc.blocksize) % config.dc.nsets;
  set = (dataaddr / config.dc.blocksize) % config.dc.nsets;
  tagaddr = (dataaddr / config.dc.blocksize) / config.dc.nsets;
  tagaddr = (dataaddr / config.dc.blocksize) / config.dc.nsets;
Line 130... Line 147...
      dc[set].way[minway].line[((dataaddr + i) & (config.dc.blocksize - 1)) >> 2] =
      dc[set].way[minway].line[((dataaddr + i) & (config.dc.blocksize - 1)) >> 2] =
        evalsim_mem32((dataaddr & ~(config.dc.blocksize - 1)) + (((dataaddr & ~3ul)+ i) & (config.dc.blocksize - 1)));
        evalsim_mem32((dataaddr & ~(config.dc.blocksize - 1)) + (((dataaddr & ~3ul)+ i) & (config.dc.blocksize - 1)));
      if(!cur_area) {
      if(!cur_area) {
        dc[set].way[minway].tagaddr = -1;
        dc[set].way[minway].tagaddr = -1;
        dc[set].way[minway].lru = 0;
        dc[set].way[minway].lru = 0;
 
        printf("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", dataaddr);
 
        except_handle(EXCEPT_BUSERR, cur_vadd);
        return 0;
        return 0;
      }
      }
 
      if (!pending.valid && cur_area->log)
 
        fprintf (cur_area->log, "[%08x] -> read %08x\n", dataaddr, tmp);
    }
    }
 
 
    dc[set].way[minway].tagaddr = tagaddr;
    dc[set].way[minway].tagaddr = tagaddr;
    for (i = 0; i < config.dc.nways; i++)
    for (i = 0; i < config.dc.nways; i++)
      if (dc[set].way[i].lru)
      if (dc[set].way[i].lru)

powered by: WebSVN 2.1.0

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