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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [or1k/] [sprs.c] - Diff between revs 600 and 624

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

Rev 600 Rev 624
Line 99... Line 99...
    if(regno >= 0x0400 && regno < 0x0420)
    if(regno >= 0x0400 && regno < 0x0420)
      reg[regno - 0x0400] = value;
      reg[regno - 0x0400] = value;
    break;
    break;
  }
  }
 
 
  if (regno < MAX_SPRS)
  if (regno < MAX_SPRS) {
    sprs[regno] = value;
    sprs[regno] = value;
 
    if (runtime.sim.fspr_log) {
 
      fprintf(runtime.sim.fspr_log, "Write to SPR  : [%08lX] <- [%08lX]\n", regno, value);
 
    }
 
  }
  else if (config.sim.verbose)
  else if (config.sim.verbose)
    printf("WARNING: write out of SPR range %08X\n", regno);
    printf("WARNING: write out of SPR range %08X\n", regno);
}
}
 
 
#if 0
#if 0
Line 113... Line 117...
mfspr_(const int regno)
mfspr_(const int regno)
{
{
  extern unsigned long reg[32];
  extern unsigned long reg[32];
  extern unsigned long pc;
  extern unsigned long pc;
  extern unsigned long pcprev;
  extern unsigned long pcprev;
 
  sprword val;
 
 
  switch (regno) {
  switch (regno) {
  case SPR_SR:
  case SPR_SR:
    /* Exceptions are always enabled */
    /* Exceptions are always enabled */
    return sprs[regno] | SPR_SR_EXR;
    val = sprs[regno] | SPR_SR_EXR;
 
    break;
  case SPR_NPC:
  case SPR_NPC:
    return pc;
    val = pc;
 
    break;
  case SPR_PPC:
  case SPR_PPC:
    return pcprev;
    val = pcprev;
 
    break;
  default:
  default:
    /* Links to GPRS */
    /* Links to GPRS */
    if(regno >= 0x0400 && regno < 0x0420)
    if(regno >= 0x0400 && regno < 0x0420)
      return reg[regno - 0x0400];
      val = reg[regno - 0x0400];
    else if (regno < MAX_SPRS)
    else if (regno < MAX_SPRS)
      return sprs[regno];
      val = sprs[regno];
  }
  }
  if (config.sim.verbose)
 
 
  if (regno < MAX_SPRS) {
 
    if (runtime.sim.fspr_log) {
 
      fprintf(runtime.sim.fspr_log, "Read from SPR : [%08lX] -> [%08lX]\n", regno, val);
 
    }
 
    return val;
 
  }
 
 
 
  if (config.sim.verbose) {
    printf ("WARNING: read out of SPR range %08X\n", regno);
    printf ("WARNING: read out of SPR range %08X\n", regno);
 
  }
 
 
  return 0;
  return 0;
}
}
#endif
#endif
 
 
/* Show status of important SPRs. */
/* Show status of important SPRs. */

powered by: WebSVN 2.1.0

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