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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_33/] [or1ksim/] [cpu/] [or1k/] [sprs.c] - Diff between revs 133 and 139

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

Rev 133 Rev 139
Line 24... Line 24...
#include "arch.h"
#include "arch.h"
#include "sprs.h"
#include "sprs.h"
 
 
extern int cont_run;   /* defined in toplevel.c */
extern int cont_run;   /* defined in toplevel.c */
extern int tt_stopped; /* defined in tick.c */
extern int tt_stopped; /* defined in tick.c */
 
extern int GlobalMode; /* CZ 21/06/01 */
 
 
static sprword sprs[MAX_SPRS];
static sprword sprs[MAX_SPRS];
 
 
int temp_disable_except = 0;
int temp_disable_except = 0;
int audio_cnt = 0;
int audio_cnt = 0;
Line 64... Line 65...
    break;
    break;
  case 0x1234:
  case 0x1234:
    printf("MTSPR(0x1234, %x);\n", value);
    printf("MTSPR(0x1234, %x);\n", value);
    break;
    break;
  }
  }
 
 
 
  /* What the hell is happening here? This looks like a bug
 
     waiting to happen. Assume regno = 2*MAX_SPRS_PER_GRP+3,
 
     which presumably means I want to set register 3 in
 
     group 2. Instead, I calculate ofs as 3, and regno as
 
     2, and get a final value of 5??? Is this correct?
 
     Oh well...I didn't write this. Who knows what it is
 
     actually supposed to do. It doesn't matter if regno
 
     is less than MAX_SPRS_PER_GRP, which is the only
 
     way I use it.  CZ - 21/06/01
 
  */
 
 
  regno /= MAX_SPRS_PER_GRP;
  regno /= MAX_SPRS_PER_GRP;
  regno += ofs;
  regno += ofs;
 
 
 
  /* CZ 21/06/01 ... the debugger wants to do this! */
 
  if(GlobalMode)
 
    {
 
      extern unsigned long pc;
 
 
 
      if(regno == SPR_PC)
 
        {
 
          sprs[SPR_PC] = value;
 
#if 0
 
          /* There is currently a problem with symbol tables by
 
             gdb. It doesn't properly set up the CPU. We'll ignore
 
             this for now. */
 
          pc = value;
 
          pc_phy = simulate_ic_mmu_fetch(pc);
 
          pcnext = pc+4;
 
#endif
 
          return;
 
        }
 
    }
 
 
  /*    printf("mtspr(%x, %x)\n", regno, value);
  /*    printf("mtspr(%x, %x)\n", regno, value);
   */   if (regno < MAX_SPRS)
   */   if (regno < MAX_SPRS)
     sprs[regno] = value;
     sprs[regno] = value;
   else {
   else {
     printf("\nABORT: write out of SPR range\n");
     printf("\nABORT: write out of SPR range\n");
Line 84... Line 117...
  int ofs = regno % MAX_SPRS_PER_GRP;
  int ofs = regno % MAX_SPRS_PER_GRP;
 
 
  regno /= MAX_SPRS_PER_GRP;
  regno /= MAX_SPRS_PER_GRP;
  regno += ofs;
  regno += ofs;
 
 
 
  /* CZ 21/06/01 ... the debugger wants to do this! */
 
  if(GlobalMode)
 
    {
 
      extern unsigned long pc;
 
 
 
      if(regno == SPR_PC)
 
        return pc;
 
    }
 
 
  /* MM: l.rfe, for example, temporarly disables
  /* MM: l.rfe, for example, temporarly disables
     exceptions.  We will make it appear as SR bit
     exceptions.  We will make it appear as SR bit
     is set.  */
     is set.  */
  if (regno == SPR_SR && temp_disable_except > 0)
  if (regno == SPR_SR && temp_disable_except > 0)
    return sprs[regno] | SPR_SR_EXR;
    return sprs[regno] | SPR_SR_EXR;

powered by: WebSVN 2.1.0

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