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 1506 and 1555

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

Rev 1506 Rev 1555
Line 43... Line 43...
#include "spr_defs.h"
#include "spr_defs.h"
#include "execute.h"
#include "execute.h"
#include "stats.h"
#include "stats.h"
#include "sprs.h"
#include "sprs.h"
#include "sim-config.h"
#include "sim-config.h"
 
#include "misc.h"
 
 
/* Data cache */
/* Data cache */
 
 
struct dc_set {
struct dc_set {
  struct {
  struct {
Line 324... Line 325...
void dc_nsets(union param_val val, void *dat)
void dc_nsets(union param_val val, void *dat)
{
{
  if (is_power2(val.int_val) && val.int_val <= MAX_DC_SETS){
  if (is_power2(val.int_val) && val.int_val <= MAX_DC_SETS){
    config.dc.nsets = val.int_val;
    config.dc.nsets = val.int_val;
    cpu_state.sprs[SPR_DCCFGR] &= ~SPR_DCCFGR_NCS;
    cpu_state.sprs[SPR_DCCFGR] &= ~SPR_DCCFGR_NCS;
    cpu_state.sprs[SPR_DCCFGR] |= log2(val.int_val) << 3;
    cpu_state.sprs[SPR_DCCFGR] |= log2_int(val.int_val) << 3;
  }
  }
  else {
  else {
    char tmp[200];
    char tmp[200];
    sprintf (tmp, "value of power of two and lower or equal than %i expected.", MAX_DC_SETS);
    sprintf (tmp, "value of power of two and lower or equal than %i expected.", MAX_DC_SETS);
    CONFIG_ERROR(tmp);
    CONFIG_ERROR(tmp);
Line 338... Line 339...
void dc_nways(union param_val val, void *dat)
void dc_nways(union param_val val, void *dat)
{
{
  if (is_power2(val.int_val) && val.int_val <= MAX_DC_WAYS){
  if (is_power2(val.int_val) && val.int_val <= MAX_DC_WAYS){
    config.dc.nways = val.int_val;
    config.dc.nways = val.int_val;
    cpu_state.sprs[SPR_DCCFGR] &= ~SPR_DCCFGR_NCW;
    cpu_state.sprs[SPR_DCCFGR] &= ~SPR_DCCFGR_NCW;
    cpu_state.sprs[SPR_DCCFGR] |= log2(val.int_val);
    cpu_state.sprs[SPR_DCCFGR] |= log2_int(val.int_val);
  }
  }
  else{
  else{
    char tmp[200];
    char tmp[200];
    sprintf (tmp, "value of power of two and lower or equal than %i expected.",
    sprintf (tmp, "value of power of two and lower or equal than %i expected.",
    MAX_DC_WAYS);
    MAX_DC_WAYS);
Line 353... Line 354...
void dc_blocksize(union param_val val, void *dat)
void dc_blocksize(union param_val val, void *dat)
{
{
  if (is_power2(val.int_val)) {
  if (is_power2(val.int_val)) {
    config.dc.blocksize = val.int_val;
    config.dc.blocksize = val.int_val;
    cpu_state.sprs[SPR_ICCFGR] &= ~SPR_ICCFGR_CBS;
    cpu_state.sprs[SPR_ICCFGR] &= ~SPR_ICCFGR_CBS;
    cpu_state.sprs[SPR_ICCFGR] |= log2(val.int_val) << 7;
    cpu_state.sprs[SPR_ICCFGR] |= log2_int(val.int_val) << 7;
  } else
  } else
    CONFIG_ERROR("value of power of two expected.");
    CONFIG_ERROR("value of power of two expected.");
}
}
 
 
void dc_ustates(union param_val val, void *dat)
void dc_ustates(union param_val val, void *dat)

powered by: WebSVN 2.1.0

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